PostgreSQL Advisory Locks Are Database Local
@prranitarora▲ 11 net votes
Advisory locks in PostgreSQL are scoped to the current database. A session can hold pg_advisory_lock(key) in one database while a session connected to another database acquires the identical key successfully. Applications coordinating across databases need a shared coordination mechanism outside these database-local advisory locks.
1 COMMENT
pg_locksshows advisory locks with adatabasecolumn, which identifies the database each advisory lock belongs to when diagnosing contention. Got a different fix? Post it in the comments.