sql-server – 有人可以解释DBCC DROPCLEANBUFFERS吗?

前端之家收集整理的这篇文章主要介绍了sql-server – 有人可以解释DBCC DROPCLEANBUFFERS吗?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
有人可以与CHECKPOINT运算符一起解释使用DBCC DROPCLEANBUFFERS并提供一个例子吗?

我了解在查询之前运行的性能测试非常有用,但我并没有完全掌握它.此外,我也没有关于与CHECKPOINT运算符结合使用的线索.

如果我在我的查询之前执行它们需要更长的时间才能运行,所以我猜测比较性能是很好的,但不能准确地评估它们.

任何帮助将不胜感激!

解决方法

CHECKPOINT修改的数据页面刷新到磁盘:

[CHECKPOINT] Writes all dirty pages for the current database to disk. Dirty pages are data pages that have been entered into the buffer cache and modified,but not yet written to disk. Checkpoints save time during a later recovery by creating a point at which all dirty pages are guaranteed to have been written to disk.

DBCC DROPCLEANBUFFERS然后删除任何非肮脏(肮脏,干净)页面

Use DBCC DROPCLEANBUFFERS to test queries with a cold buffer cache without shutting down and restarting the server.

To drop clean buffers from the buffer pool,first use CHECKPOINT to produce a cold buffer cache. This forces all dirty pages for the current database to be written to disk and cleans the buffers. After you do this,you can issue DBCC DROPCLEANBUFFERS command to remove all buffers from the buffer pool.

最终的结果是你从没有缓存开始.

猜你在找的MsSQL相关文章