Solved

The different in execution plan

Posted on 2012-03-29
6
279 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
NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

 
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

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

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

Suggested Solutions

Everyone has problem when going to load data into Data warehouse (EDW). They all need to confirm that data quality is good but they don't no how to proceed. Microsoft has provided new task within SSIS 2008 called "Data Profiler Task". It solve th…
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…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

861 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