Jochem, > For a small number of processes and a large difference in time > between the 'loookup' speed and the 'work' I have used a two-step > process where you first get a batch of records and then try them > all in rapid succession. In pseudocode: > > SELECT * > FROM table > WHERE condition > LIMIT number_of_queue_processes + 1; > > LOOP; > BEGIN; > SELECT * > FROM table > WHERE condition AND pk = xxx > LIMIT 1 FOR UPDATE NOWAIT; > > do something; > COMMIT; > END; >
I decided to use the same schema here. The only improvement I can see to it is to shuffle the batch in random order... that way the competing processors get a higher chance to avoid collision. I have to see if this really works out well once I get the chance to deploy it... Thanks, Csaba. ---------------------------(end of broadcast)--------------------------- TIP 1: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to [EMAIL PROTECTED] so that your message can get through to the mailing list cleanly