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
SHOWCOLUMN_STATS_USAGEShowLikeOrWhere
ShowLikeOrWhere
LIKESimpleExprWHEREExpression

Examples

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

MySQL compatibility

This statement is a TiDB extension to MySQL syntax.

See also

Was this page helpful?