The content explains how to clear SQL Server’s execution plan cache and buffer cache. DBCC FREEPROCCACHE removes cached plans globally, while ALTER DATABASE SCOPED CONFIGURATION CLEAR PROCEDURE_CACHE targets one database. To clear clean data pages, run CHECKPOINT first to write dirty pages to disk, then execute DBCC DROPCLEANBUFFERS.
Clear execution plan cache
This removes cached execution plans. SQL Server will compile new plans as queries run again.
DBCC FREEPROCCACHE;GO
For one database only:
USE YourDatabaseName;GOALTER DATABASE SCOPED CONFIGURATION CLEAR PROCEDURE_CACHE;GO
Clear clean data pages from buffer cache
CHECKPOINT writes dirty pages to disk, then DBCC DROPCLEANBUFFERS removes clean pages from the buffer pool.
CHECKPOINT;GODBCC DROPCLEANBUFFERS;GO