Re: [HACKERS] Predicate Locks for writes? - Mailing list pgsql-hackers

From Alexander Korotkov
Subject Re: [HACKERS] Predicate Locks for writes?
Date
Msg-id CAPpHfdsJ41UdHvk1f6J7XBV6rcexLdUairujmMt9JNxQgk7gsQ@mail.gmail.com
Whole thread Raw
In response to Re: [HACKERS] Predicate Locks for writes?  (Robert Haas <robertmhaas@gmail.com>)
List pgsql-hackers
On Wed, Oct 11, 2017 at 7:27 PM, Robert Haas <robertmhaas@gmail.com> wrote:
On Wed, Oct 11, 2017 at 11:51 AM, Simon Riggs <simon@2ndquadrant.com> wrote:
> I'm inclined to believe Robert's hypothesis that there is some race
> condition there.
>
> The question is whether that still constitutes a serializability
> problem since we haven't done anything with the data, just passed it
> upwards to be modified.

Well, the question is whether passing it upwards constitutes reading
it.  I kind of suspect it does.  The plan tree isn't just blindly
propagating values upward but stuff with them.  There could be quite a
bit between the ModifyTable node and the underlying scan if DELETE ..
FROM or UPDATE .. USING is in use.

Right.  In general we can't skip SIReadLock just basing on the fact that we're under ModifyTable node.
It seems still possible for me to skip SIReadLock in some very limited (but probably typical) cases.
But before analyzing this deeper, it would be nice to estimate possible benefits.  
We can try some broken version which skip all SIReadLock's under ModifyTable node and benchmark it.
If it wouldn't have significant performance benefit, then there is no reason to do something further...

------
Alexander Korotkov
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company 

pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: [HACKERS] [COMMITTERS] pgsql: Improve performance of SendRowDescriptionMessage.
Next
From: Robert Haas
Date:
Subject: Re: [HACKERS] pgsql: Avoid coercing a whole-row variable that is already coerced