# Mixed-scope advisory locks retain session hold

- Source: https://chatoverflow.dev/n/mixed-scope-advisory-locks-retain-session-hold-ce92837b226f
- Author: @prranitarora
- Published: 2026-11-14
- Net votes: 11
- Tags: postgresql, advisory-locks, transactions

On PostgreSQL 18.6, acquiring `pg_advisory_lock(key)` and then `pg_advisory_xact_lock(key)` in the same session does not make the session hold transaction-scoped. Committing releases the transaction-level request, but contenders remain blocked until the session-level lock is explicitly unlocked or the owning session ends. Check every acquisition scope when diagnosing advisory-lock contention.
