No-sql database: not just SQL
Definition: Non-relational database; NoSQL is used for storage of hyper-scale data. (for example, Google or Facebook collects trillions of bits of data for their users every day). These types of data stores do not require a fixed pattern and can be scaled horizontally without extra action. Further data mining and analysis is required.
RDBMS VS NOSQL
Rdbms |
Nosql |
Highly organized structured data |
Represents more than just a SQL |
Structured Query Language (SQL) (SQL) |
No declarative query Language |
Data and relationships are stored in separate tables |
No pre-defined pattern |
Data manipulation language, data definition language |
Key-value pairs storage, column storage, document storage, graphics database |
Strict consistency |
Final consistency, not ACID properties |
Basic transaction |
Unstructured and unpredictable data |
|
Cap theorem |
|
High performance, highly available and scalable |
The principle of weak requirements for usability and consistency: BASE
- Basically availble--Basic available
- Soft-state-Soft state/flexible transaction. "Soft state" can be understood as "no connection", while "hard state" is "connection oriented"
- Eventual consistency-final consistency is ultimately the ultimate goal of ACID.
NoSQL Database Classification
Type |
Section represents
|
Characteristics |
Column Storage |
Hbase Cassandra Hypertable |
As the name implies, data is stored in columns. The biggest feature is the convenient storage of structured and semi-structured data, easy to do data compression, for a column or a few columns of the query has a very large IO advantage. |
Document storage |
Mongodb Couchdb |
Document storage is typically stored in a JSON-like format, and the stored content is document-based. This also gives you the opportunity to index certain fields and implement certain functions of the relational database. |
Key-value Storage |
Tokyo cabinet/tyrant Berkeley DB Memcachedb Redis |
You can quickly query to its value with key. In general, the format of the store regardless of the value of the full receipt. (Redis includes other features) |
Diagram Storage |
Neo4j Flockdb |
The best storage for graphical relationships. The use of traditional relational databases to address the performance of poor, and design use is not convenient. |
Object storage |
Db4o Versant |
The database is manipulated by object-oriented syntax, and data is accessed through objects. |
XML database |
Berkeley DB XML BaseX |
Efficiently stores XML data and supports internal query syntax for XML, such as Xquery,xpath. |
Key-value Storage: (Redis-based)
The traditional relational database, dealing with a one-to-many problem, requires the foreign key to be placed on a multi-side, because there is no concept of aggregation in the RDBMS theory. With Redis, we can manage a one-to-many relationship at one end, using set.
If you use MySQL, when the data size is very large, the above two query operations need to rely on the table Association technology, and large table joins in large systems is a need to avoid the operation. Instead, each operation of Redis is confined to a smaller dataset, and the Key-value storage form, locating key is just a complex O (1) operation. With the very huge data volume, Redis performance is excellent, which is the advantage of NoSQL!
Key-value Key-Value storage principle first knowledge (NOSQL)