Re: Dump a database excluding one table DATA?

From: Adrian Klaver <adrian(dot)klaver(at)gmail(dot)com>
To: dmitry(at)koterov(dot)ru
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Dump a database excluding one table DATA?
Date: 2011-08-19 14:05:37
Message-ID: 201108190705.37995.adrian.klaver@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thursday, August 18, 2011 3:25:59 pm Dmitry Koterov wrote:
> Mmm, --disable-triggers is not surely enough - we also have RULEs and (much
> worse) INDEXes.
>
> If we create all indices and then restore all data, it is MUCH SLOWER than
> restore the data first and then - create all indices.
> So I think that there is no work-around really...

Yes there is. Do the schema only dump of the table in question, comment out the
Indexes and rules you don't want. Load the data. Go back to the schema dump
comment out the table and uncomment the Indexes/rules,etc .
Or
Write a script that does the same thing automatically.

>
> I propose to include an option to pg_dump to skip several tables data
> restoration. :-)
>

I thought you where looking to exclude only one table. As you found out the
dependency issues for one table can be a problem. Doing more than one makes the
process even more brittle.

--
Adrian Klaver
adrian(dot)klaver(at)gmail(dot)com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Vincent de Phily 2011-08-19 15:32:42 Re: altering foreign key without a table scan
Previous Message Andy Colson 2011-08-19 14:04:20 Re: Getting value of bind variables