Re: Performance question - Mailing list pgsql-general

From Anil Menon
Subject Re: Performance question
Date
Msg-id CAHzbRKecduY-_YpUHur8p2wWW4XBvsP_4eLkVn7fiEKvbmMXbg@mail.gmail.com
Whole thread Raw
In response to Re: Performance question  (Albe Laurenz <laurenz.albe@wien.gv.at>)
List pgsql-general
Thanks Laurenz, very good point!

Luckily (phew!) the business scenario is such that race conditions cannot occur (and the transaction table is append only). There is business workflow to address duplicates but
1) it occurs extremely rarely (it would be a deliberate sabotage if it occurs)
2) there is no impact on business

Yours
Anil



On Fri, Nov 21, 2014 at 5:16 PM, Albe Laurenz <laurenz.albe@wien.gv.at> wrote:
Anil Menon wrote:
> I would like to ask from your experience which would be the best "generic" method for checking if row
> sets of a certain condition exists in a PLPGSQL function.
>
> I know of 4 methods so far (please feel free to add if I missed out any others)
[...]

Are you aware that all of these methods have a race condition unless
you use isolation level READ STABILITY or better?

It may be that rows are added or removed between the check and the
corresponding action.

Yours,
Laurenz Albe

pgsql-general by date:

Previous
From: zach cruise
Date:
Subject: Re: better architecture?
Next
From: Adrian Klaver
Date:
Subject: Re: better architecture?