Re: How to know the indexes on a Table

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Anirban Pal" <anirban(dot)pal(at)newgen(dot)co(dot)in>
Cc: pgsql-novice(at)postgresql(dot)org, pgsql-general(at)postgresql(dot)org
Subject: Re: How to know the indexes on a Table
Date: 2009-06-05 15:17:59
Message-ID: 4562.1244215079@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-novice

"Anirban Pal" <anirban(dot)pal(at)newgen(dot)co(dot)in> writes:
> Is there any way, to know the name of indexes on a table, defined in a database. I mean can I query something like
> Select Index_name from pg_class where relname = "Table_name" . Thanks in advance.

You need to join through pg_index, specifically its columns indrelid and
indexrelid. Try running psql with the -E option and look at the queries
it uses to implement "\d Table_name".

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Brandon Metcalf 2009-06-05 16:13:12 Re: limit table to one row
Previous Message Nykolyn, Andrew P (AS) 2009-06-05 15:17:09 Upgrade from Postgres 8.2.4 to 8.3.5

Browse pgsql-novice by date

  From Date Subject
Next Message Devrim GÜNDÜZ 2009-06-05 15:22:21 Re: Yum Update Errors
Previous Message John DeSoi 2009-06-05 12:22:06 Re: self-contained db for osx app