I am using this query to try to get all the indexes that a table of a Postgre daabase contains but I am getting an error. What's the query to do it?
SHOW INDEXES FROM table_name
I am using this query to try to get all the indexes that a table of a Postgre daabase contains but I am getting an error. What's the query to do it?
SHOW INDEXES FROM table_name
PostgreSQL does not provide a command like SHOW INDEXES
to list the index information of a table or database.
However, it does provide you with access to the pg_indexes
view so that you can query the index information.
If you use psql
to access the PostgreSQL database, you can use the \d
command to view the index information for a table.
You could try something like this:
SELECT
indexname,
indexdef
FROM
pg_indexes
WHERE
tablename = 'table_name';