I have a three-column (int
, smallint
, smallint
) composite clustered index with three leaf levels. My question is how and when does SQL Server create multiple leaf levels (index_level 0) for the same index.
I am experiencing performance issues and I can't get avg_page_space_used_in_percent
higher than 70% (leaf page count 1200, fill factor 80).
Microsoft SQL Server 2008 R2 (RTM) - 10.50.1617.0 (X64)
Apr 22 2011 19:23:43
Copyright (c) Microsoft Corporation
Developer Edition (64-bit) on Windows NT 6.1 <X64> (Build 7600: )
Best Answer
The 2008 R2 documentation for sys.dm_db_index_physical_stats includes a link to Table and Index Organization, which shows the following diagram:
It describes the data that may be stored in each of the three possible allocation unit types:
Your clustered index does contain three leaf levels, one per allocation unit type. For example:
Output:
Your table contains large object (
LOB
) columns (MAX
or old-styletext
,ntext
orimage
types) and variable-length column definitions which allow individual rows to exceed the 8060 byteINROW
limit.For rows that exceed 8060 bytes,
ROW_OVERFLOW_DATA
allocation units will be created. This is often problematic for performance, since row data access requires following an off-page pointer to retrieve the overflowed data.I would certainly look at the design of the table before worrying too much about how full the pages are on average. Whether you should be concerned about page fullness depends on which allocation unit it refers to.