Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
EA
Starting Member
19 Posts |
Posted - 2009-01-15 : 08:25:38
|
There is an index which isn't used in the explain plain. The query performs very bad (it should be using the index....).It's very unwanted to use a hint in the code, SQL should use the appriopriate plan by itself.But editing the index (not changing anything) makes SQL to use the index. WHY? How can I work around this behaviour?Restarting the instance or restoring to an old dump gives the same behaviour every time. The index is only used after editing the sort order and reset it to the original value...... |
|
Lumbago
Norsk Yak Master
3271 Posts |
Posted - 2009-01-15 : 08:52:10
|
Have you updated your statistics? Run "UPDATE STATISTICS tablename" on all table sinvolved...if that doesn't work you should probably post your table structure, your index definition and quer query so we can have a look at it...- Lumbago |
 |
|
sodeep
Master Smack Fu Yak Hacker
7174 Posts |
Posted - 2009-01-15 : 10:05:33
|
quote: Originally posted by Lumbago Have you updated your statistics? Run "UPDATE STATISTICS tablename" on all table sinvolved...if that doesn't work you should probably post your table structure, your index definition and quer query so we can have a look at it...- Lumbago
Run sp_updatestats instead of it because it will only update the needed one. This will let your SQL engine to choose higher quality plan. |
 |
|
|
|
|