I can Clear Plan Cache for the current database through database-scoped configuration. I verify the context before considering eviction.

SELECT name, value, value_for_secondary
FROM sys.database_scoped_configurations
ORDER BY name;
-- Only after selecting and confirming the intended database:
-- USE [YourDatabase];
-- ALTER DATABASE SCOPED CONFIGURATION CLEAR PROCEDURE_CACHE;Select the intended database before executing the commented statement. It clears cached plans associated with that database, not the database buffer pool or every cache on the instance. An unqualified DBCC FREEPROCCACHE has a broader instance-level scope, so the two commands don’t have the same reach.
After removal, queries may compile new plans and consume extra CPU. This can help a controlled diagnosis, but clearing cache repeatedly is not a performance fix. Capture evidence and compare the affected workload before deciding to evict plans.
The SQL Server 2016 article described four early database-scoped options. Current releases expose many more, and the read-only query lists what this engine supports. Availability and permissions depend on the release and platform.
Reference: CLEAR PROCEDURE_CACHE.
Database plan eviction is not data-buffer clearing, it is removal of cached plans associated with that database.
Published by Pinal Dave on SQLAuthority. More of my work at pinaldave.com.
Discover more from SQL Authority with Pinal Dave
Subscribe to get the latest posts sent to your email.





2 Comments. Leave new
Hi sir,i have one query regarding cache clean…when is really required to clean cache??as sql server manages available memory appropriately…means when query required memory than it will get assigned from available memory and if it is less than available memory than dirty pages in memory get return back to memory and clean pages get flush from memory..so what is the need to clean catche???
If we want to check the execution plan of a query again after making some changes, we need to clear the cache to get rid of the old plans that are cached in memory.