sqlserver优化 索引碎片

SELECT object_name(ips.object_id) AS TableName, ips.index_id, name AS IndexName, 
avg_fragmentation_in_percent,db_name(ips.database_id) AS DatabaseName
FROM sys.dm_db_index_physical_stats
    (Db_id(DB_NAME())
        , NULL
        , NULL
        , NULL
        , NULL) AS ips
INNER JOIN sys.indexes AS SI ON ips.object_id = SI.object_id AND ips.index_id = SI.index_id
WHERE ips.avg_fragmentation_in_percent > 5 AND SI.index_id <> 0

转载请注明出处:

转载自http://lxfamn.cn/blog

未经允许不得转载:lxfamn » sqlserver优化 索引碎片

赞 (0) 打赏

置顶推荐

评论 0

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏