Relational database

The current mainstream relational databases areOracle,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 haveACID Characteristic,ACID yesAtomic 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
* Relational mode: A description of a relationship. Its format is: Relation name( attribute1, attribute2, … … , attributeN), 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. Simply speaking, 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 purposeSQL Language makes it very convenient to operate relational database;
3. Easy maintenance: Rich integrity( Entity integrity, Referential integrity and user-defined integrity) Greatly reduces the probability of data redundancy and data inconsistency;
4. SupportSQL, 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 diskI/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
On the basis ofweb 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 thisweb server andapp
server It's that simple to expand performance and load capacity by adding more hardware and service nodes. For many needs24 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
: andRAID The storage system is different,NoSQL Copy 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 transactionACID Characteristic,NoSQL The database guaranteesBASE 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 supportedACID Characteristic, No need to go throughsql Analysis of layers, 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 iskey,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 orientedkey-value data base: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 isMongoDB as well asCouchDB
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 criterion All information of RDBMS should be represented explicitly by values in tables at the logical level.
3. Guaranteed access guidelines Table name dependent, 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. Difference between relational database and non relational database,oracle Andmysql Difference
<http://blog.csdn.net/ochangwen/article/details/53423301>