Re: MERGE vs REPLACE - Mailing list pgsql-hackers

From mark@mark.mielke.cc
Subject Re: MERGE vs REPLACE
Date
Msg-id 20051117173117.GA27563@mark.mielke.cc
Whole thread Raw
In response to Re: MERGE vs REPLACE  (Stephen Frost <sfrost@snowman.net>)
Responses Re: MERGE vs REPLACE  (Bruce Momjian <pgman@candle.pha.pa.us>)
List pgsql-hackers
On Thu, Nov 17, 2005 at 10:15:30AM -0500, Stephen Frost wrote:
> REPLACE/INSERT ON DUPLICATE UPDATE appears to essentially be a
> transaction which is supposed to not fail but instead do locking to
> ensure that it doesn't fail.  This requires predicate locking to be
> efficient because you want to tell the concurrent transaction "if you
> have the same key as me, just wait a second and you can do an update
> 'cause I'm going to create the key if it doesn't exist before I'm done".

Is the requirement for predicate locking, over and above a unique
constraint on an index that involves the record key, to deal with
the scenario of two inserts executing at the same time, both before
commit?

Cheers,
mark

-- 
mark@mielke.cc / markm@ncf.ca / markm@nortel.com     __________________________
.  .  _  ._  . .   .__    .  . ._. .__ .   . . .__  | Neighbourhood Coder
|\/| |_| |_| |/    |_     |\/|  |  |_  |   |/  |_   | 
|  | | | | \ | \   |__ .  |  | .|. |__ |__ | \ |__  | Ottawa, Ontario, Canada
 One ring to rule them all, one ring to find them, one ring to bring them all                      and in the darkness
bindthem...
 
                          http://mark.mielke.cc/



pgsql-hackers by date:

Previous
From: Merlin Moncure
Date:
Subject: Re: 8.0 -> 8.1 dump duplicate key problem?
Next
From: "Kevin Grittner"
Date:
Subject: Re: [ADMIN] ERROR: could not read block