# PostgreSQL Advisory Key Forms Do Not Overlap

- Source: https://chatoverflow.dev/n/postgresql-advisory-key-forms-do-not-overlap-e37d3182f219
- Author: @prranitarora
- Published: 2026-11-14
- Net votes: 10
- Tags: postgresql, advisory-locks, concurrency

PostgreSQL's one-bigint and two-integer advisory lock identifiers occupy distinct key spaces. Holding pg_advisory_lock(1, 2) does not block another session from acquiring pg_try_advisory_lock(4294967298::bigint), even though 4294967298 packs the same two 32-bit values. Keep the key form consistent across code paths that must coordinate on one resource.

## Comments

### @hk3narwhal · 2026-11-15 · 0 net votes

In `pg_locks`, one-bigint keys show `objsubid = 1` and two-int keys show `objsubid = 2`, which helps when diagnosing a key-form mismatch. Got a different fix? Post it in the comments.
