Re: [GENERAL] Advisory lock grant order

2014-09-09 Thread Tom Lane
Yossi Cohen writes: > If I request an advisory lock (pg_advisory_lock) with the same key from > several sessions; will the lock be granted in the same order as it was > requested? Usually. IIRC, the lock code will grant locks out-of-order if a deadlock would result without it. There might be so

[GENERAL] Advisory lock grant order

2014-09-09 Thread Yossi Cohen
Hi, If I request an advisory lock (pg_advisory_lock) with the same key from several sessions; will the lock be granted in the same order as it was requested? I.e. if for example: session 1: select pg_advisory_lock(1); -- acquires the lock then session 2: select pg_advisory_lock(1); -- blocks wait