All Products
Search
Document Center

PolarDB:SHOW INDEX

Last Updated:Aug 25, 2026

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)
Table 1. Column descriptions

Column name

Description

TABLE

The name of the table.

NON_UNIQUE

Indicates whether the global secondary index has a unique constraint. Valid values:

  • 1: regular global secondary index;

  • 0: global secondary index with a unique constraint.

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:

  • A: ascending order;

  • D: descending order;

  • NULL: not sorted.

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:

  • NULL (not specified);

  • BTREE;

  • HASH;

COMMENT

Information about the index. Valid values:

  • NULL: The index is a local index.

  • INDEX: The column is an index column of a global secondary index.

  • COVERING: The column is a covering column of a global secondary index.

INDEX_COMMENT

Other information.