October 9, 2001 at 12:31 pm
If there is a SQL command that forces a SQL SELECT statement to use a specific index, what it is?
Matthew Mamet
October 9, 2001 at 4:05 pm
Take a look in BOL for hints. Sometimes it's appropriate, but think twice before doing it - what will work in one case may not work as well in another. Your code also becomes dependent on that particular index to work. If you (or another DBA) in the future decides to drop the index, your code will break.
Andy
October 10, 2001 at 11:53 am
what's BOL?
Matthew Mamet
October 10, 2001 at 12:20 pm
Books Online.
October 22, 2001 at 12:59 pm
The exact syntax is:
SELECT field_names
FROMtable_name WITH (INDEX = index_name)
ORDER BY field_names
Matthew Mamet
October 22, 2001 at 2:05 pm
I concur with Andy. You probably want to avoid this. You are assuming you know more than the program for a particular statement, which may not be true for different load levels. Also, this creates a point of maintenance. If you create a new index or remove this one (for some reason), will you remember to update this query?
Steve Jones
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply