mysql and storage engine knowledge points

mysql and storage engine knowledge points

basic concept:

    1. Index: A data structure established for fast search (external memory). When the data is very large, because it may be very large, it generally exists in external memory.

    2. Storage engine: It can be considered as the back end of mysql, the front end is SQL parsing and processing; the middle end is SQL optimization, etc.

    3. Why is b+ tree better than red-black tree? The b+ tree depth is small, the number of levels of the index table is small, and the number of disk IOs required is less (reading a large amount at one time is much faster than reading a small amount multiple times)

    4. ACID characteristics of things: atomicity (either fully executed or not executed), consistency (consistent addition and subtraction), isolation (concurrency), persistence (really survive)

 

First, the sql processing process:

    Parse, lock, check permissions, generate and execute optimal query plans (optimization), and call storage engines to perform operations

 

Second, the core module of mysql:

      Query and optimization systems, storage systems, security management

 

Three, myisam features:

     1. It does not support the security of things, and the speed is fast. 3 files, .MYI (index) .MYD (data) .fm (table definition)

    2. Static table, each row has the same length and fast speed; dynamic table: try not to exceed the length, otherwise fragmentation (discontinuous storage) will occur. Compressed table: read-only.

    3. Index R-tree or B-tree algorithm; the content of the index is the index value index pointer

Fourth, InnoDB:

    1. Support transaction, row-level lock; double write, insert cache (not disk io every time), adaptive hash index

    2. The index implementation of innodb: the data file itself is indexed according to the main key, and other indexes are first indexed to the main key, and then the main index is used to check. Therefore, when using innodb, the main key should be unique (such as self-increment), otherwise it will be more cost-effective to maintain the b+ tree

 

Five, the realization of things

    It is generally implemented using a log system. That is, the log is operated first, and then the data is operated; the lock is obtained first, and then the data is operated.

 

6. Content cached in the memory pool:

    Index page, data page, undo page, insert buffer, adaptive hash index, lock info, data dictionary

 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326840407&siteId=291194637