Error 3020

Severity

10 (when sent to a client)
18 (when sent to the Adaptive Server error log)

Message text

Unable to write statistics for index %ld of object %ld in database %ld. Please run update statistics on this index after loading this database or prior to using this index in the loaded database.

Explanation

The systabstats system table stores table- and index-level statistics such as page and row counts, empty pages, number of leaf and non-leaf pages in an index, cluster ratios and average length of data and index rows for each object.

Descriptors are in-memory representations of Adaptive Server objects. Table descriptors contain (among other information) current statistics for the table. Adaptive Server periodically flushes these statistics to systabstats so that queries have access to the most current statistics for a table and its indexes. Statistics are flushed to systabstats during:

Error 3020 is raised when Adaptive Server is unable to flush the statistics for an index to systabstats during a database dump. Since the systabstats on the dump will not contain the latest statistics for the index, a subsequent database load will result in systabstats containing outdated statistics for the index.

This is not a serious error, since the statistics can be readily updated. Queries can run normally even when systabstats does not contain the latest index statistics for the table.

Action

Resolve the issue by running update statistics after loading the database:

  1. Identify the table and object named in the message. To determine the table name, enter:

    1> use <database_name>
    2> go1> select object_name (<object_id>)
    2> go
    

    Where <object_id> is the object identified in the message.

  2. Run update statistics to ensure that the statistics for the index in question are included. Several options are available with update statistics, for example:

    • update statistics <table_name> <index_name>

    • update index statistics <table_name>

    • update index statistics <table_name> <index_name>

The syntax for update statistics appears in the Reference Manual: Commands.

Versions in which this error is raised

Version 11.9.2 and later