Changing Execution Plans in Cache

  • 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

  • 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

  • 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?

  • 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

  • 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.

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply