Clear SQL Server Cache

What is SQL Server Cache?

SQL Server uses memory to cache:

  • Execution Plans (Plan Cache)

  • Data Pages (Buffer Pool)

  • Procedure Cache (Compiled procedures/functions)

This improves performance by reducing the need to recompile queries or fetch data from disk repeatedly.

Why Clear SQL Server Cache?

  • For performance testing (benchmarking with a "cold cache")

  • To troubleshoot performance issues

  • After large data changes

  • To free up memory temporarily

Caution

Commands to Clear SQL Server Cache

Clear the Procedure (Execution Plan) Cache

DBCC FREEPROCCACHE;

Clear the Buffer Pool (Data Cache)

DBCC DROPCLEANBUFFERS;

Clear Both Caches (Common for testing)

CHECKPOINT;
DBCC DROPCLEANBUFFERS;
DBCC FREEPROCCACHE;

Permissions Required

Useful for:


REFERENCES

Last updated

Was this helpful?