SHOW INDEX
You can execute the SHOW INDEX statement to view local secondary indexes and global secondary indexes of tables in PolarDB-X.
Syntax
SHOW {INDEX | INDEXES | KEYS}
{FROM | IN} tbl_name
[{FROM | IN} db_name]
[WHERE expr]
Examples
SHOW INDEX FROM t_order;
+--------------+------------+-----------+--------------+----------------+-----------+-------------+----------+--------+------+------------+----------+---------------+
| TABLE | NON_UNIQUE | KEY_NAME | SEQ_IN_INDEX | COLUMN_NAME | COLLATION | CARDINALITY | SUB_PART | PACKED | NULL | INDEX_TYPE | COMMENT | INDEX_COMMENT |
+--------------+------------+-----------+--------------+----------------+-----------+-------------+----------+--------+------+------------+----------+---------------+
| t_order | 0 | PRIMARY | 1 | id | A | 0 | NULL | NULL | | BTREE | | |
| t_order | 1 | l_i_order | 1 | order_id | A | 0 | NULL | NULL | YES | BTREE | | |
| t_order | 0 | g_i_buyer | 1 | buyer_id | NULL | 0 | NULL | NULL | YES | GLOBAL | INDEX | |
| t_order | 1 | g_i_buyer | 2 | id | NULL | 0 | NULL | NULL | | GLOBAL | COVERING | |
| t_order | 1 | g_i_buyer | 3 | order_id | NULL | 0 | NULL | NULL | YES | GLOBAL | COVERING | |
| t_order | 1 | g_i_buyer | 4 | order_snapshot | NULL | 0 | NULL | NULL | YES | GLOBAL | COVERING | |
+--------------+------------+-----------+--------------+----------------+-----------+-------------+----------+--------+------+------------+----------+---------------+
6 rows in set (0.01 sec)
Column | Description |
---|---|
TABLE | The table name. |
NON_UNIQUE | Indicates whether the index is a unique global secondary index. Valid values:
|
KEY_NAME | The index name. |
SEQ_IN_INDEX | The ordinal number of the index key column in the index. The value starts from 1. |
COLUMN_NAME | The name of the index key column. |
COLLATION | The sorting order. Valid values:
|
CARDINALITY | The estimated number of unique values. |
SUB_PART | The prefix of the index. NULL indicates that the prefix of the index is the entire column name. |
PACKED | The information about field compression. NULL indicates that compression is not applied. |
NULL | Indicates whether the column can be empty. |
INDEX_TYPE | The index type. Valid values:
|
COMMENT | The information about the index. Valid values:
|
INDEX_COMMENT | Other information about the index. |