in reply to DBI and PostgreSQL advisory locks

techcode:

Wrap all your operations in a single transaction and let the database do the work for you. More like:

$db->{AutoCommit}=0; $db->begin_work(); $db->do(operation 1); $db->do(operation 2); $db->do(operation 3); $db->commit();

Once you start a transaction, the database should prevent you from updating the same rows until you complete the current one.

...roboticus