检查索引的碎片的步骤:
1. 在“对象资源管理器”中,连接到 数据库引擎的实例。
2. 在标准菜单栏上,单击“新建查询”。
3. 将以下示例复制并粘贴到查询窗口中,然后单击“执行”。
USE AdventureWorks2012;
GO
-- Find the average fragmentation percentage of all indexes
-- in the HumanResources.Employee table.
SELECT a.index_id, name, avg_fragmentation_in_percent
FROM sys.dm_db_index_physical_stats (DB_ID(N'AdventureWorks2012'), OBJECT_ID(N'HumanResources.Employee'), NULL, NULL, NULL) AS a
JOIN sys.indexes AS b ON a.object_id = b.object_id AND a.index_id = b.index_id;
GO
重新组织碎片索引
1. 在“对象资源管理器”中,连接到 数据库引擎的实例。
2. 在标准菜单栏上,单击“新建查询”。
3. 将以下示例复制并粘贴到查询窗口中,然后单击“执行”。
USE AdventureWorks2012;
GO
-- Reorganize the IX_Employee_OrganizationalLevel_OrganizationalNode index on the HumanResources.Employee table.
ALTER INDEX IX_Employee_OrganizationalLevel_OrganizationalNode ON HumanResources.Employee
REORGANIZE ;
GO
参考文档: https://msdn.microsoft.com/zh-cn/library/ms189858.aspx?
你去做个维护计划,就知道了么