How do you find out the % fragmentation of your table?
SQL Server stores your table data rows on data page that is normally 8Kb/Page. These 8k pages form a 64Kb container call Extent.use dbcc showcontig ('YOUR_TABLE_NAME
If it's fragmented, then run
This table describes the information in the result set. Microsoft owns the following tables. More info here.
Statistic | Description |
---|---|
Pages Scanned | Number of pages in the table or index. |
Extents Scanned | Number of extents in the table or index. |
Extent Switches | Number of times the DBCC statement moved from one extent to another while it traversed the pages of the table or index. |
Avg. Pages per Extent | Number of pages per extent in the page chain. |
Scan Density [Best Count: Actual Count] | Best count is the ideal number of extent changes if everything is contiguously linked. Actual count is the actual number of extent changes. The number in scan density is 100 if everything is contiguous; if it is less than 100, some fragmentation exists. Scan density is a percentage. |
Logical Scan Fragmentation | Percentage of out-of-order pages returned from scanning the leaf pages of an index. This number is not relevant to heaps and text indexes. An out of order page is one for which the next page indicated in an IAM is a different page than the page pointed to by the next page pointer in the leaf page. |
Extent Scan Fragmentation | Percentage of out-of-order extents in scanning the leaf pages of an index. This number is not relevant to heaps. An out-of-order extent is one for which the extent containing the current page for an index is not physically the next extent after the extent containing the previous page for an index. |
Avg. Bytes free per page | Average number of free bytes on the pages scanned. The higher the number, the less full the pages are. Lower numbers are better. This number is also affected by row size; a large row size can result in a higher number. |
Avg. Page density (full) | Average page density (as a percentage). This value takes into account row size, so it is a more accurate indication of how full your pages are. The higher the percentage, the better. |