Re: INSERT ... ON CONFLICT IGNORE (and UPDATE) 3.0

From: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>
To: Peter Geoghegan <pg(at)heroku(dot)com>, Andres Freund <andres(at)2ndquadrant(dot)com>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>, Stephen Frost <sfrost(at)snowman(dot)net>, Bruce Momjian <bruce(at)momjian(dot)us>, Jeff Janes <jeff(dot)janes(at)gmail(dot)com>
Subject: Re: INSERT ... ON CONFLICT IGNORE (and UPDATE) 3.0
Date: 2015-03-31 12:09:44
Message-ID: 551A8E88.8030403@iki.fi
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 03/30/2015 07:20 PM, Peter Geoghegan wrote:
>
>> >* I think we should decouple the insertion and wal logging more. I think
>> > the promise tuple insertion should be different from the final
>> > insertion of the actual tuple. For one it seems cleaner to me, for
>> > another it will avoid the uglyness around logical decoding. I think
>> > also that the separation will make it more realistic to use something
>> > like this for a COPY variant that doesn't raise unique violations and
>> > such.
> Your COPY argument swung this for me. I'm looking into the implementation.

I'm pretty sceptical of that. ISTM you'll need to do modify the page
twice for each insertion, first to insert the promise tuple, and then to
turn the promise tuple into a real tuple. And WAL-log both updates.
That's going to hurt performance.

To recover COPY from unique violations, you can just do the same as
INSERT ON CONFLICT IGNORE does, and super-delete the inserted tuple on
conflict. To recover from any random error, you'll need to abort the
(sub)transaction anyway, and I don't see how it helps to separate the
insertion of the promise tuple and the "finalization" of the insertion.

- Heikki

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Heikki Linnakangas 2015-03-31 12:24:23 Re: Cleanup double semicolons at the end of source lines
Previous Message Heikki Linnakangas 2015-03-31 11:59:43 Re: WIP: SCRAM authentication