当前位置:   article > 正文

SQLSERVER 2012 - GHOST Cleanup 进程

ghost cleanup

1.Ghost Cleanup 进程功能

Deletes operations from a table or update operations that cause a row to move can immediately free up space on a page by removing references to the row. However, under certain circumstances, the row can physically remain on the data page as a ghost record. Ghost records are periodically removed by a background process. This residual data is not returned by the Database Engine in response to queries.


Ghost Cleanup 进程通常在服务重启后运行的,主要作用:

1)清理在聚集表下,记录被删除后形成的ghost记录。

当在聚集索引下删除记录,并没有真正的删除只是标记为ghost记录,这样删除会变得更快,回滚只需要撤销标记。当事务提交后后台有ghost清理程序来清理这些被标记为ghost记录。并且会保留最后一个数据页的最有一条ghost记录以免页没释放。

当记录被删除会在pfs上标记ghost,在数据页头上也会标记。但是pfs上的标记并不会通知处理程序处理。只有到下一次扫描到这个页时才会处理,或者等到每5秒一次的清理进程激活,清理进程就会扫描pfs页,并对ghost页处理。若没有需要清理的了就跳入下一个数据库。若这次扫描没有发现有ghost记录,那么会设置上一个标记,下5秒唤醒就跳过这个数据库。

Reference:

声明:本文内容由网友自发贡献,转载请注明出处:【wpsshop】
推荐阅读
相关标签
  

闽ICP备14008679号