A brief introduction to NoSQL databases

content

1. Overview of NoSQL

1. Introduction to NoSQL

2. Why NoSQL

3. The advantages and characteristics of NoSQL

Second, the classification of NoSQL

key-value store database

document database

search engine database

column store database

graph database


1. Overview of NoSQL

1. Introduction to NoSQL

NoSQL is a concept that generally refers to non-relational databases. Sometimes referred to as "Not only SQL" is not just SQL, including but not limited to key-value store databases, document databases, search engine databases, column store databases, graph databases.

2. Why NoSQL

Traditional relational databases such as MySQL, SQL Server, Oracle, etc. all boil down complex data structures into simple binary relationships (that is, two-dimensional tables), which can use SQL statements to perform complex queries and support transactions . However, with the rise of Internet web 2.0 websites, traditional relational databases are dealing with web 2.0 websites, especially ultra-large-scale and highly concurrent social network type web 2.0 pure dynamic websites. The query is slow, and a single relational data model is difficult to deal with complex data types. This is where NoSQL databases are needed.

NoSQL complements SQL well. In actual development, there are many business requirements, and complete relational database functions are not required, and the functions of non-relational databases are sufficient. In this case, it is certainly a wiser choice to use a non-relational database with higher performance and lower cost . For example: log collection, leaderboards, timers , etc.

3. The advantages and characteristics of NoSQL

Easy to expand

There are many types of NoSQL databases, but a common feature is to remove the relational nature of relational databases. There is no relationship between the data, which makes it very easy to expand.

Large data volume, high performance

NoSQL databases have very high read and write performance, especially in large data volumes, and also perform well. Thanks to its non-relational nature, the structure of the database is simple.

Flexible data model

NoSQL does not need to create fields for the data to be stored in advance, and can store custom data formats at any time. In relational databases, adding and deleting fields is a very troublesome thing. If it is a table with a very large amount of data, adding fields will be very complicated and time-consuming, which is especially obvious in the era of Web 2.0 with a large amount of data.

High availability

NoSQL can easily implement a highly available architecture without affecting performance. For example, Cassandra and HBase models can also achieve high availability by replicating models.

Interpretation of NoSQL at different times

1970:NoSQL = We have no SQL

1980:NoSQL = Know SQL

2000:NoSQL = No SQL!

2005:NoSQL = Not only SQL

2013:NoSQL = No, SQL!

This shows that NoSQL is a supplement to SQL, and no matter how it is supplemented, it is inseparable from SQL.

Second, the classification of NoSQL

key-value store database

The key-value database stores data by means of Key-Value key-value. Key is used as a unique identifier. The advantage is that the search speed is fast , which is obviously better than the relational database in this regard. The disadvantage is that it cannot use conditional filtering like the relational database. (like WHERE), if you don't know where to find the data, you have to iterate over all the keys, which consumes a lot of computation.

A typical use case for a key-value database is as an in- memory cache .

Redis

Redis is an in-memory cache database based on an advanced key-value storage system, where value supports five data types:

1. Strings
2. Lists of strings
3. Sets of
strings 4. Sorted sets
5. Hashes

Redis also supports transaction and data persistence, enabling rapid additions and deletions. Application scenarios include leaderboards, spikes, and lottery draws.

document database

Document database can store and obtain documents, which can be in XML, JSON and other formats. In the database, a document is the basic unit of processing information, and a document is equivalent to a record. The documents stored in the document database are equivalent to the "values" stored in the key-value database.

MongoDB

MongoDB is a database based on distributed file storage . Written in C++ language. It aims to provide scalable high-performance data storage solutions for WEB applications. The biggest feature of Mongo is that the query language it supports is very powerful, the query speed is very fast in massive data, and it supports distributed file systems.

search engine database

Relational databases use indexes to improve retrieval efficiency, but the efficiency of full-text indexing is low. The search engine database is a form of data storage applied in the field of search engines. Since search engines crawl a large amount of data and store it in a specific format, the optimal performance can be guaranteed during retrieval. The core principle is " inverted index " .

Elasticsearch

Elasticsearch is a highly scalable distributed full-text search engine that can store and retrieve data in near real-time.

Distributed real-time file storage and indexes every field, making it searchable.

A distributed search engine for real-time analytics.

It can scale to hundreds of servers and handle petabytes of structured or unstructured data.

column store database

A columnar database is a database with row-based storage. Databases such as Oracle, MySQL, and SQL Server all use row-based storage, while a columnar database stores data in the database in columns. The advantage of this is that it can greatly reduce the The I/O of the system is suitable for distributed file systems, but the disadvantage is that the functions are relatively limited.

 HBase

HBASE is a highly reliable, high-performance, column-oriented, and scalable non - relational database . It uses the Hadoop Distributed File System (HDFS) to provide distributed data storage. A table can have billions of rows. Millions of columns. It is very good in real-time reading and writing and random access to large-scale data sets, and is mostly used for data analysis and data mining.

graph database

A graph database uses the graph data structure to store the relationships between entities (objects) . The most typical example of a graph database is the relationship between people in a social network. The data model is mainly implemented with nodes and edges (relationships), which are characterized by the ability to efficiently solve complex relationship problems. For example, the relationship between characters in a social network is very complicated if a relational database is used, but it is very simple with a graph database.

Neo4J

Neo4j is a robust and scalable high-performance graph database written in Java. It can efficiently solve complex data relationships. For example, friend recommendation, product recommendation, etc. use the intelligent recommendation engine based on Neo4j.

Guess you like

Origin blog.csdn.net/qq_52595134/article/details/122045628