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
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers