Robert Bollinger
2016-08-19 14:27:25 UTC
Real quick question here.
If you run this code against a database. Example:
use MyDatabase
SELECT OBJECT_NAME(i.OBJECT_ID) AS TableName,
i.name AS IndexName,
indexstats.avg_fragmentation_in_percent
FROM sys.dm_db_index_physical_stats(DB_ID(), NULL, NULL, NULL, 'DETAILED') indexstats
INNER JOIN sys.indexes i ON i.OBJECT_ID = indexstats.OBJECT_ID
AND i.index_id = indexstats.index_id
WHERE indexstats.avg_fragmentation_in_percent > 20
it gives you the list of fragmented indexes.
If you then rebuild the indexes and run the same code again . . .
IT GIVES ME THE SAME RESULTS!!!
Do you know what's going on???
Thanks for your help!
Bob B
If you run this code against a database. Example:
use MyDatabase
SELECT OBJECT_NAME(i.OBJECT_ID) AS TableName,
i.name AS IndexName,
indexstats.avg_fragmentation_in_percent
FROM sys.dm_db_index_physical_stats(DB_ID(), NULL, NULL, NULL, 'DETAILED') indexstats
INNER JOIN sys.indexes i ON i.OBJECT_ID = indexstats.OBJECT_ID
AND i.index_id = indexstats.index_id
WHERE indexstats.avg_fragmentation_in_percent > 20
it gives you the list of fragmented indexes.
If you then rebuild the indexes and run the same code again . . .
IT GIVES ME THE SAME RESULTS!!!
Do you know what's going on???
Thanks for your help!
Bob B