List columns with indexes in PostgreSQL

后端 未结 23 1932
我在风中等你
我在风中等你 2020-11-27 09:14

I would like to get the columns that an index is on in PostgreSQL.

In MySQL you can use SHOW INDEXES FOR table and look at the Column_name

23条回答
  •  失恋的感觉
    2020-11-27 09:40

    \d table_name shows this information from psql, but if you want to get such information from database using SQL then have a look at Extracting META information from PostgreSQL.

    I use such info in my utility to report some info from db schema to compare PostgreSQL databases in test and production environments.

提交回复
热议问题