最新更新和删除的表?

时间:2017-06-06 11:34:58

标签: sql sql-server sql-server-2012

我们如何在sql server 2012和更高级别中查看大多数已删除和最新的表。

我们怎样才能看到制作最多io的桌子?

这些统计信息是否在Sql Server中保留?

1 个答案:

答案 0 :(得分:0)

索引碎片应该有所帮助 - 查看行数和碎片:

SELECT
     B.name AS TableName
    ,C.name AS IndexName
    ,C.fill_factor AS IndexFillFactor
    ,D.rows AS RowsCount
    ,A.avg_fragmentation_in_percent
    ,A.page_count
FROM 
    sys.dm_db_index_physical_stats(DB_ID(),NULL,NULL,NULL,NULL) A
INNER JOIN 
    sys.objects B
ON 
    A.object_id = B.object_id
INNER JOIN 
    sys.indexes C
ON 
    B.object_id = C.object_id AND A.index_id = C.index_id
INNER JOIN 
    sys.partitions D
ON 
    B.object_id = D.object_id AND A.index_id = D.index_id
WHERE 
    C.index_id > 0
order by
    avg_fragmentation_in_percent desc

PFE:感谢SQL Central的Neeraj Dwivedi