Replace Old Table with New

From: "David Lebling" <dlebling(at)ucentric(dot)com>
To: <pgsql-novice(at)postgresql(dot)org>
Subject: Replace Old Table with New
Date: 2001-09-19 20:58:36
Message-ID: 031001c1414d$da36db80$0201010a@myserver.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

I have a set of tables that periodically need to be thrown away and
completely rebuilt with new data. I'm using JDBC to interact with
PostgreSQL.

Is there a straightforward and efficient way to do this?

I tried using the commit/rollback methods in JDBC but blew Java memory out
of the water (these are decent-sized but not enormous datasets: 60,000
records more or less).

I investigated using 'alter table ... rename to ...' but it didn't seem to
also rename the associated indexes, and before actually implementing code to
do it I want to ask if that would actually work. (If it did it would be the
best way to go, as I have plenty of disk space available for an extra temp
copy of the database).

The tables are very simple, with primary keys and in one case a supplemental
additional index.

Any advice would be appreciated.

Dave Lebling
Ucentric Systems, LLC

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Tom Lane 2001-09-20 03:37:56 Re: VACUUM vs VACUUM ANALYZE vs CLUSTER
Previous Message Sheldon Hearn 2001-09-19 20:04:06 VACUUM vs VACUUM ANALYZE vs CLUSTER