Hi there,
Can someone please explain why when the query below uses one constant in
the WHERE clause, MySQL decides to use the index on the 'source' column,
and why in the second query where there are two constants, it decides
not to?
Is there a way to get MySQL to use the index for the second query?
mysql> explain select * from data_total where source=8;
| id | select_type | table | type | possible_keys | key |
| 1 | SIMPLE | data_total | ref | source | source |
mysql> explain select * from data_total where (source=8 or source=9);
| id | select_type | table | type | possible_keys | key |
| 1 | SIMPLE | data_total | ALL | source | NULL |
(Output chopped for better formatting)
Thanks,
Colin Martin