How to list indexes created for table in postgres How to list indexes created for table in postgres postgresql postgresql

How to list indexes created for table in postgres


The view pg_indexes provides access to useful information about each index in the database, eg.

select *from pg_indexeswhere tablename not like 'pg%';


if you're in psql, then:

\d tablename

show Indexes, Foreign Keys and references...


You can use this query:

select tablename,indexname,tablespace,indexdef from pg_indexes where tablename = 'your_table_name';

where has tablename is a field in pg_indexes ,you an get an accurate indices by matching user defined table at 'your_table_name' at WHERE clause . This will give you the desired details.