Indeed, if there is not some sort of implementation limitation, it would be cool to be able to lock two big integers like so: pg_try_advisory_xact_lock(key1 bigint, key2 bigint) That would solve your problem with locking UUIDs (although you still couldn't lock UUIDs simultaneously across different tables without risking lock interference.) It would also enable the use of advisory locks on multiple tables that have bigserial (bigint) as the primary key, eg: pg_try_advisory_xact_lock(t.id, t.tableoid::bigint) Obviously you don't need a bigint for tableoid but being able to lock two bigints allows you to go to 16-bytes if need be. This came up when I was thinking about how to implement processing queues. It's doable if you assign an int4 id for each queue row (each queue is limited to not grow beyond 2B rows, which seems reasonably generous), then you can do: pg_try_advisory_xact_lock(t.qid, t.tableoid::int4) This is supported by the current postgresql version. Kiriakos On Mar 7, 2012, at 12:52 PM, Andrey Chursin wrote:
|