You can use the SHOW INDEX statement to view information about the local indexes, global indexes, and columnar indexes on a PolarDB-X table.
Syntax
SHOW {INDEX | INDEXES | KEYS}
{FROM | IN} tbl_name
[{FROM | IN} db_name]
[WHERE expr]
Example
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 name |
Description |
TABLE |
The name of the table. |
NON_UNIQUE |
Indicates whether the global secondary index has a unique constraint. Valid values:
|
KEY_NAME |
The name of the index. |
SEQ_IN_INDEX |
The ordinal number of the index column within the index, starting from 1. |
COLUMN_NAME |
The name of the index column. |
COLLATION |
The sorting method. Valid values:
|
CARDINALITY |
The estimated number of unique values. |
SUB_PART |
The index prefix. A NULL value indicates that the prefix is the entire column. |
PACKED |
Information about how the field is compressed. A NULL value indicates no compression. |
NULL |
Indicates whether null values are allowed. |
INDEX_TYPE |
The index type. Valid values:
|
COMMENT |
Information about the index. Valid values:
|
INDEX_COMMENT |
Other information. |