Search Postgresql Archives

Re: Extracting Index Creation Script

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





If you know the index name then:
SELECT pg_get_indexdef('your_index_name'::regclass)
will do.

In case you want a full list of indices for a certain table:
SELECT c2.relname, pg_get_indexdef(i.indexrelid, 0, true), c2.reltablespace
  FROM pg_catalog.pg_class c, pg_catalog.pg_class c2, pg_catalog.pg_index i
 WHERE c.oid = 'your_table_name'::regclass AND c.oid = i.indrelid AND i.indexrelid = c2.oid

If you have more questions of that kind try starting psql with -E option which enables internal queries' display (this is what I did).

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux