This topic describes how to query indexes.
You can execute the SHOW INDEX statement to query the indexes of a table.
Example: Query the indexes of the test table.
obclient> SHOW INDEX FROM test;
+-------------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+-----------+---------------+---------+
| Table | Non_unique | Key_name | Seq_in_index | Column_name | Collation | Cardinality | Sub_part | Packed | Null | Index_type | Comment | Index_comment | Visible |
+-------------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+-----------+---------------+---------+
| test | 0 | PRIMARY | 1 | w_id | A | NULL | NULL | NULL | | BTREE | available | | YES |
| test | 0 | w_name | 1 | w_name | A | NULL | NULL | NULL | YES | BTREE | available | | YES |
| test | 0 | w_name | 2 | w_city | A | NULL | NULL | NULL | YES | BTREE | available | | YES |
+-------------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+-----------+---------------+---------+
3 rows in set
Parameters:
Seq_in_index: the sequence number of the column in the composite index. In this example, the sequence numbers include 1 and 2.Column_name: the name of the indexed column.Non_unique: The value is 0 if the index cannot contain duplicate values, and is 1 if it can contain duplicate values. This parameter indicates whether the index is a unique index.Collation: the way in which columns are stored in the index.Cardinality: the estimated number of unique values in the index.Sub_part: the number of indexed characters if the column is partially indexed. The value is NULL if the entire column is indexed.Packed: the way in which keywords are compressed. The value is NULL if keywords are not compressed.Index_type: the index type.