Re: Refactoring speculative insertion with unique indexes a little - Mailing list pgsql-hackers

From Peter Geoghegan
Subject Re: Refactoring speculative insertion with unique indexes a little
Date
Msg-id CAM3SWZQ50FfYX9ru=qUfPMSZfnvV+sEQDJBJc-Zo74-ED7+U-g@mail.gmail.com
Whole thread Raw
In response to Re: Refactoring speculative insertion with unique indexes a little  (Heikki Linnakangas <hlinnaka@iki.fi>)
Responses Re: Refactoring speculative insertion with unique indexes a little  (Peter Geoghegan <pg@heroku.com>)
List pgsql-hackers
On Thu, Jul 2, 2015 at 1:30 AM, Heikki Linnakangas <hlinnaka@iki.fi> wrote:
>> Sure, if a speculative inserter detects a conflict, it still has to
>> wait. But not in the aminsert call, and not until it cleans up its
>> physical insertion (by super-deleting). Clearly a
>> CHECK_UNIQUE_SPECULATIVE would have to be much closer to
>> CHECK_UNIQUE_PARTIAL than to CHECK_UNIQUE_YES.
>
>
> Why is it not OK for aminsert to do the waiting, with
> CHECK_UNIQUE_SPECULATIVE?

Well, waiting means getting a ShareLock on the other session's XID.
You can't do that without first releasing your locks, unless you're
okay with unprincipled deadlocks.

-- 
Peter Geoghegan



pgsql-hackers by date:

Previous
From: Heikki Linnakangas
Date:
Subject: Re: Configurable location for extension .control files
Next
From: Robert Haas
Date:
Subject: Re: Rework the way multixact truncations work