Created
March 1, 2018 18:04
-
-
Save kspearrin/9db6900ef9483fcf58c88b92410758ba to your computer and use it in GitHub Desktop.
Clear Azure SQL Procedure Cache
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- ref: https://dba.stackexchange.com/a/159886 | |
-- 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; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment