CREATE INDEX index_name ON table_name(column_name);
CREATE INDEX curd_user_email_index ON user_crud(email);
## Adding an Index to Existing Table
CREATE INDEX indexName ON tableName (ID, LName, FName, LOC);
## Adding an Index to Existing Table with Primary Key
CREATE UNIQUE INDEX indexName ON tableName (ID, LName, FName, LOC);
Ex. Explain select * from user where name = ‘kinjal’ #here explain is used for finding that how much time it takes to find name, how much rows in search.
It enables you to improve the faster retrieval of records on a database table.
Indexes are used to find rows with specific column values quickly. Without an index, MySQL must begin with the first row and then read through the entire table to find the relevant rows. The larger the table, the more this costs.