Re: using database for queuing operations? - Mailing list pgsql-general

From Andre Maasikas
Subject Re: using database for queuing operations?
Date
Msg-id 4152BD31.5020506@abs.ee
Whole thread Raw
In response to Re: using database for queuing operations?  (John Sidney-Woollett <johnsw@wardbrook.com>)
Responses Re: using database for queuing operations?
List pgsql-general
John Sidney-Woollett wrote:

> I'd have to sit down and think about the answer to that and I'm too
> tired right now... ;)
>
> We found the NOWAIT option very useful for helping to get our stored
> procedures to behave in a more deterministic way, especially in a
> multi-threaded environment.
>
> John Sidney-Woollett
>
> Jim C. Nasby wrote:
>
>> Ahh, yes, forgot about that. Very handy to have. But even without that
>> you wouldn't have a race condition, just a blocked process, right?
>>

Not sure if this should be that way - the docs say that in case
of locked rows the where clause is reevaluated:

1 session: lock row, update status.

2 session:
test=# select * from test2 where nr=(select max(nr) from test2
where status='NEW') for update;

<waits here>
1. session commit;
2.session results:

  nr |   status
----+------------
  55 | PROCESSING
(1 row)

test=#


Andre


pgsql-general by date:

Previous
From: frederic.germaneau@bull.net
Date:
Subject: v8 on AIX5.2
Next
From: Jeff Amiel
Date:
Subject: Re: using database for queuing operations?