Forum Topic

Thanks for your participation and contribution.


Back to Performance Tuing

Clear the Proc Cache in SQL Azure

Post a reply
1955 views
i90runner1
i90runner1

Clear the Proc Cache in SQL Azure

-- run this script against a user database, not master

-- count number of plans currently in cache

select count(*) from sys.dm_exec_cached_plans;

-- Executing this statement will clear the procedure cache in the current database, which means that all queries will have to recompile.

ALTER DATABASE SCOPED CONFIGURATION CLEAR PROCEDURE_CACHE;

-- count number of plans in cache now, after they were cleared from cache

select count(*) from sys.dm_exec_cached_plans;

-- list available plans

select * from sys.dm_exec_cached_plans;

https://blogs.technet.microsoft.com/tip_of_the_day/2016/06/03/sql-tip-of-the-day-clear-the-proc-cache-in-sql-azure/
https://www.sqlskills.com/blogs/glenn/eight-different-ways-to-clear-the-sql-server-plan-cache/

Last updated

1-1 of 1

Reply to this discussion

You cannot edit posts or make replies: You should be logged in before you can post.