• Sanaullah (7/7/2008)


    Hi All,

    Here i am having two tables Table1 and Table2 and both the tables are having same number of records and columns i.e 14522, now see the problem.

    when i am selecting from table1(Select * from Table1) i am getting the output in 8 sec and when i am selecting from table2 (Select * from Table2) i am getting the output in 3 min and 20 sec.

    When i run DBCC SHOWCONTIG

    DBCC SHOWCONTIG scanning 'Table2' table...

    Table: 'Table2' (1157579162); index ID: 1, database ID: 21

    TABLE level scan performed.

    - Pages Scanned................................: 194

    - Extents Scanned..............................: 29

    - Extent Switches..............................: 28

    - Avg. Pages per Extent........................: 6.7

    - Scan Density [Best Count:Actual Count].......: 86.21% [25:29]

    - Logical Scan Fragmentation ..................: 0.52%

    - Extent Scan Fragmentation ...................: 13.79%

    - Avg. Bytes Free per Page.....................: 750.0

    - Avg. Page Density (full).....................: 90.73%

    DBCC SHOWCONTIG scanning 'Table1' table...

    Table: 'Table1' (2105058535); index ID: 1, database ID: 21

    TABLE level scan performed.

    - Pages Scanned................................: 235

    - Extents Scanned..............................: 33

    - Extent Switches..............................: 32

    - Avg. Pages per Extent........................: 7.1

    - Scan Density [Best Count:Actual Count].......: 90.91% [30:33]

    - Logical Scan Fragmentation ..................: 0.85%

    - Extent Scan Fragmentation ...................: 24.24%

    - Avg. Bytes Free per Page.....................: 759.1

    - Avg. Page Density (full).....................: 90.62%

    I want to know why the second table is taking much time to retrive the records online.

    Thanks in advance.

    Syed Sanaullah Khadri

    DBA.

    Hi Syed,

    Just wanted to ask you if both of your tables have equal number of columns. It may be that Table2 is having too many number of columns that results in more time in displaying those columns. Also check if your table has indexes created.