Relational database

The current mainstream relational databases are Oracle,DB2,PostgreSQL,Microsoft SQL Server,Microsoft Access,MySQL

relational database , Is a database based on a relational model , Data processing in database by means of mathematical concepts and methods such as set algebra .
Relationship model consists of relationship data structure , Relational operation set , Three parts of relationship integrity constraint .
Relational databases store data on hard disks

notes : Database transactions must have ACID characteristic ,ACID yes Atomic Atomicity ,Consistency uniformity ,Isolation Isolation ,Durability persistence .

Common concepts in relation model :

* relationship : It can be understood as a two-dimensional table , Each relationship has a relationship name , It's usually called table name
* tuple : It can be understood as a row in a two-dimensional table , Often referred to as records in a database
* attribute : It can be understood as a column in a two-dimensional table , Often referred to as fields in a database
* field : Property value range , That is, the value limit of a column in the database
* keyword : A set of attributes that uniquely identify a tuple , Database is often called primary key , Consists of one or more columns
* Relationship model : A description of a relationship . Its format is : Relationship name ( attribute 1, attribute 2, … … , attribute N), Become a table structure in the database
characteristic :
1. Relational database , A database that uses a relational model to organize data
2. The biggest characteristic of relational database is the consistency of transactions ;
3. In a nutshell , A relational model is a two-dimensional table model , A relational database is a data organization composed of two-dimensional tables and their relationships .

advantage :
1. Easy to understand : Two dimensional table structure is very close to the concept of logical world , Relative mesh of relation model , Layers and other models are easier to understand ;
2. Easy to use : General SQL Language makes it very convenient to operate relational database ;
3. Easy to maintain : Rich integrity ( Entity integrity , Referential integrity and user-defined integrity ) Greatly reduces the probability of data redundancy and data inconsistency ;
4. support SQL, Can be used for complex queries

shortcoming :
1. High concurrent read and write requirements
The user concurrency of the website is very high , It often reaches tens of thousands of read and write requests per second , For traditional relational databases , Hard disk I/O It's a big bottleneck
2. Efficient reading and writing of massive data
The amount of data generated by the website every day is huge , For relational databases , Query in a table with massive data , Efficiency is very low
3. High scalability and availability
Based on web In the structure of , Databases are the most difficult to scale horizontally , When the number of users and visits of an application system increases with each passing day , There's no way a database can look like this web server and app
server It's that simple to expand performance and load capacity by adding more hardware and service nodes . For many needs 24 For the web site with continuous service , Upgrading and expanding the database system is very painful , Downtime maintenance and data migration are often required .

Non relational database

* No predefined mode required : No need to define data schema in advance , Predefined table structure . Each record in the data may have different properties and formats . When inserting data , There's no need to predefine their patterns .
* No shared schema
: Compared with the fully shared architecture in the storage area network where all data are stored .NoSQL Data is often divided and stored on local servers . Because the performance of reading data from local disk is often better than that of reading data through network transmission , Thus, the performance of the system is improved .
* Elastic and scalable : When the system is running , Add or delete nodes dynamically . No downtime maintenance required , Data can be migrated automatically .
* partition
: Relative to storing data in the same node ,NoSQL Database needs to be partitioned , Spread records across multiple nodes . And it's usually replicated as well as partitioned . This improves parallel performance , It can ensure that there is no single point failure .
* Asynchronous replication
: and RAID The storage system is different ,NoSQL Replication in , Often asynchronous log based replication . such , Data can be written to a node as soon as possible , Without delay caused by network transmission . The disadvantage is that consistency is not always guaranteed , This way, in case of failure , A small amount of data may be lost .
* BASE: Strict relative to transaction ACID characteristic ,NoSQL The database guarantees BASE characteristic .BASE Is final consistency and soft transactions .
characteristic :
1. Using key value pairs to store data , Data is not coupled , Easy to expand
2. Distributed
3. Generally not supported ACID characteristic , No need to go through sql Layer analysis , High reading and writing performance
4. Non relational database is not a kind of database strictly , It should be a collection of data structured storage methods
5. Format of stored data :nosql The storage format of is key,value form , Document form , Picture form and so on , Document form , Picture form and so on , Relational databases only support basic types

advantage :
1. High performance concurrent read / write oriented key-value database :key-value The main characteristics of database even with high concurrent read-write performance ,Redis,Tokyo
Cabinet,Flare It's a representative of this kind
2. Document oriented database for massive data access : This kind of database is characterized by , Can quickly query data in massive data , Typical representative is MongoDB as well as CouchDB
3. Extensibility oriented distributed database : The problem that this kind of database wants to solve is that the traditional database has the defect of scalability , This kind of database can adapt to the increase of data volume and the change of data structure

notes :
The basic principles of total relationship system :
1. A relational database management system must be able to manage the database completely through its relational ability .
2. Information criteria All information of RDBMS should be represented explicitly by values in tables at the logical level .
3. Guaranteed access guidelines Depend on table name , Combination of main code and column name , Ensure logical access to each data item in the relational database .
4. Systematization of null value The concept of null value supported by relational database management system , And deal with null values in a systematic way .
5. Dynamic online data dictionary based on relation model The description of database is the same as that of common data at logical level .
6. Unified data sublanguage
A relational database management system can have several languages and multiple terminal access modes , But there must be a language , Its statement can be expressed as a strictly syntactic string , And can fully support various rules .
7. View update guidelines All theoretically updatable views should also be allowed to be updated by the system .
8. Advanced insertion , Modify and delete operations The system should optimize the query of various operations .
9. Physical independence of data No matter the data of database changes in storage representation or access method , Application and terminal activities are logically invariant .
10. Data logical independence When there is any change in the fundamental relationship that theoretically does not harm the information , Application and terminal activities are logically invariant .
11. Independence of data integrity The integrity constraints of relational database must be defined in database language and stored in data dictionary .
12. Distribution independence The logic of RDBMS remains unchanged when distributed data is introduced or redistributed .
13. Nondestructive criterion If a relational database management system has a low-level language , Then this low-level language cannot violate or bypass the integrity criterion .

reference resources :
1. Relational database
<https://baike.baidu.com/item/%E5%85%B3%E7%B3%BB%E5%9E%8B%E6%95%B0%E6%8D%AE%E5%BA%93/8999831?fr=aladdin>
2. NoSQL <https://baike.baidu.com/item/NoSQL/8828247?fr=aladdin>
3. The difference between relational database and non relational database <https://www.cnblogs.com/alilcu/p/8068259.html>
4. The difference between relational database and non relational database ,oracle And mysql The difference between
<http://blog.csdn.net/ochangwen/article/details/53423301>