Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


multiple execution plans - not sure why?


multiple execution plans - not sure why?

Author
Message
curious_sqldba
curious_sqldba
SSCommitted
SSCommitted (1.5K reputation)SSCommitted (1.5K reputation)SSCommitted (1.5K reputation)SSCommitted (1.5K reputation)SSCommitted (1.5K reputation)SSCommitted (1.5K reputation)SSCommitted (1.5K reputation)SSCommitted (1.5K reputation)

Group: General Forum Members
Points: 1543 Visits: 3573
I have a stored procedure which runs 1000+ times a day. I can see that every time it is creating a new execution plan. I took the stored procedure ,opened two sessions in ssms and executed the sproc. I do see it is creating two new plans.
One thing different about this sproc is it is inserting data into a temp table which is created by another sproc. Any thoughts on how to avoid this? Could this be parameter sniffing?
DBA_Dom
DBA_Dom
Mr or Mrs. 500
Mr or Mrs. 500 (580 reputation)Mr or Mrs. 500 (580 reputation)Mr or Mrs. 500 (580 reputation)Mr or Mrs. 500 (580 reputation)Mr or Mrs. 500 (580 reputation)Mr or Mrs. 500 (580 reputation)Mr or Mrs. 500 (580 reputation)Mr or Mrs. 500 (580 reputation)

Group: General Forum Members
Points: 580 Visits: 81110
Can you provide some more information about what your procedures are doing. Code would be helpful. Are you using dynamic SQL? What is the Server Advance setting for Optimize for Ad hoc Workloads set to? What is the Database option for Parameterization set to?
GilaMonster
GilaMonster
SSC-Forever
SSC-Forever (47K reputation)SSC-Forever (47K reputation)SSC-Forever (47K reputation)SSC-Forever (47K reputation)SSC-Forever (47K reputation)SSC-Forever (47K reputation)SSC-Forever (47K reputation)SSC-Forever (47K reputation)

Group: General Forum Members
Points: 47204 Visits: 44367
sqldba_newbie (3/29/2013)
I can see that every time it is creating a new execution plan. I took the stored procedure ,opened two sessions in ssms and executed the sproc. I do see it is creating two new plans.


How are you seeing that?


Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

We walk in the dark places no others will enter
We stand on the bridge and no one may pass


curious_sqldba
curious_sqldba
SSCommitted
SSCommitted (1.5K reputation)SSCommitted (1.5K reputation)SSCommitted (1.5K reputation)SSCommitted (1.5K reputation)SSCommitted (1.5K reputation)SSCommitted (1.5K reputation)SSCommitted (1.5K reputation)SSCommitted (1.5K reputation)

Group: General Forum Members
Points: 1543 Visits: 3573
DBA_Dom (3/29/2013)
Can you provide some more information about what your procedures are doing. Code would be helpful. Are you using dynamic SQL? What is the Server Advance setting for Optimize for Ad hoc Workloads set to? What is the Database option for Parameterization set to?


Not adhooc, this is executed from the app.
curious_sqldba
curious_sqldba
SSCommitted
SSCommitted (1.5K reputation)SSCommitted (1.5K reputation)SSCommitted (1.5K reputation)SSCommitted (1.5K reputation)SSCommitted (1.5K reputation)SSCommitted (1.5K reputation)SSCommitted (1.5K reputation)SSCommitted (1.5K reputation)

Group: General Forum Members
Points: 1543 Visits: 3573
GilaMonster (3/29/2013)
sqldba_newbie (3/29/2013)
I can see that every time it is creating a new execution plan. I took the stored procedure ,opened two sessions in ssms and executed the sproc. I do see it is creating two new plans.


How are you seeing that?


Couple different ways. Within Confio (Ignite) and also when i run manually, i can see the plan handles are different.
Lynn Pettis
Lynn Pettis
SSC-Insane
SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)

Group: General Forum Members
Points: 24177 Visits: 37948
Unfortunately, we can't see what you see. You have posted no code (the stored procedure, the CREATE TABLE statements for the table or tables it uses, sample data, expected results). Anything we give you right now will be simply shots in the dark.

Cool
Lynn Pettis

For better assistance in answering your questions, click here
For tips to get better help with Performance Problems, click here
For Running Totals and its variations, click here or when working with partitioned tables
For more about Tally Tables, click here
For more about Cross Tabs and Pivots, click here and here
Managing Transaction Logs

SQL Musings from the Desert Fountain Valley SQL (My Mirror Blog)
GilaMonster
GilaMonster
SSC-Forever
SSC-Forever (47K reputation)SSC-Forever (47K reputation)SSC-Forever (47K reputation)SSC-Forever (47K reputation)SSC-Forever (47K reputation)SSC-Forever (47K reputation)SSC-Forever (47K reputation)SSC-Forever (47K reputation)

Group: General Forum Members
Points: 47204 Visits: 44367
sqldba_newbie (3/29/2013)
Within Confio (Ignite) and also when i run manually, i can see the plan handles are different.


Can't help you with just that info. There's a lot of things that could be happening here, deferred compile being just one of them, but need a lot more info on what you're seeing and why the conclusion is multiple plans.

Maybe start by having a read through these, at worst they'll give you more things to look at.
http://sqlinthewild.co.za/index.php/2010/07/27/hit-and-miss/
http://sqlinthewild.co.za/index.php/2010/08/31/come-and-gone/
http://sqlinthewild.co.za/index.php/2010/11/18/recompiles/
http://sqlinthewild.co.za/index.php/2011/08/16/compiles-and-recompiles/


Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

We walk in the dark places no others will enter
We stand on the bridge and no one may pass


Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search