SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Rebuild/Reorg Indexes (meaning of index_level in sys.dm_db_index_physical_stats)


Rebuild/Reorg Indexes (meaning of index_level in sys.dm_db_index_physical_stats)

Author
Message
guru2007
guru2007
SSC Rookie
SSC Rookie (48 reputation)SSC Rookie (48 reputation)SSC Rookie (48 reputation)SSC Rookie (48 reputation)SSC Rookie (48 reputation)SSC Rookie (48 reputation)SSC Rookie (48 reputation)SSC Rookie (48 reputation)

Group: General Forum Members
Points: 48 Visits: 62
Hello,
I have been capturing index fragmentation statistics for one of our databases for few weeks now. I wanted to see how indexes are fragmented over time. I put the results of sys.dm_db_index_physical_stats in one table and started analyzing. For E.g.
Hello
object_name index_id avg_fragmentation_in_percent index_type_desc index_level avg_fragment_size_in_pages page_count
SMMTRANSLOG 1 6.58 CLUSTERED INDEX 0 5.60 24145
SMMTRANSLOG 1 90.3 CLUSTERED INDEX 1 1 2331

Some of the indexes have multiple index_levels and avg_fragmentation_in_percent for such indexes is very large. Rebuilding of such indexes only seems to reduce the fragmentation of the 0 level index even when the page count for level 1(and more) indexes is over 1024.
Hence my questions are:
1. Why the rebuilding of the indexes does not lower the avg_fragmentation for level 1 (and more) indexes?
2. Should I be worried about high fragmentation of such indexes?

The MSDN article (http://msdn.microsoft.com/en-us/library/ms188917(v=sql.105).aspx/html) states that

Index_Level is
"Current level of the index.
0 for index leaf levels, heaps, and LOB_DATA or ROW_OVERFLOW_DATA allocation units.
Greater than 0 for nonleaf index levels. index_level will be the highest at the root level of an index.
The nonleaf levels of indexes are only processed when mode = DETAILED. "

Any help would be much appreciated.

Thank you.
Erland Sommarskog
Erland Sommarskog
SSCertifiable
SSCertifiable (5.3K reputation)SSCertifiable (5.3K reputation)SSCertifiable (5.3K reputation)SSCertifiable (5.3K reputation)SSCertifiable (5.3K reputation)SSCertifiable (5.3K reputation)SSCertifiable (5.3K reputation)SSCertifiable (5.3K reputation)

Group: General Forum Members
Points: 5274 Visits: 875
The upper levels of the indexs are not scanned, nor are they always full. No, you should not be worried about fragmentation in these levels as long as leaf level is good.

Erland Sommarskog, SQL Server MVP, www.sommarskog.se
guru2007
guru2007
SSC Rookie
SSC Rookie (48 reputation)SSC Rookie (48 reputation)SSC Rookie (48 reputation)SSC Rookie (48 reputation)SSC Rookie (48 reputation)SSC Rookie (48 reputation)SSC Rookie (48 reputation)SSC Rookie (48 reputation)

Group: General Forum Members
Points: 48 Visits: 62
Thank you for the quick response.
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search