Перейти к содержимому

Как сделать фрагментацию индексов и обновление статистики

USE tsd1;

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'tsd1'), OBJECT_ID(N'dbo.PRICELISTDATA_TSD'), 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

 

Similar Posts:

Метки:

Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *