MySQL 8 index types
In the previous topics, you learned different index structures and how to create indexes on a table. Now let's see different indexes in detail that are available in MySQL and their importance.
When you create a table in MySQL, there are five types of index options available:
- PRIMARY
- UNIQUE
- COLUMN
- FULLTEXT
- SPATIAL
You can choose any of these indexes on your table based on your database design; the frequency of data and columns used in the query would accordingly help you define where indexes need to be applied.
Defining a primary index
The primary key is used to identify each row uniquely. The column on which the primary key is defined is unique in nature and contains not null values. In the following section, you will learn how to use the primary key and the difference between a surrogate key and natural key.
Primary indexes
Every InnoDB table contains one special index to identify each row uniquely. This column is also referred to as a clustered index. A clustered index is synonymous...