From: Mr. Dan <bitsandbytes88@hotmail.com>
To: pgsql-admin@postgresql.org
Subject: table manipulation
Date: Thu, 02 Mar 2006 15:28:15 -0500
Message-ID: <BAY102-F311A5CC2849C98E7BB954CD1F50@phx.gbl> (raw)
I have a large database (20 Gb) on PostgreSQL 8.1.0 where I need to make a
copy of the structure and also copy the data from a few of the tables
(approximately 40 out of 140, resulting database is approximately 10 Mb)
which have dependencies on each other. The problem I am having is finding
the best way to go about this using an automated script. There were a few
options I could think of:
1) copy the whole large database and then truncate the tables I didn't need
(the tables I need have a specific naming scheme). This seems wasteful and
can take up to 5 hours to do.
2) copy the schema from the database and then dump just the tables I want
and restore them on the new database. The problem I run into here is the
inter-dependencies between some of the tables makes this hard to do
programmatically (I could hard code the order list of which tables to fill,
but then what happens when we add more tables?)
Are there other approaches that I'm missing here? I need to do this across
several databases which have basically the same structures and naming
schemes but the dependencies on all of the databases are different. I'm
trying to come up with a generic solution that I can use for all of the
databases without having to maintain the dependencies for each.
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-admin@postgresql.org
Cc: bitsandbytes88@hotmail.com
Subject: Re: table manipulation
In-Reply-To: <BAY102-F311A5CC2849C98E7BB954CD1F50@phx.gbl>
References: <BAY102-F311A5CC2849C98E7BB954CD1F50@phx.gbl>
* 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