applytransaction wait event (Lock) — PostgreSQL

PostgreSQL Lock wait event applytransaction: Waiting to acquire a lock on a remote transaction being applied by a logical replication subscriber.

Summary

applytransaction is a PostgreSQL Lock wait event. The official server documentation describes it as: “Waiting to acquire a lock on a remote transaction being applied by a logical replication subscriber.” (verbatim from PostgreSQL’s wait_event_names.txt catalog).

Classification

  • wait_event: applytransaction
  • wait_event_type: Lock
  • Reported in: pg_stat_activity

What the Lock class indicates

(Paraphrased explanation.) The process is waiting to acquire a heavyweight (SQL-level) lock, such as a row, table, or transaction lock held by another session.

How to observe it

(Illustrative query — not from the catalog.) You can see which sessions are currently reporting this wait event in the cumulative statistics view:

SELECT pid, state, wait_event_type, wait_event, query
FROM pg_stat_activity
WHERE wait_event_type = 'Lock'
  AND wait_event = 'applytransaction';

Version applicability

Confirmed present in PostgreSQL major version(s): 16, 17, 18, 19 (verified against each release’s server source).

This wait event has existed since at least PostgreSQL 16.

The machine-readable wait_event_names.txt catalog exists from PostgreSQL 17 onward; presence in PostgreSQL 12–16 was verified directly from the wait-event, lock, and lightweight-lock definitions in those releases’ source code.

References

  • PostgreSQL documentation — Wait Events
  • PostgreSQL source — src/backend/utils/activity/wait_event_names.txt