What is nosql
1. Introduction to nosql
NoSQL refers to a non-relational database. NoSQL is sometimes called the abbreviation ofNot Only SQL, which is a general term for database management systems that are different from traditional relational databases. NoSQL is used for the storage of very large-scale data. These types of data stores do not require a fixed schema and can scale out without redundant operations.
2. The difference between Nosql and relational database
1. Storage method
Relationship A database is tabular, so it is stored in rows and columns of tables. They are easily linked to collaborative storage, often stored in data sets, such as documents, key-value pairs, or graph structures.
2. Storage structure
Relational database corresponds to structured data. Data tables have pre-defined structures (column definitions), and the structure describes the data. form and content. This is crucial for data modeling. Although predefined structures bring reliability and stability, modifying this data is difficult. The Nosql database is based on dynamic structure and uses unstructured data. Because Nosql database is a dynamic structure, it can easily adapt to changes in data type and structure.
3. Storage specifications
For higher standardization of data storage in relational databases, the data is divided into the smallest relational tables to avoid duplication and obtain streamlined Use the space. Although the management is very clear, when a single operation is designed to multiple tables, data management becomes a bit troublesome. Nosql data is stored in flat data sets, and data may often be repeated. Individual databases are rarely separated, but are stored as a whole, making the entire piece of data easier to read and write.
4. Storage expansion
This may be the biggest difference between the two. Relational databases scale vertically, which means that if you want to improve processing capabilities, you need to Use a faster computer. Because the data is stored in relational tables, the performance bottleneck of the operation may involve multiple tables and needs to be overcome by improving computer performance. Although there is a lot of room for expansion, the upper limit of vertical expansion will eventually be reached. The Nosql database is horizontally scalable, and its storage is naturally distributed. The load can be shared by adding more ordinary database servers to the resource pool.
5. Query method
Relational database operates the database through structured query language (which is what we usually call SQL). SQL supports database CURD operations, which are very powerful and are standard usage in the industry. Nosql queries operate data in blocks and use unstructured query language (UnQl), which has no standard. The concept of primary key in a relational database table corresponds to the ID of a document stored in Nosql. Relational databases use predefined optimization methods (such as indexes) to speed up query operations, while Nosql has a simpler and more precise data access mode.
6. Transactions
Relational database follows ACID rules (Atomicity, Consistency, Basically Available, Soft/ Soft-state, eventual consistency (Eventual Consistency)). Due to the strong data consistency of the relational database, it supports transactions very well. The relational database supports fine-grained control of transaction atomicity and is easy to recover. Roll transactions. The Nosql database chooses two of the CAP (Consistency, Availability, Partition Tolerance). Because it is difficult to satisfy all of them in a node-based distributed system, the support for transactions is not very good, although it is also Transactions can be used, but they are not the shining point of Nosql.
7. Performance
Relational databases pay a huge price to maintain data consistency, read and write The performance is relatively poor.
The format of Nosql storage is key-value type, and is stored in memory, which is very easy to store,
and has weak requirements for data consistency. Nosql No SQL parsing is required, which improves reading and writing performance.
8. Authorization method
Relational databases usually include SQL Server, Mysql, and Oracle. Mainstream Nosql databases include redis, the cost is relatively high, and Nosql databases are usually open source.
3. Why use NoSQL?
Today we can use third-party platforms (such as: Google , Facebook, etc.) can easily access and crawl data. Users’ personal information, social networks, geographical locations, user-generated data and user operation logs have increased exponentially. If we want to mine these user data, then SQL databases are no longer suitable for these applications, but the development of NoSQL databases can handle these large data very well.
The above is the detailed content of what is nosql. For more information, please follow other related articles on the PHP Chinese website!