Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set procs to recompile to avoid plan cache noise #33

Closed
BlitzErik opened this issue Mar 29, 2018 · 2 comments
Closed

Set procs to recompile to avoid plan cache noise #33

BlitzErik opened this issue Mar 29, 2018 · 2 comments

Comments

@BlitzErik
Copy link

Hi Ola,

We do this across the Blitz* scripts:

ALTER PROCEDURE [dbo].[sp_Blitz]
    @Help TINYINT = 0 ,
...
WITH RECOMPILE
AS

Which helps us to avoid interfering in anyone's plan cache, or one of our procs being detected by... well, another one of our procs. Heh.

This would cover all the non-dynamic SQL statements in your procs, but the dynamic bits would (I believe) need recompile hints individually.

On the plus side, the only one I've seen cause any kind of resource consumption is the call to sys.dm_db_index_physical_stats in dbo.IndexOptimize.

Low priority, but I appreciate your time.

Thanks,
Erik

@olahallengren
Copy link
Owner

Thank you for the suggestion.

For statements in my stored procedures that are executed many times (in while loops) the plan caching is important for performance.

I know that from looking at the performance of the stored procedure for customers with large number of databases on a server, or large number of objects in a database.

@BlitzErik
Copy link
Author

Ah, okay, thanks. Makes sense.

Erik

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants