Re: Promise index tuples for UPSERT - Mailing list pgsql-hackers

From Simon Riggs
Subject Re: Promise index tuples for UPSERT
Date
Msg-id CA+U5nM+fxN0Hb3FzcmLP4E=t_YjL_s4Moqi6gQ4t7WfFV9t98g@mail.gmail.com
Whole thread Raw
In response to Re: Promise index tuples for UPSERT  (Peter Geoghegan <pg@heroku.com>)
Responses Re: Promise index tuples for UPSERT
Re: Promise index tuples for UPSERT
List pgsql-hackers
On 7 October 2014 03:31, Peter Geoghegan <pg@heroku.com> wrote:

>> It may be that people on reading this now believe Peter's HW locking
>> approach is the best. I'm happy to go with consensus.
>
> I bet you didn't think that you'd say that a week ago.  :-)

You're right, because last week I thought heavyweight locking sucks
and I still think that; I haven't said it is the best.

What we've just discovered is that we're locking 100% of the time, but
its not needed in 99.9% of cases and is arguable in the 0.1% case -
not "required" at all.

The price of avoiding that rare and possibly erroneous condition seems
high to me.

Is there a way of detecting that we are updating a unique constraint
column and then applying the HW locking only in that case? Or can we
only apply locking when we have multiple unique constraints on a
table?
If so, I would withdraw any objection to the HW locking technique.

-- Simon Riggs                   http://www.2ndQuadrant.com/PostgreSQL Development, 24x7 Support, Training & Services



pgsql-hackers by date:

Previous
From: Simon Riggs
Date:
Subject: Re: INSERT ... ON CONFLICT {UPDATE | IGNORE}
Next
From: Heikki Linnakangas
Date:
Subject: pg_upgrade, locale and encoding