SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Changing Execution Plans in Cache


Changing Execution Plans in Cache

Author
Message
Djcarpen11
Djcarpen11
SSC Veteran
SSC Veteran (255 reputation)SSC Veteran (255 reputation)SSC Veteran (255 reputation)SSC Veteran (255 reputation)SSC Veteran (255 reputation)SSC Veteran (255 reputation)SSC Veteran (255 reputation)SSC Veteran (255 reputation)

Group: General Forum Members
Points: 255 Visits: 532
Hello,

I've exerpeinced something I've not noticed before, We have a heavily stored procedure in on of our databases and we've seen intermitting perfromance issues over the last week and it looks like the execution plan changes even through the stored procedure remains in cache. We've fixed the issue my using the forceseek index hint.

What would cause a plan to be changed? In our case an index seek on a very large table changed to scan and caused the procs performance to dive big time.

Dave
rajeshsdba
rajeshsdba
Grasshopper
Grasshopper (18 reputation)Grasshopper (18 reputation)Grasshopper (18 reputation)Grasshopper (18 reputation)Grasshopper (18 reputation)Grasshopper (18 reputation)Grasshopper (18 reputation)Grasshopper (18 reputation)

Group: General Forum Members
Points: 18 Visits: 127
Hello friend,

Please check your index status, If index fragmention have been over 30% then need reorganize index. If table is very big then make a plan Index re-organization on alternate days.

If you are using In function in stored procedure then you can change it in Inner join. your performance will be better.

Rajesh Singh
DBA(HCL Comnet)
+91-9560888360

Rajesh Singh
DBA(HCL Comnet)
+91-0560888360
Djcarpen11
Djcarpen11
SSC Veteran
SSC Veteran (255 reputation)SSC Veteran (255 reputation)SSC Veteran (255 reputation)SSC Veteran (255 reputation)SSC Veteran (255 reputation)SSC Veteran (255 reputation)SSC Veteran (255 reputation)SSC Veteran (255 reputation)

Group: General Forum Members
Points: 255 Visits: 532
I'm not sure how the index stats could cause a plan to change?

From our reindexing job last night the fragmentation for the index which has changed from a seek to scan was only 5% fragmented.

My question is if the proc went into cache on 10th April and the execution plan yesterday was showing a seek against a table, how canthe proc remain in cache today but the plan has changed to a scan?
rajeshsdba
rajeshsdba
Grasshopper
Grasshopper (18 reputation)Grasshopper (18 reputation)Grasshopper (18 reputation)Grasshopper (18 reputation)Grasshopper (18 reputation)Grasshopper (18 reputation)Grasshopper (18 reputation)Grasshopper (18 reputation)

Group: General Forum Members
Points: 18 Visits: 127
Hi,

It's feature of Sql Instance when you started the sql server then autometically Index, function, View and Stored procedure store the RAM(Instance) and as you cache is part of RAM.So that reason Proc getting old execution plan.

Rajesh Singh
DBA(HCL Comnet)
+91-0560888360
Djcarpen11
Djcarpen11
SSC Veteran
SSC Veteran (255 reputation)SSC Veteran (255 reputation)SSC Veteran (255 reputation)SSC Veteran (255 reputation)SSC Veteran (255 reputation)SSC Veteran (255 reputation)SSC Veteran (255 reputation)SSC Veteran (255 reputation)

Group: General Forum Members
Points: 255 Visits: 532
sorry, I'm not sure I've actually made my question clear.

I've got a prcodedure which has been cached since the 10- April. Yesterday the proc was running as expected today it's performing badly. Through the SQL DMO's I can see the procedure is still in cache from the 10-April and has over 4 million executions and when I get the execution plan details from the cached plans that also shows it's been used 4million times, but this plan has actually changed from doing a perfromant seek against a table to a scan. it's meant the duration CPU and reads have gone through the roof, adding a forceseek will fix the issue I'm just confused how a plan can actually change in cache.
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