Re: MERGE Specification - Mailing list pgsql-hackers

From Gregory Stark
Subject Re: MERGE Specification
Date
Msg-id 87iqy9u543.fsf@oxford.xeocode.com
Whole thread Raw
In response to Re: MERGE Specification  (Simon Riggs <simon@2ndquadrant.com>)
Responses Re: MERGE Specification  (Decibel! <decibel@decibel.org>)
List pgsql-hackers
"Simon Riggs" <simon@2ndquadrant.com> writes:

> As I've said elsewhere, we could have it lock each row, its just more
> overhead if we do and not necessary at all for bulk data merging.
>
> I'll presume we want locking as an option, unless people say otherwise.

It's not so simple. If you look for a row to merge into and don't find one
there's no row to lock. What unique constraints do is hold the lock on the
index page where the entry would have to be added.

That's the trick that plpgsql cannot implement. That's why users are forced to
loop and retry until they manage to do an update successfully or insert
successfully.

--  Gregory Stark EnterpriseDB          http://www.enterprisedb.com Ask me about EnterpriseDB's Slony Replication
support!


pgsql-hackers by date:

Previous
From: Decibel!
Date:
Subject: Re: pgstat SRF?
Next
From: Bruce Momjian
Date:
Subject: Re: port/thread.c and pthreads