What is no?

NoSQL refers to a non-relational database. NoSQL is sometimes called Not Only SQL abbreviation, is different from the traditional relational database database management system.

NoSQL is used to store very large scale data. (Google or Facebook, for example, collect trillions of bits of data for their users every day). These types of data stores do not require fixed schemas and can scale horizontally without unnecessary operations.

 

 

RDBMS review

RDBMS, or Relational Database Management System, is a System that organizes data into related rows and columns, and the computer software that manages Relational databases is Relational Database Management System. The commonly used database software includes Oracle and SQL Server.

 

Relational databases follow the ACID rule

A transaction is similar to a transaction in the real world. It has the following four characteristics:

1, A (Atomicity

Atomicity is easy to understand, which means that all operations in a transaction are either done or not done. The condition for a transaction to succeed is that all operations in a transaction are successful. If only one operation fails, the whole transaction fails and needs to be rolled back.

For example, in bank transfer, 100 yuan is transferred from account A to account B. There are two steps: 1) Withdraw 100 yuan from account A; 2) Deposit 100 yuan into account B. These two steps either complete together, or do not complete together, if only complete the first step, the second step failed, the money will be puzzling less 100 yuan.

2, C (Consistency

Consistency is also easy to understand, which means that the database is always in a consistent state and that the execution of a transaction does not change the consistency constraints of the database.

For example, the existing integrity constraint A +b=10, if a transaction changes A, then b must be changed so that a+b=10 is still satisfied after the transaction ends, otherwise the transaction fails.

3. I (Isolation) Independence

The so-called independence means that concurrent transactions do not affect each other. If the data to be accessed by one transaction is being modified by another transaction, as long as the other transaction is not committed, the data accessed by the other transaction is not affected by the uncommitted transaction.

For example, there is A transaction that transfers 100 yuan from account A to account B. Under the condition that the transaction is not completed, if B queries his own account at this moment, he cannot see the newly added 100 yuan.

4. D (Durability)

Persistence means that once a transaction is committed, its changes will be permanently stored in the database and will not be lost in the event of an outage.

 

RDBMS vs NoSQL

RDBMS – Highly organized Structured Data – Structured Query Language (SQL)

– Data and relationships are stored in separate tables. – Data manipulation language, data definition Language – Strict consistency – basic transactions

NoSQL – Stands for more than SQL – No declarative query language – No predefined schema – key-value pair storage, column storage, document storage, graphical database – Ultimate consistency, not ACID properties – Unstructured and unpredictable data – CAP theorem – High performance, High availability and scalability

 

Advantages/disadvantages of NoSQL

Advantages:

· – High scalability

· – Distributed computing

– Low cost

· – Architectural flexibility, semi-structured data

· – No complicated relationship

Disadvantages:

· – No standardization

· – Limited query functionality (so far)

· – The ultimate consistency is not an intuitive program

CAP theorem

In computer science, CAP theorem, also known as Brewer’s Theorem, states that it is impossible for a distributed computing system to satisfy three things at the same time:

· Consistency (all nodes have the same data at the same time)

· Availability (Ensure that each request is responded regardless of success or failure)

The loss or failure of any information in the system will not affect the continued operation of the system.

The core of CAP theory is that it is impossible for a distributed system to satisfy the three requirements of consistency, availability and fault tolerance of partition at the same time, but only two at most.

Therefore, according to the CAP principle, NoSQL database can be divided into three categories that meet the CA principle, CP principle and AP principle:

· CA – A single point cluster, a system that meets consistency, availability, and is usually not very strong in scalability.

· CP – Systems that meet consistency and partition tolerance usually have low performance.

· AP – Systems that meet availability and partition tolerance may generally have lower requirements for consistency.



· NoSQL database classification

type

Some representative

The characteristics of

Column storage

Hbase

Cassandra

Hypertable

As the name implies, data is stored in columns. The biggest feature is easy to store structured and semi-structured data, easy to do data compression, for a certain column or several columns of the query has a very large I/O advantage.

Document storage

MongoDB

CouchDB

Documents are stored in a JSON-like format, and the content is document-like. This gives you the opportunity to index certain fields and implement some of the functionality of a relational database.

The key – value stored

Tokyo Cabinet / Tyrant

Berkeley DB

MemcacheDB

Redis

You can quickly query the value of the key. Generally, the store accepts the value regardless of the format. (Redis includes other features)

Figure storage

Neo4J

FlockDB

Optimal storage of graphical relationships. Using traditional relational database to solve the low performance, and design is not convenient to use.

Object storage

db4o

Versant

Through the similar object-oriented language syntax operation database, through the way of objects access data.

XML database

Berkeley DB XML

BaseX

Store XML data efficiently and support XML internal query syntax such as XQuery and Xpath.