December 9, 2009 at 10:57 am
SELECT INDEX_ID, AVG_FRAGMENTATION_IN_PERCENT
FROM sys.dm_db_index_physical_stats (db_id(),
Object_ID(production.prod),
Default, Default, 'DETAILED');
when I execute the above to get fragmentation %, i get more than one Index_id:
index_id avg_fragmention_in_percent
099.4397759103641
20.603621730382294
280
20
My question is, why are there more than one index ids? what does it mean exactly? after I execute the query to clean up fragmentation, not all index IDs decreased?
ANY IDEAS?
THANKS.
December 9, 2009 at 11:05 am
As per Books Online, in detailed mode index physical stats produces one row for each level of the index tree.
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
December 9, 2009 at 11:10 am
because you have specified detailed you are getting the non-leaf levels of the index as well. return the index_level column as well or use LIMITED.
fragmentation of non leaf nodes wont change if index level is too small or you are reorganising rather than rebuild
---------------------------------------------------------------------
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply