пятница, 25 июня 2010 г.

Проверить фрагментированность индексов

(a)

USE database;
GO
DBCC SHOWCONTIG (table);
GO

(b)

SELECT type_desc, ind.name AS Name_of_the_Index,OBJECT_NAME(ind.object_id)
AS Which_Table_has_this_index, phystat.avg_fragmentation_in_percent as Fragmentation_in_Percent
FROM sys.dm_db_index_physical_stats(DB_ID('database'), OBJECT_ID('table'), NULL, NULL, 'DETAILED')
phystat inner JOIN sys.indexes ind ON ind.object_id = phystat.object_id
AND ind.index_id = phystat.index_id

Комментариев нет:

Locations of visitors to this page