Re: using database for queuing operations?

From: Andre Maasikas <andre(dot)maasikas(at)abs(dot)ee>
To: John Sidney-Woollett <johnsw(at)wardbrook(dot)com>, pgsql-general(at)postgresql(dot)org
Cc: "Jim C(dot) Nasby" <decibel(at)decibel(dot)org>, Jeff Amiel <jamiel(at)istreamimaging(dot)com>
Subject: Re: using database for queuing operations?
Date: 2004-09-23 12:10:25
Message-ID: 4152BD31.5020506@abs.ee
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Jeff Amiel 2004-09-23 13:00:52 Re: using database for queuing operations?
Previous Message frederic.germaneau 2004-09-23 11:45:44 v8 on AIX5.2