nosql features: 1. Flexible scalability; nosql removes the relational characteristics of relational databases, there is no relationship between data, and it can be easily expanded. 2. Flexible data model; NoSQL uses non-relational models such as key/value and column family, allowing different types of data to be stored in one data element. 3. NoSQL can rely on its good horizontal expansion capabilities to make full use of cloud computing infrastructure and integrate well into the cloud computing environment. 4. Nosql has very high reading and writing performance, especially when dealing with large amounts of data. 5. High availability.
The operating environment of this tutorial: Windows 7 system, Dell G3 computer.
NoSQL is a database management system design method that is different from relational databases. The general term for relational database. The data model it uses is not the relational model of traditional relational databases, but non-relational models such as key/value, column family, document, etc. NoSQL databases do not have a fixed table structure, there are usually no join operations, and they do not strictly adhere to ACID constraints. Therefore, compared with relational databases, NoSQL has flexible horizontal scalability and can support massive data storage.
What is ACID?
(1) Flexible scalability
Traditional relational databases are usually difficult to achieve "horizontal expansion" due to their own design mechanisms. When facing a large-scale increase in database load, , it is often necessary to upgrade hardware to achieve "vertical expansion." NoSQLThe database was originally designed to meet the needs of "horizontal expansion", so it is inherently equipped with good horizontal expansion capabilities.
(2)Flexible data model
Relational databases have standardized definitions and comply with various strict constraints. Although this approach ensures the data consistency requirements of the business system, the overly rigid data model also means that it cannot meet various emerging business needs. In contrast, NoSQL databases use non-relational models such as keys, /values, column families, etc., allowing different types of data to be stored in one data element. data.
(3)Tightly integrated with cloud computing
Cloud computing has good horizontal expansion capabilities and can be freely scaled according to resource usage. Various resources can be dynamically added or withdrawn. NoSQL databases can rely on their own good horizontal expansion. Ability to make full and free use of cloud computing infrastructure, integrate well into the cloud computing environment, and build cloud database services based on NoSQL.
(4) Large data volume, high performance
nosql database has very high read and write performance, especially under large data volume, It also performs very well, mainly due to its non-relationship and simple database structure.
Usually nosql uses Query Cache.
nosql's Cache is record-level, a fine-grained Cache, so from this aspect, the performance of nosql is much higher.
(5) High availability
High availability is also an obvious feature of nosql. Nosql can be implemented very conveniently without affecting performance. Highly available architecture, typical examples include Cassandra and HBase models. High availability can also be achieved through models.
1、 Relational databases can no longer satisfy The requirements of Web2.0. Mainly manifested in the following aspects:
(1) cannot meet the management needs of massive data
For the above websites, it will soon be possible Generating more than 10# billion records, for a relational database, in a table with 10SQLQuery is extremely inefficient.
(2)cannot satisfy Requirements for high data concurrency
(3) cannot meet the requirements of high scalability and high availability
2, The key to relational database Features have become "tasteless" in the era of Web 2.0
The key features of relational databases include complete transaction mechanisms and efficient query mechanisms. However, the two key features that relational databases are proud of have become useless in the Web2.0 era, mainly in the following aspects:
(1) Web 2.0 website systems usually do not require strict database transactions
For many Web 2.0 websites, database transactions are no longer So important. Database transactions usually have a complex implementation mechanism to ensure database consistency, which requires a lot of system overhead. For Web 2.0 websites that contain a large number of frequent real-time read and write requests, the cost of implementing transactions is unbearable.
(2)Web 2.0 does not require strict real-time performance of reading and writing
For relational databases, once a data record is successfully inserted into the database, it can be queried immediately.
For Web 2.0, there is no such real-time reading and writing requirements.
(3) Web 2.0 usually does not contain a large number of complex SQL queries
Complex SQL queries usually contain multiple Table join operations. However, Web 2.0 websites have been designed to minimize or even avoid such operations, and usually only use primary key queries of a single table. Therefore, the query optimization mechanism of relational databases is difficult to make a difference in Web 2.0.
RDBMS: relational database
##Comparison of NoSQL and relational databases Summary:
(1) Relational Database
Advantages: Based on the complete relational algebra theory, there are strict standards, supporting the four properties of transaction ACID, with the help of the index mechanism Can achieve efficient query, mature technology, technical support from professional companies
Disadvantages: Poor scalability, unable to support massive data storage, data model too rigid, unable to support Web2.0 applications, transaction mechanism affects the overall system Performance etc
(2) NoSQLDatabase
##Advantages: Yes Supports ultra-large-scale data storage, the flexible data model can well support Web2.0 applications, and has strong horizontal expansion capabilities, etc.
Disadvantages: Lack of mathematical theoretical foundation, low performance of complex queries, mostly unable to achieve strong transaction consistency, difficult to achieve data integrity, technology is not yet mature, lack of professional team Technical support, difficult maintenance, etc.
(3) Relational databases and NoSQL databases each have their own advantages and disadvantages and cannot replace each other.
Relational database application scenarios: Key business systems in telecommunications, banking and other fields need to ensure strong transaction consistency
NoSQLDatabase application scenarios: Non-critical businesses of Internet companies and traditional companies (such as data analysis)
Adopt hybrid architecture NoSQLAlthough there are many databases, in summary, the typical NoSQLDatabases usually include key-value database, column family database, document database and graph database 1. Key-value database Key-value database (Key-Value Database) has a specific Key and a pointer pointing to a specific Value in the table. Key can be used to locate Value, that is, to store and retrieve specific Value. Value is transparent and invisible to the database. Value cannot be indexed or queried, and can only be queried through Key. Value can be used to store any type of data, including integers, characters, arrays, objects, etc. Application scenario:A session-oriented application (such as Web application) starts when the user logs in session and remains active until the user logs off or the session times out. During this time, the application stores all session-related data in main memory or in a database. Session data may include user profile information, messages, personalization data and themes, suggestions, targeted promotions and discounts. Each user session has a unique identifier. Session data cannot be queried on any key other than the primary key, so a fast key-value store is better suited for session data. In general, key-value databases may offer less overhead per page than relational databases. ##2. Column family database ##3. Document database The so-called CAP refers to: Theory tells us that it is impossible for a distributed system to meet the three requirements of consistency, availability and partition tolerance at the same time. Satisfying two of them at the same time is as the saying goes, "You can't have your cake and eat it too." CAP, there are a few obvious choices: CA: that is, emphasizing consistency (C) and availability (A), give up partition tolerance (P), the simplest way is to put all transaction-related content on the same machine superior. Obviously, this approach will seriously affect the scalability of the system. Traditional relational databases (MySQL, SQL Server and PostgreSQL), all This design principle is adopted, so the scalability is relatively poor CP: that is, the emphasis is on consistency sex (C) and partition tolerance (P), give up availability (A ), when a network partition occurs, the affected services need to wait for the data to be consistent, so they cannot provide external services during the waiting period AP : That is, emphasizing availability (A) and partition tolerance (P), giving up consistency (C), allowing the system to return inconsistent data ##BASE BASE (B asically Availble, Soft-state, Eventual consistency)
(Atomicity) Basically A##vailable) Consistency)Soft state Flexible transaction(Soft state) isolation(Isolation) Eventual consistency(Eventual consistency) Persistence(Durable) BASE is Basically available (Basically Availble), soft state (S oft-state) and eventual consistency (Eventual consistency) : Basically available means that when a part of a distributed system has a problem and becomes unavailable, other parts can still be used Normal use, that is, allowing partition failure to occur soft-state)" is a formulation corresponding to "hard state (hard-state)". When the data stored in the database is in "hard state", data consistency can be guaranteed, that is, the data is always correct. "Soft state" means that the state can be out of sync for a period of time, with a certain lag The types of consistency include strong consistency and weak consistency. The main difference between the two is whether subsequent operations can obtain the latest data under highly concurrent data access operations. For strong consistency, after an update operation is performed, other subsequent read operations can guarantee that the latest data after the update is read; conversely, if it cannot be guaranteed that subsequent accesses read the latest data after the update, then It's weak consistency. Final consistency is just a special case of weak consistency, which allows subsequent access operations to temporarily fail to read the updated data, but after a period of time, the updated data must eventually be read . For more programming-related knowledge, please visit: Programming Teaching! !
NoSQL The four major types of
The three cornerstones of NoSQL
CAP
## The basic meaning of
##ACID
BASE
##atomicity
( Consistency(
/
The above is the detailed content of What are the characteristics of nosql database. For more information, please follow other related articles on the PHP Chinese website!