SHOW STATS
Syntax
SHOW STATS FOR table_name;
SHOW STATS FOR (SELECT * FROM table [WHERE condition]);
Remarks
ANALYZE should be performed on the table before SHOW STATS. For details, see ANALYZE. If you run the show stats command on the target table before running ANALYZE, all values are null.
Description
Returns the approximate statistics of a table.
Returns the statistics about each column.
Column |
Description |
---|---|
column_name |
Column Name (Summary Row: NULL) |
data_size |
The total size of all values in the column (in bytes) |
distinct_values_count |
Number of different values in the column |
nulls_fraction |
Fractions whose values are NULL in the column |
row_count |
Number of lines (returned only for summary lines) |
low_value |
Minimum value found in this column (only for some types) |
high_value |
Maximum value found in this column (applicable only to some types) |
Example
SHOW STATS FOR orders; SHOW STATS FOR (SELECT * FROM orders);
- Before analyzing the nation table:
SHOW STATS FOR nation; column_name | data_size | distinct_values_count | nulls_fraction | row_count | low_value | high_value -------------|-----------|-----------------------|----------------|-----------|-----------|------------ name | NULL | NULL | NULL | NULL | NULL | NULL regionkey | NULL | NULL | NULL | NULL | NULL | NULL NULL | NULL | NULL | NULL | 6.0 | NULL | NULL (3 rows)
- After analyzing the nation table:
Analyze nation; ANALYZE: 6 rows -- Query the analysis result. SHOW STATS FOR nation; column_name | data_size | distinct_values_count | nulls_fraction | row_count | low_value | high_value -------------|-----------|-----------------------|----------------|-----------|-----------|------------ name | 45.0 | 5.0 | 0.0 | NULL | NULL | NULL regionkey | NULL | 2.0 | 0.0 | NULL | 0 | 2 NULL | NULL | NULL | NULL | 6.0 | NULL | NULL (3 rows)
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.