SHOW STATS_HISTOGRAMS

This statement shows the histogram information collected by the ANALYZE statement as part of database statistics.

Currently, the SHOW STATS_HISTOGRAMS statement returns the following columns:

Column nameDescription
Db_nameDatabase name
Table_nameThe table name
Partition_nameThe partition name
Column_nameThe column name
Is_indexWhether it is an index column or not
Update_timeThe update time
Distinct_countThe distinct count
Null_countNULL count
Avg_col_sizeThe average col size
CorrelationCorrelation
Load_statusLoad status, such as allEvicted and allLoaded
Total_mem_usageThe total memory usage
Hist_mem_usageThe historical memory usage
Topn_mem_usageThe TopN memory usage
Cms_mem_usageThe CMS memory usage

Synopsis

ShowStatsHistogramsStmt

SHOW STATS_HISTOGRAMS - 图1

ShowLikeOrWhere

SHOW STATS_HISTOGRAMS - 图2

  1. ShowStatsHistogramsStmt ::=
  2. "SHOW" "STATS_HISTOGRAMS" ShowLikeOrWhere?
  3. ShowLikeOrWhere ::=
  4. "LIKE" SimpleExpr
  5. | "WHERE" Expression

Examples

  1. SHOW STATS_HISTOGRAMS;
  1. +---------+------------+----------------+-------------+----------+---------------------+----------------+------------+--------------+-------------+
  2. | Db_name | Table_name | Partition_name | Column_name | Is_index | Update_time | Distinct_count | Null_count | Avg_col_size | Correlation |
  3. +---------+------------+----------------+-------------+----------+---------------------+----------------+------------+--------------+-------------+
  4. | test | t | | a | 0 | 2020-05-25 19:20:00 | 7 | 0 | 1 | 1 |
  5. | test | t2 | | a | 0 | 2020-05-25 19:20:01 | 6 | 0 | 8 | 0 |
  6. | test | t2 | | b | 0 | 2020-05-25 19:20:01 | 6 | 0 | 1.67 | 1 |
  7. +---------+------------+----------------+-------------+----------+---------------------+----------------+------------+--------------+-------------+
  8. 3 rows in set (0.00 sec)
  1. SHOW STATS_HISTOGRAMS WHERE table_name = 't2';
  1. +---------+------------+----------------+-------------+----------+---------------------+----------------+------------+--------------+-------------+
  2. | Db_name | Table_name | Partition_name | Column_name | Is_index | Update_time | Distinct_count | Null_count | Avg_col_size | Correlation |
  3. +---------+------------+----------------+-------------+----------+---------------------+----------------+------------+--------------+-------------+
  4. | test | t2 | | b | 0 | 2020-05-25 19:20:01 | 6 | 0 | 1.67 | 1 |
  5. | test | t2 | | a | 0 | 2020-05-25 19:20:01 | 6 | 0 | 8 | 0 |
  6. +---------+------------+----------------+-------------+----------+---------------------+----------------+------------+--------------+-------------+
  7. 2 rows in set (0.00 sec)

MySQL compatibility

This statement is a TiDB extension to MySQL syntax.

See also