Forcing the use of an index can improve performance?
- by aF.
Imagine that we have a query like this:
select a.col1, b.col2
from t1 a
inner join t2 b on a.col1 = b.col2
where a.col1 = 'abc'
Both col1 and col2 don't have any index.
If I add another restriction on the where clause, one that is always correct but with a column with an index:
select a.col1, b.col2
from t1 a
inner join t2 b on a.col1 = b.col2
where a.col1 = 'abc'
and a.id >= 0 -- column always true and with index
May the query perform faster since it may use the index on id column?