Preface:

In our daily development, the use of relational database and non-relational database has been a mature software product development process must store data tools. So you know the difference between a relational database and a non-relational database that you’ve been using for so long? Let’s give a detailed introduction.

Relational database (SQL) :

What is a relational database?

A relational database is a database that uses a relational model (a two-dimensional table model) to organize data.

What is a relational model:

A relational model can be simply understood as a two-dimensional table model, and a relational database is a data organization composed of two-dimensional tables and their relationships.

Common Relational database Management Systems (ORDBMS) :

  1. Oracle
  2. MySql
  3. Microsoft SQL Server
  4. SQLite
  5. PostgreSQL
  6. IBM DB2

Advantages of relational databases:

  1. Using a two-dimensional table structure is very close to normal development logic (relational data models are easier to understand than other models such as hierarchical and mesh data models);
  2. Support for generic SQL (Structured Query Language) statements;
  3. Rich integrity greatly reduces the problem of data redundancy and data inconsistencies. And all by the table structure, the file format is consistent;
  4. You can use SQL sentences to do very complex queries between multiple tables;
  5. Relational database provides support for transactions, which can ensure the correct execution of transactions in the system, and provide transaction recovery, rollback, concurrency control and deadlock solution.
  6. Data is stored on disks for security and reliability.

Disadvantages of relational database:

With the continuous development of Internet enterprises, the data is increasing day by day, so the relational database will have a lot of shortcomings in the face of massive data.

  1. High concurrent read and write capability Poor: The concurrent access of website users is very high. However, the maximum number of connections to a database and disk I/O are limited. Therefore, many people cannot connect to a database at the same time.
  2. Low read/write efficiency in the case of massive data: When I/O operations are performed on a table with a large amount of data, the system waits for a long time for a response.
  3. Poor scalability: It is not as simple as adding hardware and service nodes to expand performance and load capacity as Web Server and App Server.
  4. Low data model flexibility: The data model of a relational database is strictly defined and cannot accommodate new data types quickly (you need to know in advance what type of data you need to store).

Non-relational database (NOSQL) :

What is a (NOSQL) non-relational database:

Non-relational databases are also called NoSQL (Not Only SQL), which means more than JUST SQL. The index data is usually stored in the database as objects, and the relationship between objects is determined by the attributes of each object itself, which is often used to store unstructured data.

Common NOSQL databases:

  1. Key value database: Redis, Memcached, Riak
  2. Column family databases: Bigtable, HBase, Cassandra
  3. Document databases: MongoDB, CouchDB, MarkLogic
  4. Graph database: Neo4j, InfoGrid

Advantages of non-relational databases:

  1. Non-relational databases can store data in key-value format, document format, image format, and so on. It is flexible to use and applies to a wide range of scenarios, while relational databases only support basic types.
  2. Fast speed and high efficiency. NoSQL can use hard disks or ram as carriers, whereas relational databases can only use hard disks.
  3. Huge amounts of data can be maintained and processed easily and cheaply.
  4. Non-relational database has the advantages of simple expansion, high concurrency, high stability and low cost.
  5. Distributed processing of data can be realized.

Disadvantages of non-relational database:

  1. Non-relational databases do not provide SQL support for the time being and are costly to learn and use.
  2. Non-relational databases have no transaction processing and cannot guarantee data integrity and security. Good for handling large amounts of data, but not necessarily secure.
  3. Not as functional as a relational database.
  4. Complex table associative query is not easy to implement.

Reference article:

C.biancheng.net/view/6490.h…

baike.baidu.com/item/NoSQL

Baike.baidu.com/item/%E5%85…