Below script that can be used to clear SQL Server Cache. Helpful while working on performance tuning of SQL Scripts.


CHECKPOINT;
GO
DBCC DROPCLEANBUFFERS
DBCC FREEPROCCACHE
DBCC FREESYSTEMCACHE ('ALL')
DBCC FREESESSIONCACHE
GO

Note that this script is solely for running on Development environments, do not run in Production as it would cause issues to queries that depend on cached data.

Leave a Reply

Your email address will not be published. Required fields are marked *