Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SQL Anywhere 11.0.1 » SQL Anywhere Server - SQL Usage » Monitoring and Improving Database Performance » Application profiling tutorials » Tutorial: Diagnosing index fragmentation


Lesson 3: Checking the index density of a table

To periodically check the density of indexes for a table, run the sa_index_density system procedure. Density values range between 0 and 1. Values closer to 1 indicate little index fragmentation. Values less than 0.5, indicate a level of index fragmentation that may impact performance.

In Interactive SQL, run the following SQL statement to view the index fragmentation introduced to the fragment table during this tutorial:

CALL sa_index_density( 'fragment' );
TableName TableId IndexName IndexId IndexType LeafPages Density
fragment 736 idx_fragment 1 NUI 1,177 0.597509

Your results might be different, but the Density column value should be approximately 0.6.

In Interactive SQL, run the following SQL statement to improve the density of the index:

ALTER INDEX idx_fragment ON fragment REBUILD;
See also