When only cluster key and idx_price exist as indexes..
Query: select id , name from product where price < 20000
Explane:
| detail | value |
|---|---|
| id | 1 |
| select_type | SIMPLE |
| table | product |
| partitions | NULL |
| type | range |
| possible_keys | idx_price |
| key | idx_price |
| key_len | 9 |
| ref | NULL |
| rows | 7 |
| filtered | 100.00 |
| Extra | Using index condition |
| 1 row in set 1 warning (0.00 sec) |
As far as I know, the Using index condition occurs depending on the presence or absence of the index of where clause.
But I just created and used idex_price for where clause.
What did I miss?
namecolumn to your index it would be "covering". SeeUsing indexandUsing index condition.