Sql server store procedure : Clean cache and buffer

In this article I am going to explain how to clean cache and buffer for sql server store procedure.


Description:
We need to clear the cache and buffer to measure the exact time duration of execution. You can clear the cache by restarting the sql server or by command execution. Sql server provides 2 DBCC commands.

DBCC FREEPROCCACHE is used to clear procedure cache. It will clear all query’s plan and recompiled all statements.
DBCC FREEPROCCACHE


DBCC DROPCLEANBUFFERS is used to clear all buffers from buffer pool without shutting down and restarting the server. Use checkpoint this command.
CHECKPOINT;
GO
DBCC DROPCLEANBUFFERS;

GO

Post a Comment

0 Comments