SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2005 Forums
 SQL Server Administration (2005)
 plan cache problems
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

lminfo
Starting Member

3 Posts

Posted - 12/19/2012 :  11:42:58  Show Profile  Reply with Quote
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
Flowing Fount of Yak Knowledge

5155 Posts

Posted - 12/19/2012 :  12:13:37  Show Profile  Reply with Quote
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 - 12/20/2012 :  03:03:17  Show Profile  Reply with Quote
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
Flowing Fount of Yak Knowledge

5155 Posts

Posted - 12/20/2012 :  06:08:38  Show Profile  Reply with Quote
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.

Edited by - sunitabeck on 12/20/2012 06:47:01
Go to Top of Page

lminfo
Starting Member

3 Posts

Posted - 12/20/2012 :  08:32:31  Show Profile  Reply with Quote
I guess there is no a quick way around. I will read the link thanks.

Edited by - lminfo on 12/20/2012 08:33:21
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.09 seconds. Powered By: Snitz Forums 2000