pg dump only indexes
pg dump only indexes
PostgreSQL 9.2
Is there a way to use pg_dump to dump just indexes on a database?
Thanks,
Software Architect
Web Services at Public Affairs
217-333-0382
Re: pg dump only indexes
От:
Vibhor Kumar <vibhor.aim@gmail.com>
Дата:
On Dec 16, 2013, at 5:42 PM, Campbell, Lance wrote: > PostgreSQL 9.2 > Is there a way to use pg_dump to dump just indexes on a database? You can use --section=post-data and grep the INDEXES. Or you can use pg_catalog.pg_indexes.indexdef for indexes. http://www.postgresql.org/docs/9.2/static/view-pg-indexes.html Thanks & Regards, Vibhor Kumar Blogs:http://vibhork.blogspot.com http://vibhorkumar.wordpress.com
Re: pg dump only indexes
От:
bricklen <bricklen@gmail.com>
Дата:
On Mon, Dec 16, 2013 at 2:42 PM, Campbell, Lance <lance@illinois.edu> wrote:
PostgreSQL 9.2
Is there a way to use pg_dump to dump just indexes on a database?
I don't think you can do that using pg_dump in 9.2, but you could probably replicate the functionality using a COPY statement.
Eg
COPY (select indexdef||';' as idxdef from pg_indexes where schemaname <> 'pg_catalog' order by 1) TO '/path/to/your/file.sql';
Eg
COPY (select indexdef||';' as idxdef from pg_indexes where schemaname <> 'pg_catalog' order by 1) TO '/path/to/your/file.sql';