1

The pg_index table gives info on indexes, it doesn't seem to have a column describing the index type (btree, hash, gin, etc...)

What is the correct way of knowing an existing index type?

1 Answer 1

1

The access method of an index is defined in the catalog pg_am, pointed by the column relam of the catalog pg_class, e.g.:

select c.relname, a.amname
from pg_index i
join pg_class c on c.oid = i.indexrelid
join pg_am a on a.oid = c.relam
where relnamespace = 'public'::regnamespace;

       relname        | amname 
----------------------+--------
 array_test_arr_idx   | gin
 students_topics_pkey | btree
 images_pkey          | btree
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.