Re: Performance Implications of Using Exceptions

From: James Mansion <james(at)mansionfamily(dot)plus(dot)com>
To: Stephen Denne <Stephen(dot)Denne(at)datamail(dot)co(dot)nz>
Cc: Ravi Chemudugunta <chemuduguntar(at)gmail(dot)com>, pgsql-performance(at)postgresql(dot)org
Subject: Re: Performance Implications of Using Exceptions
Date: 2008-04-02 19:19:54
Message-ID: 47F3DC5A.30705@mansionfamily.plus.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

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.

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Andreas Kostyrka 2008-04-02 20:24:12 Re: POSIX file updates
Previous Message James Mansion 2008-04-02 19:10:29 Re: POSIX file updates