sp_iqrowdensity procedure

Function

Reports information about the internal row fragmentation for a table at the FP index level.

Syntax

dbo.sp_iqrowdensity ( ‘target ‘ )
target:( table table-name | (column column-name (...) )

Permissions

This procedure is owned by dbo. Users without DBA authority must be granted execute permission for the stored procedure in order to run it.

Usage

table-name Target table table-name reports on all columns in the named table.

column-name Target column column-name reports on the named column in the target table. You may specify multiple target columns, but must repeat the keyword each time.

You must specify the keywords table and column. These keywords are not case sensitive.

Description

This procedure measures row fragmentation at the default index level. Density is the ratio of the minimum number of pages required by an index for existing table rows to the number of pages actually used by the index. This procedure returns density as a number such that 0 < density < 1. For example, if an index that requires 8 pages minimum storage occupies 10 pages, its density is .8.

The density reported does not indicate the number of disk pages that could be reclaimed by recreating or reorganizing the default index.

This procedure displays information about the row density of a column, but does not recommend further action. You must determine whether or not to recreate, reorganize, or rebuild an index.

Example

The following procedure reports the row density on column order_id in table orders:

dbo.sp_iqrowdensity ( ‘column orders.order_id ‘)

Table

Column

Index Type

Density

orders

order_id

Flat FP

.88