笔记268 如何查看SQL 表里的幽灵记录 ghostrecord 2013-5-9

笔记268 如何查看SQL 表里的幽灵记录 ghostrecord 2013-5-9

 1 --如何查看SQL 表里的幽灵记录 ghostrecord 2013-5-9
 2 SELECT  DB_NAME(database_id) AS '数据库', OBJECT_NAME(object_id), ghost_record_count,
 3         version_ghost_record_count
 4 FROM    sys.dm_db_index_physical_stats(DB_ID(N'GPOSDB'),
 5                                        OBJECT_ID(N'dbo.CT_FuelingData'), NULL, NULL,
 6                                        'DETAILED');
 7                                       
 8 --描述:The Ghost record count is the row count in the index leaf level marked for deletion,
 9 -- but not yet deleted by the database engine Ghost_record_count is the ghost record count awaiting removal by the ghost cleanup task in the allocation unit.
10 --  Version_Ghost_record_count is the ghost records count
11 --sustained by a snapshot isolation transaction in an allocation unit.

 

posted @ 2013-08-04 20:31 桦仔 阅读(...) 评论(...) 编辑 收藏