The CREATE STATISTICS statement recreates the column statistics that SQL Anywhere uses to optimize database queries, and can
be performed on base tables, materialized views, local temporary tables, and global temporary tables. You cannot create statistics
on proxy tables. Column statistics include histograms, which 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 executing the CREATE STATISTICS statement on 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 executing CREATE STATISTICS performs a complete scan of the table. For this reason, careful consideration should
be made before executing a CREATE STATISTICS statement.
If you drop statistics, it is recommended that you recreate them using the CREATE STATISTICS statement. Without statistics,
the optimizer can generate inefficient data access plans, causing poor database performance.