MySQL supports various indexes on its tables for the faster access of records. Before we define indexes on the tables, it is important to know when we need to index data, and it's also equally important to select the proper field to create indexes.
The following list shows when to use indexing:
- When grouping based on a specific column is required
- When sorting on a specific column is required
- When you need to find the minimum and maximum values from the table
- When we have a large dataset and need to find a few records based on certain conditions frequently
- When you need to fire a query that has a join between two or more tables