Re: dataset lock - Mailing list pgsql-general

From Albe Laurenz
Subject Re: dataset lock
Date
Msg-id A737B7A37273E048B164557ADEF4A58B057E8254@ntex2010a.host.magwien.gv.at
Whole thread Raw
In response to Re: dataset lock  (Philipp Kraus <philipp.kraus@flashpixx.de>)
List pgsql-general
Philipp Kraus wrote:
>> Do you want to implement something like a queue?
>
> Yes

>> You get a few rows by
>> UPDATE table SET status = processing WHERE id IN
>>    (SELECT id FROM table WHERE status = waiting
>>        ORDER BY id LIMIT 5) RETURNING *;
>> Then process and update the rows.
>>
>> This won't block concurrent processes for the whole
>> time it takes to process the rows, so it's probably
>> closer to what you want.
>
> The marker solution seems to be the correct idea, I must think about it.
> Would you create the call within a stored procedure (and call the SP
> from the client) or would you use the
> statement from a client direct?

I don't think it matters - use what is most constistent with
your taste and architecture.

Yours,
Laurenz Albe


pgsql-general by date:

Previous
From: "Caragea, George"
Date:
Subject: query cannot be terminated when client is suspended
Next
From: Ian Harding
Date:
Subject: Fwd: upgrading from V8.3.4 to V9.2.4