Le mardi 10 juin 2008, Nikola Milutinovic a écrit : > 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". You may find that the PGQ component of skytools is what you want: http://pgfoundry.org/projects/skytools http://skytools.projects.postgresql.org/doc/ http://skytools.projects.postgresql.org/doc/pgq-sql.html And there's even a nice and recent presentation paper about it: http://www.pgcon.org/2008/schedule/events/79.en.html And a less recent but still useful blog entry on the subject: http://kaiv.wordpress.com/2007/10/19/skytools-database-scripting-framework-pgq/ Regards, -- dim
Attachment:
signature.asc
Description: This is a digitally signed message part.