SHOW COLUMN_STATS_USAGE

The SHOW COLUMN_STATS_USAGE statement shows the last usage time and collection time of column statistics. You can also use it to locate PREDICATE COLUMNS and columns on which statistics have been collected.

Currently, the SHOW COLUMN_STATS_USAGE statement returns the following columns:

Column nameDescription
Db_nameThe database name
Table_nameThe table name
Partition_nameThe partition name
Column_nameThe column name
Last_used_atThe last time when the column statistics were used in the query optimization
Last_analyzed_atThe last time when the column statistics were collected

Synopsis

ShowColumnStatsUsageStmt

SHOW COLUMN_STATS_USAGE - 图1

ShowLikeOrWhere

SHOW COLUMN_STATS_USAGE - 图2

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

Examples

  1. SHOW COLUMN_STATS_USAGE;
  1. +---------+------------+----------------+-------------+--------------+---------------------+
  2. | Db_name | Table_name | Partition_name | Column_name | Last_used_at | Last_analyzed_at |
  3. +---------+------------+----------------+-------------+--------------+---------------------+
  4. | test | t1 | | id | NULL | 2024-05-10 11:04:23 |
  5. | test | t1 | | b | NULL | 2024-05-10 11:04:23 |
  6. | test | t1 | | pad | NULL | 2024-05-10 11:04:23 |
  7. | test | t | | a | NULL | 2024-05-10 11:37:06 |
  8. | test | t | | b | NULL | 2024-05-10 11:37:06 |
  9. +---------+------------+----------------+-------------+--------------+---------------------+
  10. 5 rows in set (0.00 sec)

MySQL compatibility

This statement is a TiDB extension to MySQL syntax.

See also