Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 SQL Server Administration (2005)
 plan cache problems

Author  Topic 

lminfo
Starting Member

3 Posts

Posted - 2012-12-19 : 11:42:58
Dear all forum users,

I'm desperately seeking for help to my database issue which is constantly wiping out the compiled plans and causing locks to SP’s run by the front end users.

I have a lot of waiting task due to every execution of SP is compiled and only one compilation is allowed simultaneously.

sys.dm_exec_cached_plans is registering the plan after a successful compilation but in a seconds it is wiped away from the cache which will lead to another compilation and so forth.

Now while the stress and usage levels are low, I can see the cache plans are working as normal and row number is growing (cache plan size in gb 3.200073242187)

I’m looking for help to find the cause for this, thank you for helping me out.





sunitabeck
Master Smack Fu Yak Hacker

5155 Posts

Posted - 2012-12-19 : 12:13:37
If the plan is being recompiled EVERY time, that seems almost as though the stored proc has the WITH RECOMPILE option. You can script the stored procedure and look for that.

If that is not the case, is there memory pressure on the server or the system? Even in that case, I wouldn't have expected a recompilation at every run.
Go to Top of Page

lminfo
Starting Member

3 Posts

Posted - 2012-12-20 : 03:03:17
quote:
Originally posted by sunitabeck

If the plan is being recompiled EVERY time, that seems almost as though the stored proc has the WITH RECOMPILE option. You can script the stored procedure and look for that.

If that is not the case, is there memory pressure on the server or the system? Even in that case, I wouldn't have expected a recompilation at every run.



Thank you for your reply sunitabeck.

It's not the only procedure that's recompiling, it's all adhocs, preparations and procs (udf's included) aswell, basically everything from the dm_exec_cached_plans table.

This is not happening constantly, only at the peak hours.
And a server reboot, yes, it does help to keep the plans for a day or two.

I'm able to post any memory usage on a request and any help is appreciated. The server is running a 16g of memory and 14g is allocated for the use of SQL Server.

Go to Top of Page

sunitabeck
Master Smack Fu Yak Hacker

5155 Posts

Posted - 2012-12-20 : 06:08:38
I don't have any quick fixes or thoughts to offer. My suggestion though is to read through this white paper by Greg Low and examine if any of that applies to you. It is rather long, but very exhaustive as well - discusses various reasons why plans may not be reused.
Go to Top of Page

lminfo
Starting Member

3 Posts

Posted - 2012-12-20 : 08:32:31
I guess there is no a quick way around. I will read the link thanks.
Go to Top of Page
   

- Advertisement -