Re: Determine if an index is a B-tree, GIST, or something else?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Paul Jungwirth <pj(at)illuminatedcomputing(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Determine if an index is a B-tree, GIST, or something else?
Date: 2013-01-17 19:14:05
Message-ID: 15275.1358450045@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Paul Jungwirth <pj(at)illuminatedcomputing(dot)com> writes:
> So in principle I can just join pg_index, pg_opclass, and pg_am to get my
> answer. It's actually a little more complicated because pg_index.indclass
> is not an oid, but an oidvector, with one entry for each column in the
> index. But unless I'm mistaken, every column in given index must use the
> same index method. For instance in a 2-column index you can't say `USING
> (btree, gist)`. So I can join with `pg_index.indclass[0] = pg_opclass.oid`.
> Can anyone confirm for me that for any index, every pg_opclass it uses will
> have the same pg_am?

pg_opclass seems the hard way --- just use pg_class.relam, which is the
OID of the index's AM. (And yes, all the opclasses had better match
that.)

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Paul Jungwirth 2013-01-17 19:49:37 Re: Determine if an index is a B-tree, GIST, or something else?
Previous Message Paul Jungwirth 2013-01-17 18:28:01 Re: Determine if an index is a B-tree, GIST, or something else?