Home >Database >Mysql Tutorial >What is a clustered index in mysql

What is a clustered index in mysql

王林
王林Original
2020-06-28 10:35:304694browse

Clustered index is an algorithm that reorganizes the actual data on disk to sort by the value of one or more specified columns. The characteristics of a clustered index are: the order of storing data is consistent with the order of the index, the primary key will create a clustered index by default, and only one clustered index is allowed to exist in a table.

What is a clustered index in mysql

Clustered index

(Recommended tutorial: mysql tutorial)

Clustered index is an algorithm that reorganizes the actual data on disk to sort by the value of one or more specified columns.

Features:

The order of stored data is consistent with the index order.

Generally, the primary key will create a clustered index by default, and only one clustered index is allowed to exist in a table (reason: once the data is stored, there can only be one order).

The difference between clustered index and non-clustered index is explained in the book "Database Principles":

The leaf nodes of the clustered index are the data nodes. , the leaf nodes of the non-clustered index are still index nodes, but have pointers to the corresponding data blocks.

Advantages and disadvantages of clustered index:

Advantage: When there are relatively few query entries according to the primary key, there is no need to go back (the data is under the primary key node).

Disadvantages: If irregular data is inserted, frequent page splits will occur.

The above is the detailed content of What is a clustered index in mysql. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Related articles

See more