Introduction to relational database and non-relational database

1. Related concepts

Relational Database

  • A relational database is a structured database, created on the basis of a relational model (two-dimensional table model), and is generally record-oriented.
  • SQL statement (standard data query language) is a language based on relational database, used to perform retrieval and operation of data in relational database
  • Mainstream relational databases include Oracle, MySQL, SQL Server, Microsoft Access, DB2, etc.

Non-relational database

  • NoSQL (NoSQL = Not only sQL), which means "not just SQL", is the general term for non-relational databases.
  • Except for the mainstream relational databases, all databases are considered non-relational.
  • The mainstream NoSQL databases include Redis, MongBD, Hbase, Memcached, etc.

Two, the difference between relational database and non-relational database

Different data storage methods

  • The main difference between relational and non-relational databases is the way data is stored.
  • Relational data is naturally in table format, so it is stored in the rows and columns of the data table. Data tables can be stored in association with each other, and data can be easily extracted.
  • On the contrary, non-relational data is not suitable to be stored in the rows and columns of the data table, but is grouped together in large chunks.
  • Non-relational data is usually stored in data sets, like documents, key-value pairs, or graph structures. Your data and its characteristics are the primary factors that influence the choice of data storage and retrieval methods.

Different expansion methods

  • The biggest difference between SQL and NoSQL databases may be in the way of expansion. Of course, it must be expanded to support the increasing demand.
  • To support more concurrency, the SQL database is scaled vertically, that is to say, to increase the processing power and use faster computers, so that the same data set can be processed faster. Because the data is stored in relational tables, the performance bottleneck of the operation may involve many tables, which need to be overcome by improving computer performance. Although the SQL database has a lot of room for expansion, it will eventually reach the upper limit of vertical expansion.
  • The NoSQL database is scaled horizontally. Because non-relational data storage is naturally distributed, the expansion of NoSQL databases can share the load by adding more ordinary database servers (nodes) to the resource pool.

Different support for transactional

  • If data operations require high transactionality or complex data queries need to control the execution plan, then traditional SQL databases are your best choice in terms of performance and stability.
    SQL databases support fine-grained control of transaction atomicity and are easy to rollback transactions. .
    Although MoSQL databases can also use transaction operations, they cannot be compared with relational databases in terms of stability, so their real shining value is in the scalability of operations and the processing of large data volumes.

Third, the background of non-relational databases

It can be used to deal with the three high problems of web2.0 pure dynamic website type.

  • High performance-high concurrent read and write requirements for the database
  • Huge Storage-the need for efficient storage and access to massive data
  • High Scalability && High Availability——Requirements for database high scalability and high availability

Both relational database and non-relational database have their own characteristics and application scenarios. The close combination of the two will bring new ideas to the development of web2.0 database. Let relational databases focus on relations, and non-relational databases focus on storage. For example, in a MySQL database environment where read and write are separated, frequently accessed data can be stored in a non-relational database to improve access speed.

to sum up

Relational database:
instance >> database >> table >> record row (row), data field (column)

Non-relational databases:
Example >> Database >> Collection >> Key-value pairs (key-value)
Non-relational databases do not need to manually build databases and collections (tables).

Guess you like

Origin blog.csdn.net/weixin_51613313/article/details/113987020