📣

TiDB Cloud Serverless 现已更名为
Starter
!此页面由 AI 自动翻译,英文原文请见
此处。

SHOW STATS_TOPN

SHOW STATS_TOPN 语句显示 统计信息 中的 Top-N 信息。

目前,SHOW STATS_TOPN 语句返回以下列:

列名描述
Db_name数据库名称
Table_name表名称
Partition_name分区名称
Column_name列名称(当 is_index0 时)或索引名称(当 is_index1 时)
Is_index是否为索引列
Value该列的值
Count该值出现的次数

概要

ShowStatsTopnStmt
SHOWSTATS_TOPNShowLikeOrWhere
ShowLikeOrWhere
LIKESimpleExprWHEREExpression

示例

SHOW STATS_TOPN WHERE Table_name='t';
+---------+------------+----------------+-------------+----------+--------------------------+-------+ | Db_name | Table_name | Partition_name | Column_name | Is_index | Value | Count | +---------+------------+----------------+-------------+----------+--------------------------+-------+ | test | t | | a | 0 | 2023-12-27 00:00:00 | 1 | | test | t | | a | 0 | 2023-12-28 00:00:00 | 1 | | test | t | | ia | 1 | (NULL, 2) | 1 | | test | t | | ia | 1 | (NULL, 4) | 1 | | test | t | | ia | 1 | (2023-12-27 00:00:00, 1) | 1 | | test | t | | ia | 1 | (2023-12-28 00:00:00, 3) | 1 | +---------+------------+----------------+-------------+----------+--------------------------+-------+ 6 rows in set (0.00 sec)

MySQL 兼容性

该语句是 TiDB 对 MySQL 语法的扩展。

相关链接

文档内容是否有帮助?