8.3. ANALYZE

Synopsis

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

Description

Collects table and column statistics for a given table.

The optional WITH clause can be used to provideconnector-specific properties. To list all available properties, run the following query:

  1. SELECT * FROM system.metadata.analyze_properties

Currently, this statement is only supported by theHive connector.

Examples

Analyze table web to collect table and column statistics:

  1. ANALYZE web;

Analyze table stores in catalog hive and schema default:

  1. ANALYZE hive.default.stores;

Analyze partitions '1992-01-01', '1992-01-02' from a Hive partitioned table sales:

  1. ANALYZE hive.default.sales WITH (partitions = ARRAY[ARRAY['1992-01-01'], ARRAY['1992-01-02']]);

Analyze partitions with complex partition key (state and city columns) from a Hive partitioned table customers:

  1. ANALYZE hive.default.customers WITH (partitions = ARRAY[ARRAY['CA', 'San Francisco'], ARRAY['NY', 'NY']]);