Re: Making joins involving ctid work for the benefit of UPSERT

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Peter Geoghegan <pg(at)heroku(dot)com>
Cc: Andres Freund <andres(at)2ndquadrant(dot)com>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Making joins involving ctid work for the benefit of UPSERT
Date: 2014-07-30 17:36:01
Message-ID: CA+TgmoahK0YeCeocDLja-7E_PYcgyCY7o1S02SV7TF4NHRyaVw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Jul 29, 2014 at 1:28 PM, Peter Geoghegan <pg(at)heroku(dot)com> wrote:
> On Tue, Jul 29, 2014 at 9:56 AM, Robert Haas <robertmhaas(at)gmail(dot)com> wrote:
>> I think it would be advisable to separate the syntax from the
>> implementation. Presumably you can make your implementation use some
>> reasonable syntax we can all agree on, and conversely my proposed
>> syntax could be made to have a different set of semantics. There's
>> some connection between the syntax and semantics, of course, but it's
>> not 100%. I mention this because I was mostly concerned with getting
>> to a reasonable syntax proposal, not so much the implementation
>> details. It may well be that your implementation details are perfect
>> at this point; I don't know because I haven't looked, and I'm not an
>> expert on that area of the code anyway. But I have looked at your
>> syntax, which I wasn't altogether keen on.
>
> Fair enough. I think the syntax should reflect the fact that upserts
> are driven by inserts, though. Users will get into trouble with a
> syntax that allows a predicate that is evaluated before any rows are
> locked.

You've convinced me that only indexable predicates can be sensibly
used here. I'm not sure that's the same as saying that upserts are
driven by inserts, though. I'd tend to interpret that to mean
insert-the-heap-tuple-first, but I think what you're doing is
check-the-indexes-first. The terminology in this area is tricky.

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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2014-07-30 17:46:59 Re: BUG #10823: Better REINDEX syntax.
Previous Message Bruce Momjian 2014-07-30 17:35:55 Re: BUG #10823: Better REINDEX syntax.