Data Access
Also available as:
PDF
loading table of contents...
Generating Hive Statistics

The ANALYZE TABLE command generates statistics for tables and columns. The following lines show how to generate different types of statistics on Hive objects.

Gathering table statistics for non-partitioned tables

ANALYZE TABLE [table_name] COMPUTE STATISTICS;

Gathering table statistics for partitioned tables

ANALYZE TABLE [table_name] PARTITION(partition_column) COMPUTE STATISTICS;

Gathering column statistics for the entire table

ANALYZE TABLE [table_name] COMPUTE STATISTICS for COLUMNS [comma_separated_column_list];

Gathering statistics for the partition2 column on a table partitioned on col1 with key x

ANALYZE TABLE partition2 (col1="x") COMPUTE STATISTICS for COLUMNS;