List all indexes on a table
Read-only
What do risk levels mean?
- Read-only
- Inspects state without changing anything.
- Low risk
- Reversible with a routine follow-up command.
- Medium risk
- Changes state; undo path documented.
- Destructive
- Deletes or overwrites; confirmation required.
Shows every index defined on a table including column coverage, type, and size so you can evaluate query performance and index overhead.
postgresqlindexesperformanceinspect
Parameters
Name of the table to inspect.
Commands
List every index associated with the table
psql -c "\di <table_name>*"Verification
psql -c "SELECT indexname FROM pg_indexes WHERE tablename = '<table_name>';"Every index on the table is listed by name.
Undo
Not undoable
This recipe only reads catalog metadata and changes nothing.
Pitfalls
- \di uses glob patterns; add quotes around names with special characters.
- Indexes created by primary key and unique constraints are included.
- An index may exist but be invalid (e.g., after a failed concurrent build); check pg_index.indisvalid.