Re: TRUNCATE SERIALIZABLE and frozen COPY - Mailing list pgsql-hackers

From Robert Haas
Subject Re: TRUNCATE SERIALIZABLE and frozen COPY
Date
Msg-id CA+TgmoY4D_6X7AGtYU+H54=P0r=jR-n_K=6HeyBzsFbw0TodKA@mail.gmail.com
Whole thread Raw
In response to Re: TRUNCATE SERIALIZABLE and frozen COPY  ("Kevin Grittner" <kgrittn@mail.com>)
List pgsql-hackers
On Fri, Nov 9, 2012 at 9:22 AM, Kevin Grittner <kgrittn@mail.com> wrote:
> (1) Any attempt to read from the truncated table would not block. The
> pg_class version included in the transaction's snapshot would
> determine which heap and indexes were accessed.

Well, the thing is, you can't actually do this.  When the transaction
commits, we truncate the main forks of the old heap and index and
remove all of the supplemental forks.  The main forks are finally
removed for good at the next checkpoint cycle.  To make this work,
we'd have to keep around the old heap and index until there were no
longer any MVCC snapshots that could see them.  That might be useful
as an option, but it would need a bunch of additional mechanism, and
it doesn't seem desirable as a default behavior because it could defer
disk space reclamation indefinitely.

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: TRUNCATE SERIALIZABLE and frozen COPY
Next
From: Robert Haas
Date:
Subject: Re: TRUNCATE SERIALIZABLE and frozen COPY