Results 1 to 13 of 13

Thread: dbcc showcontig

  1. #1
    Join Date
    Feb 2003
    Location
    Aussie Land
    Posts
    114

    dbcc showcontig

    Hi,
    Ive just created a table, clustered index with fillfactor 70% (as it will be doing thousands of inserts and deletions daily).
    After a few thousand inserts, i run dbcc showcontig on the table.

    Result:
    ---------
    Table: 'MyTable' (1650104919); index ID: 1, database ID: 10
    TABLE level scan performed.
    - Pages Scanned................................: 5460
    - Extents Scanned..............................: 686
    - Extent Switches..............................: 1885
    - Avg. Pages per Extent........................: 8.0
    - Scan Density [Best Count:Actual Count].......: 36.21% [683:1886]
    - Logical Scan Fragmentation ..................: 13.19%
    - Extent Scan Fragmentation ...................: 0.29%
    - Avg. Bytes Free per Page.....................: 2083.2
    - Avg. Page Density (full).....................: 74.26%

    ***the Extent switches just balloons out, and scan density drops badly. is this terrible?

    Also - What is the main difference between "Logical Scan Fragmentation" & "Extent Scan Fragmentation". Every time, its either one of these values is much higher than the other. What is the best practice, which of the 2 should I be trying to keep fragmentation low?

  2. #2
    Join Date
    Nov 2002
    Location
    New Jersey, USA
    Posts
    3,932
    Logical scan fragmentation relevant to index pages only and is percentage of out of order pages to total number of pages in index. A page is out of order i the next leaf page pointed by IAM is not same as next page pointed by the page.


    Extent scan fragmentation measures fragmentation at extent level.

    Both these numbers should be below 10%, so the numbers in your case are not bad.

    But I'm not sure why your scan density is so low even with so low extent fragmentation.

  3. #3
    Join Date
    Sep 2002
    Posts
    5,938
    Low scan density is caused by page split, rebuilding clustered index will defrag the table.

  4. #4
    Join Date
    Nov 2002
    Location
    New Jersey, USA
    Posts
    3,932
    That should have increased extent fragmentation as well but it does not look proportional.

  5. #5
    Join Date
    Feb 2003
    Location
    Aussie Land
    Posts
    114
    Yes, it is very weird indeed.
    After rebuilding indexes, and more inserts i get the same statistics, scan density the main offender.
    However I cannot afford to rebuild the indexes daily. so my only other option would be to run index defrag on the actual table.

    Or maybe - could it be that my actual harddisk needs defragmenting? after all, i am running this test on my local machine which only has less than 2 GB (6GB Total) of available space, and has never been fragmented for years.
    I think, this might explain it.
    Last edited by KingSexy182; 03-13-2005 at 09:36 PM.

  6. #6
    Join Date
    Nov 2002
    Location
    New Jersey, USA
    Posts
    3,932
    That could be it, the datafile itself may be fragmented.

    Try stopping the sql server and run disk defrag.

  7. #7
    Join Date
    Feb 2003
    Location
    Aussie Land
    Posts
    114
    i will most certainly defrag my hd at end close of business. it'll be interesting to find out, if there were any differences.

  8. #8
    Join Date
    Feb 2003
    Location
    Aussie Land
    Posts
    114
    Is update statistics automatically executed after DBCC INDEXDEFRAG?

  9. #9
    Join Date
    Nov 2002
    Location
    New Jersey, USA
    Posts
    3,932
    I don't think it does, because INDEXDEFRAG does not reduce the number of pages or extents it only reorders pages.

  10. #10
    Join Date
    Feb 2003
    Location
    Aussie Land
    Posts
    114
    After Defragmenting my harddisk, and re-doiing the test; the results were noticeable.

    DBCC SHOWCONTIG scanning 'MyTable' table...
    Table: 'MyTable' (1650104919); index ID: 1, database ID: 10
    TABLE level scan performed.
    - Pages Scanned................................: 5861
    - Extents Scanned..............................: 739
    - Extent Switches..............................: 1593
    - Avg. Pages per Extent........................: 7.9
    - Scan Density [Best Count:Actual Count].......: 45.98% [733:1594]
    - Logical Scan Fragmentation ..................: 9.28%
    - Extent Scan Fragmentation ...................: 0.81%
    - Avg. Bytes Free per Page.....................: 2170.9
    - Avg. Page Density (full).....................: 73.18%
    DBCC execution completed. If DBCC printed error messages, contact your system administrator.


    It improved from 1:3 to 1:2 ratio in scan density after a few thousand density.

  11. #11
    Join Date
    Sep 2002
    Posts
    5,938
    Should rebuild clustered index to bring Scan Density close to 100%.

  12. #12
    Join Date
    Feb 2003
    Location
    Aussie Land
    Posts
    114
    thanks all.

  13. #13
    Join Date
    Feb 2003
    Location
    Aussie Land
    Posts
    114
    stumbled across this in technet:

    Physical Disk Fragmentation
    Disk fragmentation can contribute to poor performance on some systems. To determine whether disk fragmentation exists, use system tools provided in Microsoft Windows or from third parties to analyze drives on which SQL Server databases reside.

    On small-scale environments with more conventional I/O subsystems, it is recommended that you correct disk fragmentation before running index defragmentation tools.

    On large-scale environments that benefit from more intelligent disk subsystems, such as SAN (storage area networks) environments, correcting disk fragmentation is not necessary

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •