Last updated: Nov 26, 2024
You can use the ANALYZE command to collect statistics for a virtual table in object storage.
To collect statistics for a virtual table in object storage, run the following
command.
ANALYZE TABLE schema.table_name
COMPUTE STATISTICS FOR COLUMNS list_of_columns_commonly_used_in_predicates;
If the table has few columns, you can collect statistics for all columns in the table by using
the
FOR ALL COLUMNS
clause. For example, to collect statistics for all columns on
the table schema.tablename
, run the following
command.ANALYZE TABLE schema.tablename
COMPUTE STATISTICS FOR ALL COLUMNS;
If the table has a large amount of data, you can collect statistics on a subset of the data so
that the analyze operation can complete sooner. For example, to collect statistics by using a 10%
sample of the table data, run the following
command.
ANALYZE TABLE schema.tablename
COMPUTE STATISTICS FOR ALL COLUMNS
TABLESAMPLE SYSTEM (10);
For more information, see the ANALYZE command.