Skip to main content

ANALYZE TABLE

Compute and delete statistics for tables, including estimated number of distinct values, number of rows, and number of null values.

Syntax
ANALYZE TABLE <table_name>
FOR { ALL COLUMNS | COLUMNS ( <column_name1>, <column_name2>, ... ) }
{ COMPUTE | DELETE } STATISTICS

Parameters

<table_name> String

The path to the table that you want to generate statistics for. The source can be in the scratch directory or a data lake source.


FOR { ALL COLUMNS | COLUMNS ( <column_name1>, <column_name2>, ... )} String

The columns that you want to generate statistics for. You can choose to either include all columns or specify one or more columns for the statistics. If you do not specify the columns, Dremio will compute statistics for all the columns contained in the table. If you want to compute statistics for specific columns, you can specify more than one column by separating each one with a comma.


{ COMPUTE | DELETE } STATISTICS String

Choose to either compute or delete statistics for the specified columns in the table.

Examples

Analyze a table
ANALYZE TABLE Samples."samples.dremio.com"."NYC-taxi-trips"
FOR ALL COLUMNS
COMPUTE STATISTICS
Analyze the specified columns for a table
ANALYZE TABLE Samples."samples.dremio.com"."NYC-taxi-trips"
FOR COLUMNS (fare_amount, tip_amount)
COMPUTE STATISTICS