Re: queueing via database table? - Mailing list pgsql-general

From Vivek Khera
Subject Re: queueing via database table?
Date
Msg-id E43DE9CF-3C9D-4635-A4A2-1B58AA444A7E@khera.org
Whole thread Raw
In response to Re: queueing via database table?  (Steve Atkins <steve@blighty.com>)
List pgsql-general
On Jan 3, 2007, at 2:00 AM, Steve Atkins wrote:

> Holding a lock while generating the thumbnail doesn't
> sound like a great idea, and I think that the select
> for update will end up serialising the requests.
>
> I'd add a "rendering" field, text, defaulting
> to an empty string.
>
> Then do a "select for update where ... and rendering = '' limit 1",
> update the rendering field to the hostname of the box doing the
> work and commit. Render the thumbnail. Delete the record.
>
> That'll also give you an easy way to show status of which
> box is rendering which scene.
>
> Depending on what else you're putting into the where clause
> a partial index on something for records where rendering=''
> might be helpful.

this is more or less how we do it, so i second this.

we also use NOTIFY/LISTEN to "wake up" the job processors when new
work is added.


Attachment

pgsql-general by date:

Previous
From: Richard Huxton
Date:
Subject: Re: pg_dump problems
Next
From: Bob Pawley
Date:
Subject: Re: Backup Restore