On the NoSQL data model bitsCN.com
This article provides a brief overview of NoSQL Data Modeling Techniques. The original article discusses several Data models of NoSQL in detail. It is a comprehensive document that understands NoSQL data models but does not miss.
Some of the non-functional features of NoSQL, such as the discussion of scalability, performance, and consistency, already exist. However, knowledge about the internal data models of NoSQL products has been lacking. This Article hopes to systematically discuss the NoSQL data models.
We roughly divide NoSQL data models into the following categories: Key-Value storage, BigTable databases, document databases, full-text index engines, and graph databases.
The following is a simple and interesting example to describe the structure of different data models:
Based on the above image, we will briefly describe several data models:
- The Key-Value model is the simplest and most convenient data model. it supports simple key-value storage and extraction of Key-Value pairs.
- A major problem with the Key-Value model is that it is usually implemented by HashTable, So range query cannot be performed, so the ordered Key-Value model appears, ordered Key-Value supports range query
- Although the ordered Key-Value model can solve range queries and problems, its Value is still a non-structured binary code or pure string. generally, we can only parse the corresponding structure at the application layer. BigTable-like data models support the storage of structured data, including columns, column clusters, timestamps, version control, and other metadata.
- Document-type storage has two major improvements compared to BigTable storage. First, its Value supports the definition of complex structures, and second, supports the definition of database indexes.
- The main difference between the full-text index model and document-type storage is that the index of document-type storage is mainly organized by field name, while the full-text index model is organized by the specific value of the field.
- The graph database model can also be seen as a branch developed from the Key-Value model. The difference is that its data is widely associated, and this model supports some graph structure algorithms.
The differences between NoSQL and relational databases are summarized as follows:
- NoSQL database data models are generally closer to actual needs. When using relational databases, the question to be concerned is "what functions can be provided by databases", while NoSQL models are more concerned with "What problems can be solved"
- When using the NoSQL data model, you usually need to have a certain understanding of the internal structure and implementation algorithm of the storage.
- When using NoSQL databases, you usually have to handle data structure parsing and redundant data replication issues.
- For relational databases, hierarchical data storage is not well processed. However, for graph databases or other NoSQL databases, the hierarchical processing of data is pre-considered.
At present, the representative products of several NoSQL categories are listed as follows:
- Key-Value storage: Oracle Coherence, Redis, Kyoto Cabinet
- Class BigTable storage: Apache HBase, Apache Cassandra
- Document Database: MongoDB, CouchDB
- Full-text indexing: Apache Lucene and Apache Solr
- Graph Database: neo4j, FlockDB
BitsCN.com