Welcome to SqlServer-QA.net Sign in | Join | Help

SQL Server Storage Engine & Tools (SSQA.net)

SQL Server Tools includes storage engine that includes a complete set of graphical tools and command prompt utilities that allow users, programmers, and administrators. SSMS, SSRS, SSIS & SSAS are most commonly used tools.
DBCC EXTENTINFO - unused pages in these extents (undocumented)

When it comes to resolving table fragmentation, the basic checkout you perform is to run DBCC INDEXDEFRAG or even run DBCC DBREINDEX statements.

As per the default configuraiton SQL Database Engine allocates a new extent to an allocation unit only when it cannot quickly find a page in an existing extent with sufficient space to hold the row being inserted. This allocation goes with extents on the filegroup using a proportional allocation algorithm, that means if that filegroup with multiple fils means one has two times the free space as the other, two pages will be allocated from the file with the available space for every one page allocated from the other file. This means that every file in a filegroup should have a similar percentage of space used.

 The Database Engine uses the IAM pages to find the extents allocated to the allocation unit. For each extent, the Database Engine searches the PFS pages to see if there is a page that can be used. Each IAM and PFS page covers lots of data pages, so there are few IAM and PFS pages in a database. This means that the IAM and PFS pages are generally in memory in the SQL Server buffer pool, so they can be searched quickly.

So when the data is inserted, it will be organized contiguously wherever possible, if data is dropped there will be empty space that causes the fragmentation. Viewing the extent fragmentation scores for each object is one way, but another way is to view object fragment placements throughout the database.  The standard procedure to defragment the indexes is to perform database reorganization methods as mentioned above.

On the basis of extent information you can use undocumented procedure DBCC EXTENTINFO that shows you one row of output for every allocation.

For further information on this extents information refer to Tony's post about: Extent Usage and Behaviours when using DBREINDEX and SHRINKFILE on his blog.

 

Posted: Tuesday, September 04, 2007 5:45 AM by SQL Master

Comments

Other SQL Server Blogs around the Web said:

When it comes to resolving table fragmentation, the basic checkout you perform is to run DBCC INDEXDEFRAG

# September 4, 2007 6:39 AM

SSQA.net - SqlServer-QA.net said:

When it comes to resolving table fragmentation, the basic checkout you perform is to run DBCC INDEXDEFRAG

# September 4, 2007 6:39 AM

jackpatel said:

Is there any changes between sql server 2000 and 2005 using this statement?

# September 5, 2007 10:40 AM

SQL Master said:

As explained this is an undocumented DBCC statement, you should not use it straight away. If there is any particular requirement for you please post on the forums to get help.

# September 7, 2007 3:08 AM
Anonymous comments are disabled