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

Поиск
Список
Период
Сортировка
От Paul Jungwirth
Тема Re: Determine if an index is a B-tree, GIST, or something else?
Дата
Msg-id CA+6hpak=ekKWkU1NEs-a-YVTz+meLRNVDfgT1ww7ZGvMxEjgOA@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Determine if an index is a B-tree, GIST, or something else?  (Ben Chobot <bench@silentmedia.com>)
Ответы Re: Determine if an index is a B-tree, GIST, or something else?  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
> pg_indexes (not pg_index) seems to have the data you're looking for, unless I misunderstood the question.

That is a lovely table, but I want to get each attribute individually, without having to parse the CREATE INDEX .... statement.

It looks like I was almost there with pg_opclass. This will tell me what kind of index is required for each operator:

    select opcnamespace, opcname, amname from pg_opclass o, pg_am a where o.opcmethod = a.oid;

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?

Thanks,
Paul

В списке pgsql-general по дате отправления:

Предыдущее
От: Devrim GÜNDÜZ
Дата:
Сообщение: Re: Determine if an index is a B-tree, GIST, or something else?
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Determine if an index is a B-tree, GIST, or something else?