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

SQL Anywhere 12.0.1 » SQL Anywhere Server - SQL Usage » Performance improvements, diagnostics, and monitoring » Application profiling tutorials » Tutorial: Diagnosing index fragmentation


Lesson 2: Identifying and fixing index fragmentation using SQL

You can also identify and fix index fragmentation using SQL.

 Check the index density of a table
  1. In the left pane, click app_profiling - DBA, and then click File » Open Interactive SQL.

    Interactive SQL starts and connects to the app_profiling.db database.

  2. In Interactive SQL, execute the following SQL statement to test the index density on the Employees table:

    CALL sa_index_density( 'Employees' );

    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.


    The values for the indexes on the Employees will appear to show fragmentation issues because the values in the Density column of the results are well under 0.5. However, these numbers are artificially low due to the fact that the table is very small.

  3. In Interactive SQL, execute the following ALTER INDEX...REBUILD statement to improve the density of an index:

 See also