Updated on 2024-12-13 GMT+08:00

ANALYZE

Syntax

ANALYZE table_name [ WITH ( property_name = expression [, ...] ) ]

Description

This statement is used to collects statistics on tables and columns in a specified table.

The WITH clause is optional and can be used to specify connector properties. Run the SELECT * FROM system.metadata.analyze_properties command to list all available properties. Currently, only the Hive connector supports this property.

Example

  • Collect the statistics of table fruit:
    ANALYZE fruit;
  • To collect statistics on table storage in catalog hive and schema default:
    ANALYZE hive.default.orders;
  • Collect information about the 2020-07-17 and 2020-07-18 partitions from the Hive partition table:
    ANALYZE hive.web.page_views WITH (partitions = ARRAY[ARRAY['2020-07-17','US'], ARRAY['2020-07-18','US']]);