Stephen Denne wrote:
A third option is to update, if not found, insert.
I find myself having to do this in Sybase, but it sucks because there's a race - if there's no row updated then there's no lock and you race another thread doing the same thing. So you grab a row lock on a sacrificial row used as a mutex, or just a table lock. Or you just accept that sometimes you have to detect the insert fail and retry the whole transaction. Which is sucky however you look at it. I think the 'update or insert' or 'merge' extensions make a degree of sense. At least in psql one can use the lightweight lock manager. -- Sent via pgsql-performance mailing list (pgsql-performance@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-performance