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

From Robert Haas
Subject Re: TRUNCATE SERIALIZABLE and frozen COPY
Date
Msg-id CA+TgmoZvrLqXw7ZuvKgSjFtaQ5NDxwOCmUCB5p9gAMfpUBKOww@mail.gmail.com
Whole thread Raw
In response to Re: TRUNCATE SERIALIZABLE and frozen COPY  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: TRUNCATE SERIALIZABLE and frozen COPY  (Simon Riggs <simon@2ndQuadrant.com>)
List pgsql-hackers
On Mon, Nov 12, 2012 at 11:20 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Robert Haas <robertmhaas@gmail.com> writes:
>> On Fri, Nov 9, 2012 at 3:31 PM, Simon Riggs <simon@2ndquadrant.com> wrote:
>>> So what we're talking about here is a new mode for COPY, that when
>>> requested will pre-freeze tuples when loading into a newly
>>> created/truncated table. If the table isn't newly created/truncated
>>> then we'll just ignore it and continue. I see no need to throw an
>>> error, since that will just cause annoying usability issues.
>
>> Actually, why not just have it work always?  If people want to load
>> frozen tuples into a table that's not newly created/truncated, why not
>> let them?  Sure, there could be MVCC violations, but as long as the
>> behavior is opt-in, who cares?  I think it'd be useful to a lot of
>> people.
>
> I thought about that too, but there's a big problem.  It wouldn't be
> just MVCC that would be broken, but transactional integrity: if the
> COPY fails partway through, the already-loaded rows still look valid.
> The new-file requirement provides a way to roll them back.
>
> I'm willing to have an option that compromises MVCC semantics
> transiently, but giving up transactional integrity seems a bit much.

Hmm, good point.  There might be some way around that, but figuring it
out is probably material for a separate patch.

But I guess that raises the question - should COPY (FREEZE) silently
ignore the option for not-new relfilenodes, or should it error out?
Simon proposed the former, but I'm wondering if the latter would be
better.

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



pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: Fwd: question on foreign key lock
Next
From: Tom Lane
Date:
Subject: Re: Further pg_upgrade analysis for many tables