Skip to content

Instantly share code, notes, and snippets.

@ronascentes
Last active October 5, 2016 17:32
Show Gist options
  • Save ronascentes/a8445e3d83f9a9554b1c773b3dc7c36d to your computer and use it in GitHub Desktop.
Save ronascentes/a8445e3d83f9a9554b1c773b3dc7c36d to your computer and use it in GitHub Desktop.
Clearing cache and buffer
-- releases all unused cache entries from all caches
DBCC FREESYSTEMCACHE('All') WITH NO_INFOMSGS;
-- flushes the distributed query connection cache used by distributed queries against an instance
DBCC FREESESSIONCACHE WITH NO_INFOMSGS;
-- manually removes a single plan or all plans from the cache
DBCC FREEPROCCACHE WITH NO_INFOMSGS;
-- clear the data buffer
DBCC DROPCLEANBUFFERS WITH NO_INFOMSGS;
-- resets the wait statistics data that your SQL Server has collected since it was last restarted
DBCC SQLPERF('sys.dm_os_wait_stats' , CLEAR)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment