Re: Unloading a table consistently - Mailing list pgsql-general

From Christophe
Subject Re: Unloading a table consistently
Date
Msg-id 7E808813-4401-4A0B-9857-986918BF5875@thebuild.com
Whole thread Raw
In response to Re: Unloading a table consistently  (ptjm@news-reader-radius.uniserve.com (Patrick TJ McPhee))
List pgsql-general
On May 3, 2008, at 9:29 PM, Patrick TJ McPhee wrote:
> How about something along the lines of
>
> BEGIN;
> ALTER TABLE log RENAME to log_old;
> CREATE TABLE log(...);
> COMMIT;
>
> BEGIN;
> LOCK table log_old;
> COPY log_old TO 'filename-path';
> DROP TABLE log_old;
> COMMIT;
>
> I believe this will keep the writers writing while keeping the
> efficiency
> of truncating.

Brilliant.

pgsql-general by date:

Previous
From: "Dan \"Heron\" Myers"
Date:
Subject: Re: Custom C function - is palloc broken?
Next
From: Magnus Hagander
Date:
Subject: Re: Custom C function - is palloc broken?