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 |
nvsmike
Starting Member
1 Post |
Posted - 2007-09-25 : 11:56:59
|
I have 2 databases with the same tables in them. We’ll call them Test and Live. The Live system executes an sql statement with the correct execution plan using the proper indexes for the tables included in the statement. The Test database given the same sql statement uses a different execution plan doing tables scans which are terribly inefficient. I verified that both systems have the same table structures and indexes. I rebuild all the indexes on the Test tables an received the same incorrect execution plan. Does anybody know what could cause the SQL server to incorrectly determine the execution plan? And how to fix it? |
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2007-09-25 : 12:56:55
|
Is the data the same in both databases, row counts specifically? You could always force a particular index to be used as SQL Server doesn't always pick the correct one. We have seen this for composite indexes especially. In some environments, it uses it correctly and others it doesn't. So we've forced it in the code.Tara KizerMicrosoft MVP for Windows Server System - SQL Serverhttp://weblogs.sqlteam.com/tarad/ |
 |
|
|
|
|