On Thu, Jul 2, 2015 at 1:30 AM, Heikki Linnakangas <hlinnaka(at)iki(dot)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