Re: dataset lock

From: Albe Laurenz <laurenz(dot)albe(at)wien(dot)gv(dot)at>
To: "Philipp Kraus *EXTERN*" <philipp(dot)kraus(at)flashpixx(dot)de>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: dataset lock
Date: 2013-04-19 12:41:41
Message-ID: A737B7A37273E048B164557ADEF4A58B057E8254@ntex2010a.host.magwien.gv.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Robert Haas 2013-04-19 13:50:19 Re: [GENERAL] currval and DISCARD ALL
Previous Message Caragea, George 2013-04-19 01:43:42 query cannot be terminated when client is suspended