Re: pg_dump additional options for performance - Mailing list pgsql-patches

From Tom Lane
Subject Re: pg_dump additional options for performance
Date
Msg-id 24327.1217094186@sss.pgh.pa.us
Whole thread Raw
In response to Re: pg_dump additional options for performance  (Stephen Frost <sfrost@snowman.net>)
Responses Re: pg_dump additional options for performance  ("Joshua D. Drake" <jd@commandprompt.com>)
Re: pg_dump additional options for performance  (Stephen Frost <sfrost@snowman.net>)
List pgsql-patches
Stephen Frost <sfrost@snowman.net> writes:
> * Tom Lane (tgl@sss.pgh.pa.us) wrote:
>> This argument is nonsense.  The typical usage of this capability, IMHO,
>> will be
>>
>> pg_dump -Fc >whole.dump
>> pg_restore --schema-before-data whole.dump >before.sql
>> pg_restore --data-only whole.dump >data.sql
>> pg_restore --schema-after-data whole.dump >after.sql
>>
>> followed by editing the schema pieces and then loading.

> I dislike, and doubt that I'd use, this approach.  At the end of the
> day, it ends up processing the same (very large amount of data) multiple
> times.

Well, that's easily avoided: just replace the third step by restoring
directly to the target database.

pg_restore --schema-before-data whole.dump >before.sql
edit before.sql
pg_restore --schema-after-data whole.dump >after.sql
edit after.sql
psql -f before.sql target_db
pg_restore --data-only -d target_db whole.dump
psql -f after.sql target_db

            regards, tom lane

pgsql-patches by date:

Previous
From: Simon Riggs
Date:
Subject: Re: pg_dump additional options for performance
Next
From: Tom Lane
Date:
Subject: Re: pg_dump additional options for performance