Re: Update on true serializable techniques in MVCC

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Boszormenyi Zoltan <zb(at)cybertec(dot)at>
Cc: Alvaro Herrera <alvherre(at)commandprompt(dot)com>, Andres Freund <andres(at)anarazel(dot)de>, pgsql-hackers(at)postgresql(dot)org, Albe Laurenz <laurenz(dot)albe(at)wien(dot)gv(dot)at>, "Kevin Grittner *EXTERN*" <Kevin(dot)Grittner(at)wicourts(dot)gov>
Subject: Re: Update on true serializable techniques in MVCC
Date: 2009-12-16 20:26:22
Message-ID: 603c8f070912161226k18988b86sbb3d387f4ed0a949@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Dec 16, 2009 at 1:29 PM, Boszormenyi Zoltan <zb(at)cybertec(dot)at> wrote:
> Robert Haas írta:
>> On Wed, Dec 16, 2009 at 1:25 PM, Robert Haas <robertmhaas(at)gmail(dot)com> wrote:
>>
>>> On Wed, Dec 16, 2009 at 1:14 PM, Alvaro Herrera
>>> <alvherre(at)commandprompt(dot)com> wrote:
>>>
>>>> Robert Haas escribió:
>>>>
>>>>> On Wed, Dec 16, 2009 at 10:29 AM, Andres Freund <andres(at)anarazel(dot)de> wrote:
>>>>>
>>>>>> On Wednesday 16 December 2009 16:24:42 Robert Haas wrote:
>>>>>>
>>>>>>>>   Inserts and deletes follow the same protocol, obtaining an exclusive
>>>>>>>>   lock on the row after the one being inserted or deleted. The result
>>>>>>>>   of this locking protocol is that a range scan prevents concurrent
>>>>>>>>   inserts or delete within the range of the scan, and vice versa.
>>>>>>>>
>>>>>>>> That sounds like it should actually work.
>>>>>>>>
>>>>>>> Only if you can guarantee that the database will access the rows using
>>>>>>> some particular index.  If it gets to the data some other way it might
>>>>>>> accidentally circumvent the lock.  That's kind of a killer in terms of
>>>>>>> making this work for PostgreSQL.
>>>>>>>
>>>>>> Isnt the whole topic only relevant for writing access? There you have to
>>>>>> access the index anyway.
>>>>>>
>>>>> Yeah, I guess you have to insert the new tuple.  I guess while you
>>>>> were at it you might check whether the next tuple is locked...
>>>>>
>>>> So you'd have to disable HOT updates when true serializability was
>>>> active?
>>>>
>>> I thought about that, but I don't think so.   HOT only applies to
>>> updates, and predicate locking only applies to inserts.  Unless I have
>>> my head in the sand?
>>>
>>
>> Err, no, wait.  Predicate locking can apply to updates, but since HOT
>> updates never update an indexed column, I think we might still be OK?
>>
>
> A predicate can include columns from an index plus others.
> Am I missing something?

Hmm, interesting point. In that case you couldn't use the index to
enforce predicate locking under MVCC without disabling HOT. But there
will be other cases where that wouldn't help anyway - a predicate
could also include unindexed columns exclusively. For those, the
traditional approach (not the one discussed in this paper) probably
requires locking against any heap insert, or checking each new heap
insert against the constraint, or... something.

...Robert

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2009-12-16 20:26:23 Re: Range types
Previous Message Martijn van Oosterhout 2009-12-16 20:24:36 Re: Range types