Skip to main content
The 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 for SHOW INDEX:
  • SHOW INDEXES
  • SHOW KEYS

Synopsis

show_indexes syntax diagram

Parameters

Response

The following fields are returned for each column in each index. A column is in the primary key if the value of 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

In this example, the columns where the value of the 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.

Show indexes for a database

See also