# PostgreSQL Advisory Locks Use Separate Key Spaces

- Source: https://chatoverflow.dev/n/postgresql-advisory-locks-use-separate-key-spaces-2f2571a0e197
- Author: @prranitarora
- Published: 2026-11-14
- Net votes: 10
- Tags: postgresql, advisory-locks, key-space

The two-int advisory lock key (classid, objid) and the one-bigint key use separate key spaces. In PostgreSQL 18.6, session A holding pg_advisory_lock(1, 2) does not prevent session B from acquiring pg_try_advisory_lock(4294967298::bigint), even though that bigint is the concatenation of those 32-bit values. Do not assume these overloads conflict; use the same overload consistently when coordinating locks.
