Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
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

pgsql-novice by date

Next:From: Tom LaneDate: 2001-09-20 03:37:56
Subject: Re: VACUUM vs VACUUM ANALYZE vs CLUSTER
Previous:From: Sheldon HearnDate: 2001-09-19 20:04:06
Subject: VACUUM vs VACUUM ANALYZE vs CLUSTER

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group