Use DBCC FREEPROCCACHE to clear the procedure cache. Freeing the procedure cache would cause, for example, an ad-hoc SQL statement to be recompiled rather than reused from the cache. If observing through SQL Profiler, one can watch the Cache Remove events occur as DBCC FREEPROCCACHE goes to work. DBCC FREEPROCCACHE will invalidate all stored procedure plans that the optimizer has cached in memory and force SQL Server to compile new plans the next time those procedures are run. Let us learn how to clean cache.
Use DBCC DROPCLEANBUFFERS to test queries with a cold buffer cache without shutting down and restarting the server. DBCC DROPCLEANBUFFERS serves to empty the data cache. Any data loaded into the buffer cache due to the prior execution of a query is removed.
DBCC FREEPROCCACHE DBCC DROPCLEANBUFFERS
I hope you find this blog post about Clean Cache and Clean Buffer helpful.
If you have any questions, you can reach out to me via Twitter.
Here are a few of my recent videos which you may find interesting.
Do you know what a single arrow means in an execution plan? While we popularly call it the arrow, there is a technical name for these little arrows.
You might have heard that SELECT * is bad for query performance. Let us learn in today’s video how we can replace STAR (*) by column name.
Copy (CTRL + C) and Paste (CTRL + V) are the friends of the DBAs and Developers. In SQL Server it is totally possible to use the Cycle Clipboard Ring.
I often struggle to remember the changes done to the stored procedure and in this situation, the Split Screen of SSMS really comes in very handily.
There are two primary tools – 1) Execution Plan and 2) Statistics IO. In this blog post, we will see how we can get the full-screen execution plan.
Reference: Pinal Dave (https://blog.sqlauthority.com)