mysql clustered index, non-clustered index, covering index difference.

After screening the original station information posted over, for their own notes. Original station: https: //www.cnblogs.com/aspwebchh/p/6652855.html

-------------------------------- mysql Implementation Plan Keyword: explain ----------- -----------------------------

Clustered index:

On the primary key to the table, then the table is stored on disk structure is transformed by the alignment of the structure became a tree, that is "balanced tree" structure, in other words, the entire table becomes an index. Yes, again, the whole table turned into an index, the so-called "clustered index." This is why a table can have only one primary key, a table can have only a "clustered index", because the role of the primary key is to convert the "table" of the data format to "index (balanced tree)" format placement.

Non-clustered index:

Non-clustered index and a clustered index, same as a balanced tree data structure as an index. Value of the index tree structure each node from the table index field, if the user name field to the table, plus index, the index value is composed of a name field, when the data changes, the DBMS has been required to maintain the index structure correctness. If we add the index to the table in a plurality of fields, a plurality of separate index structure will then occur, each index (non-clustered index) no correlation between each other.

The difference is that the data required can be found by looking clustered index, the non-clustered index can be found by the primary key value corresponding to the recording , and then using the primary key value to find the desired data by aggregating index.

Covering indexes:

If an index contains the value of all fields to be queried, we call it "covering index." So where to find real data lines without going through a primary key ID value, direct access to the value of the leaf node name return to.

Personal understanding:

Commonly used non-clustered index is an index, the index root node of the tree is the primary key of the table.

Clustered index is the number of primary key component, the root is the real location of the database data.

--------------------------------------------------------------------------

mysql opened the ICP, you can reduce the number of accesses base table storage engine

Let's brief introduction about the difference between these three

using index: the index covers the use of time there will be

using where: in the case of using the index to find, need to return to the table to query the data needed

using index condition: use the index to find, but need to return to the table query data

using index & using where: Finding use the index, but the data are required can be found in the index column, there is no need to query the data back to the table

More than four points before they will be able to tell the difference, perhaps there are some people doubt using index & using where and using index condition that is better, can be seen from the above explanation of the former is better, after all, is not required back to the table query data on efficiency should be relatively fast

Guess you like

Origin www.cnblogs.com/workharder/p/11022267.html