Home>Article>Database> What are mysql indexes?

What are mysql indexes?

藏色散人
藏色散人 Original
2019-05-09 13:36:22 36109browse

Mysql indexes include: 1. Primary key index. The primary key index is a special unique index that does not allow null values; 2. Ordinary index or single column index; 3. Multi-column index; 4. Unique index or Non-unique index; 5. Spatial index.

What are mysql indexes?

What are mysql indexes?

1. Primary key index: The primary key index is a special unique index. NULL values are not allowed

2. Ordinary index or single-column index

3. Multi-column index (composite index): Composite index refers to an index created on multiple fields, which can only be used in query conditions The index will only be used if the first field used when creating the index is used. When using a composite index, follow the leftmost prefix set

4. Unique index or non-unique index

5. Spatial index: A spatial index is an index established on fields of spatial data types. In MYSQL There are 4 spatial data types, namely GEOMETRY, POINT, LINESTRING, and POLYGON. MYSQL has been extended with the SPATIAL keyword, enabling the creation of spatial indexes using the syntax used to create regular index types. Columns used to create spatial indexes must be declared NOT NULL. Spatial indexes can only be created in tables whose storage engine is MYISAM

The above is the detailed content of What are mysql indexes?. 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