Can someone explain exactly what the output of Showcontig is showing me?
I came across this in an old script, ran it against a table (client) and got the following:
DBCC SHOWCONTIG scanning 'Client' table...
Table: 'Client' (245575913); index ID: 1, database ID: 5
TABLE level scan performed.
- Pages Scanned................................: 2
- Extents Scanned..............................: 2
- Extent Switches..............................: 1
- Avg. Pages per Extent........................: 1.0
- Scan Density [Best Count:Actual Count].......: 50.00% [1:2]
- Logical Scan Fragmentation ..................: 50.00%
- Extent Scan Fragmentation ...................: 50.00%
- Avg. Bytes Free per Page.....................: 3691.0
- Avg. Page Density (full).....................: 54.40%
DBCC execution completed. If DBCC printed error messages, contact your system administrator.
I took this to mean the table has 50% index fragmentation, so run the following (in order) all of which had no effect on the showcontig output:
DBCC INDEXDEFRAG ('TestDatabase','client')
DBCC INDEXDEFRAG ('TestDatabase','client', 'PK_Client')
DBCC INDEXDEFRAG ('TestDatabase','client', 'IX_ClientName')
ALTER INDEX IX_ClientName ON client REORGANIZE;
ALTER INDEX IX_ClientName ON client REBUILD;
--And finally: DROP INDEX IX_ClientName ON client; CREATE INDEX IX_ClientName on client (Name)
But when I run 'ALTERINDEXPK_ClientONclientREBUILD;' the 'Extent Scan Fragmentation' fell to 0% but the 'Logical Scan Fragmentation' remained the same.
I have goggled 'showcontig' but am still obviously missing exactly what these values mean? Can anyone provide a link to a simple explanation?
‘Client’ has two Indexes ‘IX_ClientName;’ which is linked to the ‘Name’ column, as seen above; and ‘PK_Client,’ which is the primary key and linked to the ‘ID’ column.