All Products
Search
Document Center

PolarDB:SHOW GLOBAL INDEX

Last Updated:Mar 28, 2026

Queries the global secondary indexes (GSIs) on a table or across all tables in the current database, including their partition configuration and build status. PolarDB-X 1.0 supports GSIs, which you can view using the SHOW GLOBAL INDEX statement whether they have been fully created or are still being created.

Syntax

SHOW GLOBAL {INDEX | INDEXES} [FROM [schema_name.]tbl_name]

schema_name and tbl_name are optional. Omit them to list GSIs for all tables in the current database. Include schema_name to query a table in a different database.

Examples:

-- List all GSIs in the current database
SHOW GLOBAL INDEX;

-- List GSIs on a specific table in the current database
SHOW GLOBAL INDEX FROM xxx_tb;

-- List GSIs on a table in another database (cross-database query)
SHOW GLOBAL INDEX FROM xxx_db.xxx_tb;

Example output

mysql> show global index;
+---------------------+----------------------+------------+-------------------------------+----------------------------+------------------------------------------------------------------+------------+------------------+---------------------+--------------------+------------------+---------------------+--------------------+----------+
| SCHEMA              | TABLE                | NON_UNIQUE | KEY_NAME                      | INDEX_NAMES                | COVERING_NAMES                                                   | INDEX_TYPE | DB_PARTITION_KEY | DB_PARTITION_POLICY | DB_PARTITION_COUNT | TB_PARTITION_KEY | TB_PARTITION_POLICY | TB_PARTITION_COUNT | STATUS   |
+---------------------+----------------------+------------+-------------------------------+----------------------------+------------------------------------------------------------------+------------+------------------+---------------------+--------------------+------------------+---------------------+--------------------+----------+
| XXXX_DRDS_LOCAL_APP | full_gsi_ddl_renamed | 1          | g_i_c_ddl_c_blob_long_renamed | c_blob_long                | id, c_bit_1, c_bit_8, c_bit_16, c_bit_32, c_bit_64, c_tinyint_1, c_tinyint_1_un, c_tinyint_4, c_tinyint_4_un, c_tinyint_8, c_tinyint_8_un, c_smallint_16, c_smallint_16_un, c_mediumint_1, c_mediumint_24, c_mediumint_24_un, c_int_1, c_int_32, c_int_32_un, c_bigint_1, c_bigint_64, c_bigint_64_un, c_decimal, c_decimal_pr, c_float, c_float_pr, c_float_un, c_double, c_double_pr, c_double_un, c_date, c_datetime, c_datetime_3, c_datetime_6, c_timestamp_1, c_timestamp_3, c_time, c_time_1, c_time_3, c_time_6, c_year, c_year_4, c_char, c_varchar, c_binary, c_varbinary, c_blob_tiny, c_blob_medium, c_text_tiny, c_text, c_text_medium, c_text_long, c_enum, c_set, c_json, c_point, c_linestring, c_polygon, c_multipoint, c_multilinestring, c_multipolygon, c_geometrycollection, c_geometory | NULL       | c_blob_long      | HASH                | 4                  | c_blob_long      | HASH                | 3                  | PUBLIC   |
| XXXX_DRDS_LOCAL_APP | full_gsi_ddl_renamed | 1          | g_i_c_ddl_c_mediumint_1       | c_mediumint_1              | id, c_bit_1, c_bit_8, c_bit_16, c_bit_32, c_bit_64, c_tinyint_1, c_tinyint_1_un, c_tinyint_4, c_tinyint_4_un, c_tinyint_8, c_tinyint_8_un, c_smallint_16, c_smallint_16_un, c_mediumint_24, c_mediumint_24_un, c_int_1, c_int_32, c_int_32_un, c_bigint_1, c_bigint_64, c_bigint_64_un, c_decimal, c_decimal_pr, c_float, c_float_pr, c_float_un, c_double, c_double_pr, c_double_un, c_date, c_datetime, c_datetime_3, c_datetime_6, c_timestamp_1, c_timestamp_3, c_time, c_time_1, c_time_3, c_time_6, c_year, c_year_4, c_char, c_varchar, c_binary, c_varbinary, c_blob_tiny, c_blob_medium, c_blob_long, c_text_tiny, c_text, c_text_medium, c_text_long, c_enum, c_set, c_json, c_point, c_linestring, c_polygon, c_multipoint, c_multilinestring, c_multipolygon, c_geometrycollection, c_geometory, c_smallint_1, c_timestamp_6 | NULL       | c_mediumint_1    | HASH                | 4                  | c_mediumint_1    | HASH                | 3                  | PUBLIC   |
| XXXX_DRDS_LOCAL_APP | full_gsi_ddl_renamed | 1          | g_i_c_ddl_c_smallint_16_un    | c_smallint_16_un, c_time_1 | id, c_bit_1, c_bit_8, c_bit_16, c_bit_32, c_bit_64, c_tinyint_1, c_tinyint_1_un, c_tinyint_4, c_tinyint_4_un, c_tinyint_8, c_tinyint_8_un, c_smallint_16, c_mediumint_1, c_mediumint_24, c_mediumint_24_un, c_int_1, c_int_32, c_int_32_un, c_bigint_1, c_bigint_64, c_bigint_64_un, c_decimal, c_decimal_pr, c_float, c_float_pr, c_float_un, c_double, c_double_pr, c_double_un, c_date, c_datetime, c_datetime_3, c_datetime_6, c_timestamp_1, c_timestamp_3, c_time, c_time_3, c_time_6, c_year, c_year_4, c_char, c_varchar, c_binary, c_varbinary, c_blob_tiny, c_blob_medium, c_blob_long, c_text_tiny, c_text, c_text_medium, c_text_long, c_enum, c_set, c_json, c_point, c_linestring, c_polygon, c_multipoint, c_multilinestring, c_multipolygon, c_geometrycollection, c_geometory                           | NULL       | c_smallint_16_un | HASH                | 4                  | c_smallint_16_un | HASH                | 3                  | PUBLIC   |
| XXXX_DRDS_LOCAL_APP | t_order              | 0          | g_i_seller                    | seller_id                  | id, order_id                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             | HASH       | seller_id        | HASH                | 4                  | seller_id        | HASH                | 2                  | CREATING |
+---------------------+----------------------+------------+-------------------------------+----------------------------+------------------------------------------------------------------+------------+------------------+---------------------+--------------------+------------------+---------------------+--------------------+----------+
4 rows in set (0.01 sec)

Output columns

ColumnDescription
SCHEMAThe name of the database.
TABLEThe name of the table.
NON_UNIQUEWhether the GSI enforces uniqueness. 1 = common GSI (non-unique); 0 = unique GSI.
KEY_NAMEThe name of the index.
INDEX_NAMESThe index column(s).
COVERING_NAMESThe covering column(s) — additional columns stored in the index to avoid lookups on the primary table.
INDEX_TYPEThe index type. Valid values: NULL (not specified), BTREE, HASH.
DB_PARTITION_KEYThe database partition key — the column used to distribute data across database shards.
DB_PARTITION_POLICYThe sharding function applied to the database partition key (for example, HASH).
DB_PARTITION_COUNTThe number of database shards.
TB_PARTITION_KEYThe table partition key — the column used to distribute data across table shards within each database shard.
TB_PARTITION_POLICYThe sharding function applied to the table partition key.
TB_PARTITION_COUNTThe number of table shards.
STATUSThe build status of the GSI. See GSI status values.

GSI status values

Valid values: CREATING, DELETE_ONLY, WRITE_ONLY, WRITE_REORG, PUBLIC, ABSENT.