Friday, 25 March 2011

Rebuilding indexes in SQL Server

DBCC SHOWCONTIG ("dbo.TableName") - Check your Scan Density...

DBCC SHOWCONTIG scanning TableName table...
Table: TableName (2099048); index ID: 1, database ID: 5
TABLE level scan performed.
- Pages Scanned................................: 74056
- Extents Scanned..............................: 9259
- Extent Switches..............................: 9258
- Avg. Pages per Extent........................: 8.0
- Scan Density [Best Count:Actual Count].......: 99.98% [9257:9259]
- Logical Scan Fragmentation ..................: 0.01%
- Extent Scan Fragmentation ...................: 1.57%
- Avg. Bytes Free per Page.....................: 45.7
- Avg. Page Density (full).....................: 99.44%
DBCC execution completed. If DBCC printed error messages, contact your system administrator.

Then rebuld if you need

DBCC DBREINDEX ("dbo.TableName")

No comments:

Post a Comment

How to find the last interactive logons in Windows using PowerShell

Use the following powershell script to find the last users to login to a box since a given date, in this case the 21st April 2022 at 12pm un...