MySQL indexing
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
Index structures
There are different structures used by various indexing methods to store the index information in the database:
- Bitmap indexes
- Sparse indexes
- Dense indexes
- B-Tree indexes
- Hash indexes
Let's quickly go through each of these indexes.
Bitmap indexes
As the name suggests, a Bitmap index stores column information as a bit. Bitmap indexing is used when there...