SHOW INDEX returns index information for a table or database.
Required privileges
The user must have any on the target table or database.Aliases
In CockroachDB, the following are aliases forSHOW INDEX:
SHOW INDEXESSHOW KEYS
Synopsis
Parameters
| Parameter | Description |
|---|---|
table\_name | The name of the table for which to show indexes. |
database\_name | The name of the database for which to show indexes. |
Response
The following fields are returned for each column in each index.| Field | Description |
|---|---|
table\_name | The name of the table. |
index\_name | The name of the index. |
non\_unique | Whether values in the indexed column are unique. Possible values: true or false. |
seq\_in\_index | The position of the column in the index, starting with 1. |
column\_name | The indexed column. |
direction | How the column is sorted in the index. Possible values: ASC or DESC for indexed columns; N/A for stored columns. |
storing | Whether the STORING clause was used to index the column during . Possible values: true or false. |
implicit | Whether the column is part of the index despite not being explicitly included during . Possible values: true or false columns are the only columns implicitly included in secondary indexes. The inclusion of primary key columns improves performance when retrieving columns not in the index. |
visible | Whether the index is visible to the . |
index_name column is {tbl}_pkey and value of the storing column is false.
Example
Setup
To follow along, run to start a temporary, in-memory cluster with the sample dataset preloaded:Show indexes for a table
index_name column is users_pkey and value of the storing column is false, and thus are in the primary key, are city and id.

