I have a table from an old system that does not have a primary key. It records transactional data for the release of materials in the factory.
For simplicity, let's say each row contains job_number, part_number, quantity and date_issued.
I added an index to the date column. When I run EXPLAIN SELECT * FROM issu_parts WHERE date_issued> '20100101', it shows this:
+ ---- + ------------- + ---------------- + ------ + ------ ------------- + ------ + --------- + ------ + --------- + - ----------- +
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+ ---- + ------------- + ---------------- + ------ + ------ ------------- + ------ + --------- + ------ + --------- + - ----------- +
| 1 | SIMPLE | issued_parts | ALL | date_issued_alloc | NULL | NULL | NULL | 9724620 | Using where |
+ ---- + ------------- + ---------------- + ------ + ------ ------------- + ------ + --------- + ------ + --------- + - ----------- +
So, he sees the key, but he does not use it? Can someone explain why?
mysql select indexing explain
Paul wieland
source share