--索引上的碎片超过15%并且索引体积较大(超过500页)的索引。
SELECT '['+DB_NAME()+'].['+OBJECT_SCHEMA_NAME(ddips.[object_id], DB_ID())+'].['+OBJECT_NAME(ddips.[object_id], DB_ID())+']' AS [statement],
i.[name] AS [index_name],
ddips.[index_type_desc],
ddips.[partition_number],
ddips.[alloc_unit_type_desc],
ddips.[index_depth],
ddips.[index_level],
CAST(ddips.[avg_fragmentation_in_percent] AS SMALLINT) AS [avg_frag_%],
CAST(ddips.[avg_fragment_size_in_pages] AS SMALLINT) AS [avg_frag_size_in_pages],
ddips.[fragment_count],
ddips.[page_count]
FROM sys.dm_db_index_physical_stats(DB_ID(), NULL, NULL, NULL, 'limited') ddips
INNER JOIN sys.[indexes] i ON ddips.[object_id] = i.[object_id]
AND ddips.[index_id] = i.[index_id]
WHERE ddips.[avg_fragmentation_in_percent] > 15
AND ddips.[page_count] > 500
ORDER BY ddips.[avg_fragmentation_in_percent],
OBJECT_NAME(ddips.[object_id], DB_ID()),
i.[name];
需重建的索引
转载文章标签 需重建的索引 文章分类 SQL Server 数据库
上一篇:丢失索引
-
elasticsearch的索引重建
我们知道es在字段的mapping建立后就不可再次修改mapping的值。在我们实际的情况下有些
elasticsearch 索引重建 索引rebuild 数据 html -
重建索引 sql 语句 如何重建索引
前言: 随着我们的系统数据量越来越大,使用时间越来越长,有时需要考虑重建索引以提高系统的性能。通过本文简单描述下如何快速重建索引,希望同以后大家做维护有所帮助。一、 重建索
重建索引 sql 语句 structure session delete 优化