views:

52

answers:

5

Hi,

I am trying to find a solution for a problem that is driving me mad...

I have a query which runs very fast in a QA Server but it is very slow in production. I realized that they have different execution plans... so I have try recompiling, cleanning the cache for the execution plans, update statistics, check the type of collation... but I still can't find what's going on...

The databases where the query is running are exactly the same and the SQL Servers have also the same configuration.

Any new ideas would be much appreciated.

Thanks, A.

+2  A: 

Is it possible the production server has a larger database size? The plan can be different because it is based on statistics on the data it contains.

Eddy Pronk
Same database, same data...
A..
+2  A: 

I think it could be due to the volume of data present. It happened to us one time where the query literally flew in QA server but was incredibly slow in the production. After breaking our heads for a while we found out that QA server had 15K rows where as production had 1.5 million.

HTH

Raja
No, both databases are exactly the same... same tables, triggers, indexes.... and data...
A..
A: 

If the execution plan was the same and one was slow, it would be database load, hardware, locking/blocking, etc.

However, if the execution plans are different something is different between the two databases. Are statistics up to date in both, have the exact same schemas, same indexes, similar number of rows, same distribution of PK and index values, etc. Where did the QA data come from, random data or is it a restore from production?

KM
The QA database is a manual backup/restore from the production database, so I think everything should be the same, right? I just don't understand what I am getting different execution plans...
A..
And the difference in the execution is just unreal... one query takes 3 seconds in QA and almost 5 minutes in production...
A..
how about posting the execution plans? or at least telling what is the actual difference
KM
Sure, but I think they are too big to post them here... can I send them to you?
A..
A: 

Disable parallel query execution on production :)

Arvo
The query running fast on QA makes use of parallel query....
A..
And on production? It depends on database and query nature; for our main application it is often preferrable to turn parallelism off, but sure there are scenarios, where parallelism helps.
Arvo
A: 

I just realised the the QA server is running SP3 and in production is SP2. Could this have any impact on this issue?

A..