mysql index types and classification

First, the indexing method
Mysql present, there are several index types: FULLTEXT, HASH, BTREE, RTREE .

1. FULLTEXT
is the full-text index, only MyISAM engine support. It can be CREATE TABLE, ALTER TABLE, CREATE INDEX use, but can now create full-text index is only CHAR, VARCHAR, TEXT columns.

MyISAM and full-text indexing is not born together, it appears to solve the "% word%" low efficiency of this type of fuzzy search for the text of the problem WHERE name LIKE.

HASH 2.
As the sole (the sole of almost 100%) and the like HASH key-value pairs, it is suitable as an index.

HASH index can locate one, do not need to look like a tree indexes as layer by layer, and therefore has a very high efficiency. However, this efficiency is conditional, that is, only the "=" and "in" under conditions effective for the scope of inquiry, ordering and combination index is still inefficient.

BTREE 3.
BTREE index is a kind of index value by a certain algorithm, into a tree data structure (binary tree), each query begins at the entrance root of the tree, in order to traverse node, obtain leaf. This is the MySQL in the default and most common type of index.

RTREE 4.
RTREE rarely used in MySQL, supports only geometry data type, the type of storage engine supports only MyISAM, BDb, InnoDb, NDb, Archive few.

Relative to BTREE, RTREE strength lies in the range Find

 

Second, the index type
plain index: only speed up queries

The only index: + speed up query column value unique (there may be null)

Primary key index: a unique value to speed up queries + column (not have null) only one table +

Composite index: a multi-column index value of the composition, specifically for combinatorial search, the efficiency is greater than the combined index

Full-text indexing: the content of the text word segmentation, search

ps. The combined index, a plurality of combinations of a separate index search

Covering index, select the columns of data can be acquired only from the index, without reading the data line, in other words a query column to be built index covering

Guess you like

Origin www.cnblogs.com/tkzc2013/p/11453459.html