Consider the query:
Mysql> SET @run = 15;
Mysql> EXPLAIN SELECT objective, stage, COUNT (stage)
→WHERE [email protected]
→GROUP BY objective,stage
→ORDER BY stage;
The iteminformation table has the following indexes;
Mysql> SHOW INDEXES FROM iteminformation:
This query is run several times in an application with different values in the WHERE clause in a growing data set.
What is the primary improvement that can be made for this scenario?
- A: Execute the run_2 index because it has caused a conflict in the choice of key for this query.
- B: Drop the run_2 index because it has caused a conflict in the choice of key for this query.
- C: Do not pass a user variable in the WHERE clause because it limits the ability of the optimizer to use indexes.
- D: Add an index on the objective column so that is can be used in both the WHERE and GROUP BY operations.
- E: Add a composite index on (run,objective,stage) to allow the query to fully utilize an index.