pg.ddx.io  pgsql-patches@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Stephen Frost <sfrost@snowman.net>
Cc: Simon Riggs <simon@2ndquadrant.com>
Cc: pgsql-patches@postgresql.org
Subject: Re: pg_dump additional options for performance
Date: Sat, 26 Jul 2008 13:43:06 -0400
Message-ID: <24327.1217094186@sss.pgh.pa.us> (raw)
In-Reply-To: <20080726164355.GH16005@tamriel.snowman.net>
References: <20080721115602.GG18846@tamriel.snowman.net>
	<1216831237.3894.676.camel@ebony.2ndQuadrant>
	<1216832987.3894.678.camel@ebony.2ndQuadrant>
	<20080724032047.GI18846@tamriel.snowman.net>
	<1216885031.3894.739.camel@ebony.2ndQuadrant>
	<21687.1216886041@sss.pgh.pa.us>
	<1216889809.3894.747.camel@ebony.2ndQuadrant>
	<2818.1217027784@sss.pgh.pa.us>
	<1217063104.3894.1100.camel@ebony.2ndQuadrant>
	<23540.1217089204@sss.pgh.pa.us>
	<20080726164355.GH16005@tamriel.snowman.net>

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



view thread (54+ messages)  latest in thread

Message-ID: <24327.1217094186@sss.pgh.pa.us>
Permalink:  ../24327.1217094186@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/24327.1217094186@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-patches@postgresql.org
  Cc: tgl@sss.pgh.pa.us, sfrost@snowman.net, simon@2ndquadrant.com
  Subject: Re: pg_dump additional options for performance
  In-Reply-To: <24327.1217094186@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox