Vipul Vyas
1 min readJul 13, 2024

--

Hey Vikhyat, MySQL may not use an index in certain situations, even when indexes are defined on the columns being queried. Here are some common scenarios where MySQL might choose not to use an index(Based on my research):

1. Too Many Similar Values: If there are many duplicate values in the indexed column, using the index might not be helpful.

2. Functions in Conditions: If the query uses functions (like UPPER() or LOWER()) on the indexed column, MySQL can't use the index.

3. Too Many Rows to Check: If using the index would still require looking at most of the rows in the table, MySQL might skip it.

4. Patterns with Wildcards: If the query searches with a pattern that starts with a wildcard (like %something), MySQL can't use the index.

5. Complex Joins: If the query involves complicated join conditions, MySQL might not be able to use the indexes efficiently.

6. Large Result Sets: If the query is expected to return a large portion of the table, using the index might be slower than just scanning the whole table.

--

--

No responses yet