Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Changing Execution Plans in Cache Expand / Collapse
Author
Message
Posted Tuesday, April 16, 2013 2:47 AM
SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Friday, February 7, 2014 1:57 AM
Points: 201, 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
Post #1442647
Posted Tuesday, April 16, 2013 3:32 AM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Tuesday, September 17, 2013 6:32 AM
Points: 12, Visits: 126
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
Post #1442659
Posted Tuesday, April 16, 2013 3:43 AM
SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Friday, February 7, 2014 1:57 AM
Points: 201, 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?
Post #1442662
Posted Tuesday, April 16, 2013 3:56 AM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Tuesday, September 17, 2013 6:32 AM
Points: 12, Visits: 126
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
Post #1442666
Posted Tuesday, April 16, 2013 4:03 AM
SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Friday, February 7, 2014 1:57 AM
Points: 201, 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.
Post #1442667
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse