sql server programming:
Hi all,
we have 2 tables that will have huge data updations during the bussiness hours
I have ran DBCC SHOWCONTIG on 2 tables and the data is shown as below
Table1
------
DBCC SHOWCONTIG ('table1')
Table: 'table1' (251147940); index ID: 1, database ID: 7 [SQLSTATE 01000]
TABLE level scan performed. [SQLSTATE 01000]
- Pages Scanned................................: 200880 [SQLSTATE 01000]
- Extents Scanned..............................: 25243 [SQLSTATE 01000]
- Extent Switches..............................: 25242 [SQLSTATE 01000]
- Avg. Pages per Extent........................: 8.0 [SQLSTATE 01000]
- Scan Density [Best Count:Actual Count].......: 99.47% [25110:25243]
[SQLSTATE 01000]
- Logical Scan Fragmentation ..................: 0.00% [SQLSTATE 01000]
- Extent Scan Fragmentation ...................: 5.56% [SQLSTATE 01000]
- Avg. Bytes Free per Page.....................: 287.5 [SQLSTATE 01000]
- Avg. Page Density (full).....................: 96.45% [SQLSTATE 01000]
DBCC execution completed. If DBCC printed error messages, contact your
system administrator. [SQLSTATE 01000]
After that I ran DBCC DBREINDEX('table1')
This command took nearly 45 Min to complete
after DBREINDEX I again ran DBCC SHOWCONTIG ('table1') the result is
DBCC SHOWCONTIG scanning 'table1' table... [SQLSTATE 01000]
Table: 'DATA_SERVICE' (251147940); index ID: 1, database ID: 7 [SQLSTATE
01000]
TABLE level scan performed. [SQLSTATE 01000]
- Pages Scanned................................: 200880 [SQLSTATE 01000]
- Extents Scanned..............................: 25243 [SQLSTATE 01000]
- Extent Switches..............................: 25242 [SQLSTATE 01000]
- Avg. Pages per Extent........................: 8.0 [SQLSTATE 01000]
- Scan Density [Best Count:Actual Count].......: 99.47% [25110:25243]
[SQLSTATE 01000]
- Logical Scan Fragmentation ..................: 0.00% [SQLSTATE 01000]
- Extent Scan Fragmentation ...................: 5.56% [SQLSTATE 01000]
- Avg. Bytes Free per Page.....................: 287.5 [SQLSTATE 01000]
- Avg. Page Density (full).....................: 96.45% [SQLSTATE 01000]
DBCC execution completed. If DBCC printed error messages, contact your
system administrator. [SQLSTATE 01000]
Table 2
---------
DBCC SHOWCONTIG ('table2')
DBCC SHOWCONTIG scanning 'DATA_SERVICE_OPS' table... [SQLSTATE 01000]
Table: 'DATA_SERVICE_OPS' (395148453); index ID: 1, database ID: 7 [SQLSTATE
01000]
TABLE level scan performed. [SQLSTATE 01000]
- Pages Scanned................................: 438736 [SQLSTATE 01000]
- Extents Scanned..............................: 55309 [SQLSTATE 01000]
- Extent Switches..............................: 62098 [SQLSTATE 01000]
- Avg. Pages per Extent........................: 7.9 [SQLSTATE 01000]
- Scan Density [Best Count:Actual Count].......: 88.31% [54842:62099]
[SQLSTATE 01000]
- Logical Scan Fragmentation ..................: 23.27% [SQLSTATE 01000]
- Extent Scan Fragmentation ...................: 2.41% [SQLSTATE 01000]
- Avg. Bytes Free per Page.....................: 173.1 [SQLSTATE 01000]
- Avg. Page Density (full).....................: 97.86% [SQLSTATE 01000]
DBCC execution completed. If DBCC printed error messages, contact your
system administrator. [SQLSTATE 01000]
DBCC execution completed. If DBCC printed error messages, contact your
system administrator. [SQLSTATE 01000]
After DBCC DBREINDEX('table2') the result was as follows
This command took 1 Hr to complete
DBCC SHOWCONTIG scanning 'table2' table... [SQLSTATE 01000]
Table: '' (395148453); index ID: 1, database ID: 7 [SQLSTATE 01000]
TABLE level scan performed. [SQLSTATE 01000]
- Pages Scanned................................: 435140 [SQLSTATE 01000]
- Extents Scanned..............................: 54736 [SQLSTATE 01000]
- Extent Switches..............................: 54735 [SQLSTATE 01000]
- Avg. Pages per Extent........................: 7.9 [SQLSTATE 01000]
- Scan Density [Best Count:Actual Count].......: 99.37% [54393:54736]
[SQLSTATE 01000]
- Logical Scan Fragmentation ..................: 0.00% [SQLSTATE 01000]
- Extent Scan Fragmentation ...................: 3.41% [SQLSTATE 01000]
- Avg. Bytes Free per Page.....................: 107.7 [SQLSTATE 01000]
- Avg. Page Density (full).....................: 98.67% [SQLSTATE 01000]
DBCC execution completed. If DBCC printed error messages, contact your
system administrator. [SQLSTATE 01000]
DBCC DBREINDEX on these 2 tables are taking nearly 2 Hrs to complete which
is killing most of the bussiness hours
Is there any solution for this such that the DBREINDEX time can be reduced
Please help
Thanks