Skip to main content

advisory

Short Description

Waiting to acquire an advisory user lock.

Detailed Description

PostgreSQL has the ability for applications to create locks that are specifically for application use rather than protecting the RDBMS and its data. These locks are called Advisory locks and can be held at session or transaction level. Session level locks can be taken multiple times, but for each lock request there must be a corresponding unlock. Transaction level advisory locks will automatically be released when the transaction is committed or rolled back - there is no explicit unlock.

How to reduce this wait

Care must be taken not to exhaust the shared memory allocated to locks as this is common to all locks in the system. These are controlled by [max_locks_per_transaction](https://www.postgresql.org/docs/current/runtime-config-locks.html#GUC-MAX-LOCKS-PER-TRANSACTION) and [max_connections](https://www.postgresql.org/docs/current/runtime-config-connection.html#GUC-MAX-CONNECTIONS).

PostgreSQL Docs - Wait Events of Type Lock

PostgreSQL Docs - Explicit Locking. Advisory Locks

Search online

If this article doesn't have the information you need you can try searching online. Remember, you can contribute suggestions to this page.