Re: Unloading a table consistently

From: Christophe <xof(at)thebuild(dot)com>
To: Patrick TJ McPhee <ptjm(at)news-reader-radius(dot)uniserve(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Unloading a table consistently
Date: 2008-05-04 19:07:39
Message-ID: 7E808813-4401-4A0B-9857-986918BF5875@thebuild.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Magnus Hagander 2008-05-04 19:15:49 Re: Custom C function - is palloc broken?
Previous Message Dan "Heron" Myers 2008-05-04 19:02:49 Re: Custom C function - is palloc broken?