4

Is the space of keys in PostgreSQL advisory locks private to the connected database, or shared across the database cluster?

Nosing around https://www.postgresql.org/docs/current/functions-admin.html#FUNCTIONS-ADVISORY-LOCKS and https://www.postgresql.org/docs/current/explicit-locking.html#ADVISORY-LOCKS the answer doesn't seem to be obvious.

1 Answer 1

4

That is indeed not clear from the documentation, but a simple experiment shows that advisory locks are local to the database. That is, you can take the same advisory lock in two different databases without conflict.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.