Skip to content

max_pred_locks_per_transaction

max_pred_locks_per_transaction — Sets the maximum number of predicate locks per transaction. Observed in PG9.1–19 Beta 3; its last measured boot default is 64 in PG19 Beta 3, with postmaster context. This is a beta-snapshot fact and can change before PostgreSQL 19 GA.
Note

Fact — official short description: “Sets the maximum number of predicate locks per transaction.”

Identity

Type , Valueinteger
Upstream pg_settings type
Context , Valuepostmaster
Requires a server restart
Unit , Value
Raw unit
Range , Value102147483647
Raw limits in the last observed version
Enum values , Value
— for non-enum types
Category , ValueLock Management
Upstream classification
Latest boot value , Value64
64

Lifecycle

Fact Value
First observed PG9.1
Present in PG9.1–19 Beta 3
Removed in No
Introduction commit 6a77e9385eb4 — Rename max_predicate_locks_per_transaction.
Commit date 2011-02-15
Discussion

Default history

Measured PG9.0–19 Beta 3 boot defaults
Versions Raw boot_val Unit Human value
PG9.1–19 Beta 3 64 64

How it works

Sets the maximum number of predicate locks per transaction. The value is fixed when the server starts, so changing it requires a restart.

This sizes the shared predicate-lock table per backend or prepared transaction for SERIALIZABLE conflict tracking. It is an average shared-memory allocation rather than a hard per-transaction ceiling, and is unrelated to ordinary row-lock counts.

Monitor and change max_pred_locks_per_transaction together with deadlock_timeout, log_lock_waits, lock_timeout. Validate on the relevant server role and real workload, then use its postmaster context to choose session change, reload, or restart; a historical boot default is not the current effective value.

Tuning advice

Tip

Advice. These are workload-specific starting points and must be validated with measurements.

Workload Guidance
OLTP Calibrate max_pred_locks_per_transaction from lock-wait logs, objects touched, and the concurrency bound. Fix long transactions and access ordering before adding shared memory or changing detection granularity.
OLAP Partitioned queries, bulk DDL, and SERIALIZABLE reports may touch many objects; test the worst plan, not only an average transaction.
Small nodes Defaults are usually sufficient. If raising a startup lock-table setting, account for max_connections, prepared transactions, and standby consistency together.

Pigsty

Values use the fixed 8-vCPU, 32-GiB, 100-GiB SSD fixture and render the current Pigsty templates for PG19 Beta 3; this does not assert current Pigsty support for that historical or beta release.

Template Effective value Versus upstream boot Source expression
OLTP Unmodified
OLAP Unmodified
CRIT Unmodified
TINY Unmodified
Caution

Advice — pending human review. Fact from the current Pigsty template projection: OLTP: PG9.1–19 Beta 3 unmodified; OLAP: PG9.1–19 Beta 3 unmodified; CRIT: PG9.1–19 Beta 3 unmodified; TINY: PG9.1–19 Beta 3 unmodified. No Pigsty-specific rationale is inferred from an absent override.

Common pitfalls

  • Reading an average shared-memory sizing value as a hard per-transaction limit.
  • Raising it without the multiplier from connections and prepared transactions.
  • Expanding lock memory instead of fixing long transactions, access order, or partition explosion.
  • Ignoring compatible startup lock capacity on standbys.

deadlock_timeout · log_lock_waits · lock_timeout · max_locks_per_transaction · max_pred_locks_per_relation · max_pred_locks_per_page

References