Once you create a table and load data into it (e.g.,
IMPORT), table statistics can be generated. Table statistics help the cost-based optimizer determine the cardinality of the rows used in each query, which helps to predict more accurate costs.
This is an experimental feature. The interface and output are subject to change.
CREATE STATISTICS is used, a new statistic is created without removing any old statistics. To delete statistics for all tables in all databases, use
The user must have the
CREATE privilege on the parent database.
|The name of the statistic you are creating.
|The name of the column you want to create the statistic for.
|The name of the table you want to create the statistic for.
> CREATE STATISTICS students ON id FROM students_by_list;
Multi-column statistics are not supported yet.
Delete all statistics
To delete statistics for all tables in all databases:
> DELETE FROM system.table_statistics WHERE true;
For more information, see