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?
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!