DBAtlas · Database operations atlas

List a table's indexes

Oracle

SELECT index_name, column_name, column_position
FROM user_ind_columns
WHERE table_name = 'EMPLOYEE'
ORDER BY index_name, column_position;

Join with user_indexes for index type/uniqueness.

PostgreSQL

SELECT indexname, indexdef
FROM pg_indexes
WHERE tablename = 'customer';

indexdef gives the full CREATE INDEX statement; \d customer in psql also lists them.

MySQL

SHOW INDEX FROM customer;

The Non_unique, Seq_in_index and Cardinality columns show index structure and selectivity.

SQL Server

EXEC sp_helpindex 'dbo.customer';
-- Details: join sys.indexes + sys.index_columns

sp_helpindex returns index name, type and columns; use the sys views for filtered/included columns.

MongoDB

db.customer.getIndexes()

Returns each index's keys and options such as uniqueness and TTL/partial.

Redis

# Not applicable (core). If the RediSearch module is present:
# FT._LIST        (all indexes)
# FT.INFO idx     (details of one index)

The key-value model has no secondary indexes; they come only with modules such as RediSearch/RedisJSON.

Open in DBAtlas →