Re: ALTER TABLE ... REPLACE WITH

From: Simon Riggs <simon(at)2ndQuadrant(dot)com>
To: Josh Berkus <josh(at)agliodbs(dot)com>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: ALTER TABLE ... REPLACE WITH
Date: 2010-12-15 00:33:34
Message-ID: 1292373214.2737.5178.camel@ebony
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, 2010-12-14 at 16:19 -0800, Josh Berkus wrote:

> Without some means of doing a clone of the table in a single command,
> you've eliminated half the scripting work, but not helped at all with
> the other half.

I'm not trying to eliminate scripting work, I'm trying to minimise the
lock window with a reliable and smooth atomic switcheroo.

> Actually, you know what would be ideal?
>
> REPLACE TABLE old_table WITH SELECT ...
>
> Give it some thought ...

I have; the above would hold the lock window open while the SELECT runs
and that is explicitly something we are trying to avoid.

Good creative input though, thank you.

--
Simon Riggs http://www.2ndQuadrant.com/books/
PostgreSQL Development, 24x7 Support, Training and Services

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Florian Pflug 2010-12-15 00:51:47 Getting "ERROR: no unpinned buffers available" on HEAD, should I investigate?
Previous Message Josh Berkus 2010-12-15 00:19:49 Re: ALTER TABLE ... REPLACE WITH