Re: Multithreaded queue in PgSQL

From: "Scott Marlowe" <scott(dot)marlowe(at)gmail(dot)com>
To: "Nikola Milutinovic" <alokin1(at)yahoo(dot)com>
Cc: "PostgreSQL general" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Multithreaded queue in PgSQL
Date: 2008-06-10 14:57:37
Message-ID: dcc563d10806100757v4827f977rddf0f1c181628f27@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, Jun 10, 2008 at 4:40 AM, Nikola Milutinovic <alokin1(at)yahoo(dot)com> wrote:
> Hi all.
>
> This may be trivial, but I cannot find good references for it. The problem
> is this:
>
> Suppose we have one table in PgSQL which is a job queue, each row represents
> one job with several status flags, IDs,... Several processes will attempt to
> access the queue and "take" their batch of jobs, the batch will have some
> parameterizable size. So, the simple idea is "select N lowest IDs that do
> not have a flag <in process> set and set the flag", "then proceed with
> whatever it is that should be done".

Do the jobs HAVE to be assigned sequentially in groups? I.e. is it
only allowable to assign jobs 1-10 to one thread, then 11 through 18
to the next? Or could you assign 1,2,3,6,7,8,9,10 to one, and
4,5,11,12... to another?

If so, assign them with a separate sequence.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Richard Huxton 2008-06-10 15:13:46 Re: encoding confusion
Previous Message Tom Lane 2008-06-10 14:54:03 Re: REGEXP_REPLACE woes