Re: Is there any way to import a portion of a large database - Mailing list pgsql-general

From Craig Ringer
Subject Re: Is there any way to import a portion of a large database
Date
Msg-id 4E783581.5040508@ringerc.id.au
Whole thread Raw
In response to Is there any way to import a portion of a large database  (AI Rumman <rummandba@gmail.com>)
List pgsql-general
On 09/20/2011 02:35 PM, AI Rumman wrote:
> I have a production Postgresql 9 database of 2 TB+. For development
> purpose, I have to import this database in development server where I
> have only 1 TB of disk space. No more space can be added at present.
> Is there any way so that I might import the whole schema definition of
> the database with a portion of data in my development server?

You can do a schema-only dump and restore that, but as for the data ...
that's something you really have to figure out yourself. PostgreSQL
can't just randomly select rows to export, because there will be foreign
key relationships that would prevent successful restoration.
Additionally, in most databases some tables will have to be exported in
their entirety, as they'll contain lookup tables or other data the app
requires.

There are ETL tools like Talend that may be able to help simplify this.
I haven't looked into them. Personally for simpler databases I'd
probably just hack something together using an appropriate scripting
language and COPY (SELECT...).

--
Craig Ringer

pgsql-general by date:

Previous
From: AI Rumman
Date:
Subject: Is there any way to import a portion of a large database
Next
From: John R Pierce
Date:
Subject: Re: Is there any way to import a portion of a large database