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) :
- Oracle
- MySql
- Microsoft SQL Server
- SQLite
- PostgreSQL
- IBM DB2
Advantages of relational databases:
- 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);
- Support for generic SQL (Structured Query Language) statements;
- Rich integrity greatly reduces the problem of data redundancy and data inconsistencies. And all by the table structure, the file format is consistent;
- You can use SQL sentences to do very complex queries between multiple tables;
- 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.
- 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.
- 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.
- 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.
- 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.
- 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:
- Key value database: Redis, Memcached, Riak
- Column family databases: Bigtable, HBase, Cassandra
- Document databases: MongoDB, CouchDB, MarkLogic
- Graph database: Neo4j, InfoGrid
Advantages of non-relational databases:
- 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.
- Fast speed and high efficiency. NoSQL can use hard disks or ram as carriers, whereas relational databases can only use hard disks.
- Huge amounts of data can be maintained and processed easily and cheaply.
- Non-relational database has the advantages of simple expansion, high concurrency, high stability and low cost.
- Distributed processing of data can be realized.
Disadvantages of non-relational database:
- Non-relational databases do not provide SQL support for the time being and are costly to learn and use.
- 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.
- Not as functional as a relational database.
- 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…