Advantages, disadvantages and concepts of Java redis Series 1 relational database and non relational database


Advantages, disadvantages and concepts of Java redis Series 1 relational database and non relational database

Before learning redis, let’s first learn two concepts: what is a relational database and what is a non relational database, what is the difference between the two, and what is the relationship between the two?


Relational database


Relational database refers to the database that uses the relational model to organize data. It stores data in the form of rows and columns to facilitate users’ understanding. A series of rows and columns of relational database are called tables, and a group of tables constitute the database. The user searches the data in the database through the query, and the query is an executive code used to limit some areas in the database. Relational model can be simply understood as two-dimensional table model, and a relational database is a data organization composed of two-dimensional tables and their relationships.

Relational database is based on the relational model to create the database.
The so-called relational model is “one to one, one to many, many to many” and other relational models. The relational model refers to the two-dimensional table model. Therefore, a relational database is a data organization composed of two-dimensional tables and their relationships.
Relational data can well store data of some relational models, such as one teacher corresponding to multiple students (“many to many”), one book corresponding to multiple authors (“one to many”), and one book corresponding to one publication date (“one to one”)
Relational model is a model that we can often meet in our life. Relational database is generally used to store this kind of data
The relational model includes data structure (data storage problem, two-dimensional table), operation instruction set (SQL statement), and integrity constraints (data constraints within tables, constraints between tables).



Non relational database

Non relational database, also known as NoSQL (not only SQL), means more than SQL (Structured Query Language). According to Wikipedia, NoSQL first appeared in 1998. It is a lightweight, open source, relational database that does not contain SQL function, which was first developed by Carlo storzzi, 2009 The concept of NoSQL was put forward again in a seminar on distributed open source database. At this time, NoSQL mainly refers to the non relational, distributed database design pattern that does not provide acid (four basic elements of database transaction processing). In the same year, at the “NoSQL (East)” seminar held in Atlanta, the most common definition of NoSQL was “non associative”, emphasizing the advantages of key value storage and document database, rather than simply opposing RDBMS. So far, NoSQL began to appear in front of the world. There are more choices of storage methods: key value pair storage, column storage, document storage, graphic database, etc., no declarative query language, no predefined mode, unstructured and unpredictable data, high performance, high availability and scalability.

Usage scenarios and advantages and disadvantages of relational database and non relational database

Relational database
1. Safety and preciseness
Transaction support enables the data access requirements with high security performance to be realized. : link:
And the data stored on the hard disk is not easy to lose
2. Easy to use
SQL language is universal and the cost of learning is low
3. Easy to maintain:
They all use table structure and have the same format
4. Complex query:
: can be used for very complex queries between multiple tables
1. The performance of reading and writing is relatively poor, especially for massive data reading and writing, it is necessary to continuously carry out IO operation
2. Fixed table structure, less flexibility
3. High concurrent read-write requirements, traditional relational database, hard disk I / O is a big bottleneck

Non relational database
1. Flexible format
The format of stored data can be in the form of key, value, document, picture and so on. Document, picture and so on are flexible to use and have wide application scenarios, while relational database only supports basic types.
2. High expansibility
Data is based on key value pairs, and there is no coupling between data, so it is very easy to expand horizontally
3. High performance
NoSQL is based on key value pairs, which can be imagined as the relationship between the primary key and the value in the table, and does not need to be parsed by the SQL layer, so the performance is very high
4. Low cost
Noslq is easy to deploy and is basically open source
1. No standardization, no slq support, high learning cost
2. No transaction processing
3. The data structure is relatively complex, and the complex query is not enough, that is, the limited query function

The relationship between relational database and NoSQL database is not opposite but complementary. That is to say, we usually use relational database, and use NoSQL database when it is suitable to use NoSQL, so that NoSQL database can make up for the deficiency of relational database. Generally, the data will be stored in relational database, and the data of relational database will be backed up and stored in NoSQL database

Mainstream noslq products:

Key value storage database
				Related products: Tokyo cabinet / tyrant, redis, Voldemort, Berkeley DB
				Typical application: content caching, which is mainly used to handle the high access load of a large amount of data. 
				Data model: a series of key value pairs
				Advantage: quick query
				Disadvantage: the stored data lacks structure
		· column storage database
				Related products: Cassandra, HBase, riak
				Typical application: distributed file system
				Data model: store the same column of data in a column cluster
				Advantages: fast search speed, strong scalability and easier distributed expansion
				Disadvantages: the function is relatively limited
		Document database
				Related products: CouchDB, mongodb
				Typical application: Web application (similar to key value, value is structured)
				Data model: a series of key value pairs
				Advantage: the data structure is not strict
				Disadvantages: poor query performance and lack of unified query syntax
		· graph database
				Related databases: neo4j, infogrid, infinite graph
				Typical application: Social Network
				Data model: graph structure
				Advantage: using graph structure correlation algorithm.
				Disadvantage: it needs to calculate the whole graph to get the result, and it is not easy to do the distributed cluster scheme.

The above are the advantages and disadvantages of relational databases and non relational databases. This is also the first of my JAVA redis series. I will continue to update it later, and it will not be easy to write. Please support the old fellow, and feel that you can help me.

Recommended Today

Pandas data analysis — detailed explanation of super easy to use groupby

WeChat official account: “Python reads money”If there are any questions or suggestions, please official account message. In the daily data analysis, it is often necessary to analyze the dataDivide into different groups according to one (more) fieldFor example, in the field of e-commerce, the total sales of the whole country are divided by provinces, and […]