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

SQL Anywhere 10.0.1 » SQL Anywhere Server - SQL Reference » SQL Statements

CREATE SERVICE statement Next Page


Recreates the column statistics used by the optimizer, and stores them in the ISYSCOLSTAT system table.


CREATE STATISTICS table-name [ ( column-list ) ]


The CREATE STATISTICS statement recreates the column statistics that SQL Anywhere uses to optimize database queries, and can be performed on base tables, local temporary tables, and global temporary tables. You cannot create statistics on proxy tables. Column statistics reflect the distribution of data in the database for the specified columns. By default, column statistics are automatically created for tables with five or more rows.

In rare circumstances, when your database queries are very variable, and when data distribution is not uniform or the data is changing frequently, you can improve performance by running the CREATE STATISTICS statement against a table or column.

When executing, the CREATE STATISTICS statement updates existing column statistics regardless of the size of the table, unless the table is empty, in which case nothing is done. If column statistics exist for an empty table, they remain unchanged by the CREATE STATISTICS statement. To remove column statistics for an empty table, execute the DROP STATISTICS statement.

The process of running CREATE STATISTICS performs a complete scan of the table.

The CREATE STATISTICS statement should be used only in rare circumstances.


Must have DBA authority.

Side effects

Query plans may change.

See also
Standards and compatibility