STATS_TOPNを表示
SHOW STATS_TOPN文は統計の Top-N 情報を表示します。
現在、 SHOW STATS_TOPNステートメントは次の列を返します。
| カラム名 | 説明 | 
|---|---|
| Db_name | データベース名 | 
| Table_name | テーブル名 | 
| Partition_name | パーティション名 | 
| Column_name | 列名( is_indexが0場合)またはインデックス名(is_indexが1場合) | 
| Is_index | インデックス列であるかどうか | 
| Value | この列の値 | 
| Count | 値が何回出現するか | 
概要
- ShowStatsTopnStmt
- ShowLikeOrWhere
ShowStatsTopnStmt ::=
    "SHOW" "STATS_TOPN" ShowLikeOrWhere?
ShowLikeOrWhere ::=
    "LIKE" SimpleExpr
|   "WHERE" Expression
例
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の互換性
このステートメントは、MySQL 構文に対する TiDB 拡張です。