Replace Old Table with New - Mailing list pgsql-novice

From David Lebling
Subject Replace Old Table with New
Date
Msg-id 031001c1414d$da36db80$0201010a@myserver.net
Whole thread Raw
Responses Re: Replace Old Table with New  (Tom Lane <tgl@sss.pgh.pa.us>)
List 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



pgsql-novice by date:

Previous
From: Adam bultman
Date:
Subject: Greetings.
Next
From: Sheldon Hearn
Date:
Subject: VACUUM vs VACUUM ANALYZE vs CLUSTER