Solved

The different in execution plan

Posted on 2012-03-29
6
278 Views
Last Modified: 2012-04-23
Dear all expertist,

Right now we found out that one SQL SP is running good on test/QA platform but not on production, may I know what can cause this?

I knew that different:
1)Code
2) schema
3) index

can cause this, what else ?

I think I need to update statistics at the first step to see if it helps.

I don't want to go for a hard way.

DBA100.
0
Comment
Question by:marrowyung
6 Comments
 
LVL 15

Assisted Solution

by:Anuj
Anuj earned 125 total points
ID: 37781359
Compare the execution plans of both QA and Production, and confirm the same indexes are used. Next step is to check the fragmentation of your indexes, and update your statistics.
0
 
LVL 7

Accepted Solution

by:
waltersnowslinarnold earned 125 total points
ID: 37781478
Check it the Query in the SP is using multiple INDEX at the same time, if so force an INDEX in the code, which would let the Query to consider only the INDEX forced rather multiple.

Yet same problem persists, plz go ahead with update statistics
0
 
LVL 75

Assisted Solution

by:Anthony Perkins
Anthony Perkins earned 250 total points
ID: 37793715
>>one SQL SP is running good on test/QA platform but not on production, may I know what can cause this?<<
Production has more data that QA and the Stored Procedure has not been optimized.
0
VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

 
LVL 1

Author Comment

by:marrowyung
ID: 37794749
acperkins,

the production will always has more data then QA.

It is the same SP being different when running on production and QA, I would like to see why .

anujnb,

What if execution plan is not the same? "check the fragmentation of your indexes," can be done by rebuilting  index but our DB has run for a long time and it just start to happen


waltersnowslinarnold,

how to "force an INDEX in the code"?

DBA100.
0
 
LVL 75

Assisted Solution

by:Anthony Perkins
Anthony Perkins earned 250 total points
ID: 37802820
It is the same SP being different when running on production and QA, I would like to see why .
And again, that would be because in production you have more data and the query has not been optimized.  This means that the Execution Plans are different.  When you can wrap your head around that we can try and help you more.
0
 
LVL 7

Expert Comment

by:waltersnowslinarnold
ID: 37805540
You could force an INDEX in the following manner;

syntax;

SELECT
col1, col2, . . .
FROM tableName WITH (INDEX(indexName))
0

Featured Post

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question