Subject | Select uses the wrong index |
---|---|
Author | GrumpyRain |
Post date | 2004-08-25T02:39:43Z |
I am sure this would have been asked before. I did a search and
couldn't find anything so apologies in advance if this has been answered.
I have a select statement on a table with about 3000 records in it.
There is a field which I need in my where clause that is a foreign key
(so there is an implied index on it). I have also another index on the
another field in the where clause.
The foreign key field is a really poor choice (selectivity = 2500),
whereas the other index is a good choice (selectivity = 25).
Can I add something to the query to suggest the best query plan to use?
couldn't find anything so apologies in advance if this has been answered.
I have a select statement on a table with about 3000 records in it.
There is a field which I need in my where clause that is a foreign key
(so there is an implied index on it). I have also another index on the
another field in the where clause.
The foreign key field is a really poor choice (selectivity = 2500),
whereas the other index is a good choice (selectivity = 25).
Can I add something to the query to suggest the best query plan to use?