The difference and choice between relational database and nosql database

Relational databases and nosql databases serve different purposes.

We often use these different types of databases in the wrong places. 
The most common is to store large amounts of non-computational data in relational databases. 
Like logs, accounts, these are just data that needs to be read and written in relational databases. 
Use relational databases as big hard drives.

The specialty of relational databases is the horizontal comparison of data.

For example, Xiao Ming and Xiao Huang, whose score is higher? 
What is obtained is the logical relationship between the data of different objects. 
MySQL is a typical representative of this type of database. 
His statement supports the filtering and sorting of data, and puts the data of multiple objects in the same table. 
These functions are all for the convenience of discovering and sorting out the relationship between the 
data, and obtaining a statistically significant conclusion through the analysis of the data relationship. 
Then the characteristics of relational databases determine that it is impossible to require high read and write performance.

Disk database and in-memory database

Distinguish databases according to storage media There are differences between hard disk databases and in-memory databases. 
The characteristics of hard disk databases are that they store large data and support persistent storage. The disadvantage is that the read and write speed is slow. 
In-memory databases are characterized by fast read and write speeds and do not support persistent storage. 
In the past, due to the high price of memory, unstable operating system and slow network connection, the 
database was mainly based on hard disk database. 
With the current increase in network speed, the decline in memory prices, and the maturity of operating systems, 
the mature in-memory databases of distributed storage solutions and distributed computing solutions tend to replace hard disk databases.

mysql is a relational database + hard disk database

The relational database needs to establish an index and cut the data horizontally. 
It is determined that the relational database has a good adaptability to the hard disk database in reading and writing data.

The meaning of data horizontal cutting

For example, if Zhang San and Li Si are put into a medical relational database, 
the head data of Zhang Santou and Li Si will be put into the brain department table. 
Drive and put the body into the surgical table. 
The rest is put into the internal medicine table. 
In this way, if you want Zhang San's complete data, you must visit all the tables. 
The characteristics of relational databases determine that the database sees the relationships of all complete data in a higher global view.

The emergence of the nosql database is exactly the pattern relative to the relational database + hard disk database

He is a non-relational database + in-memory database model. 
The so-called non-relational database means that it does not care about the relationship between an object and other objects in the global context. 
As long as it can quickly read and write the data of an object.

Nosql's calculations are done before being stored in the database. 
The calculation of relational database is mostly done after the data is stored in the database. 
Nosql can also be compatible with real-time computing systems and expand into a powerful data computing center.

Nosql is characterized by real-time fast and small scope. 
For example, Zhang San met Li Si and gave him a dollar. 
Nosql handles this in memory, so it is much faster than a hard disk database.

The in-memory database and the hard disk database have a good complementary relationship. 
No matter how good the cache of the hard disk database is, it cannot be as fast as the in-memory database. 
It is the developers themselves who understand the logic best. 
As far as the cache hit rate of a simple account system is concerned, 
there is still a big difference in efficiency between a system with a cache and reading mysql directly.

The full text is over!

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325945173&siteId=291194637