This is the multi-page printable view of this section. .
Lock Management
- 1: deadlock_timeout
- 2: max_locks_per_transaction
- 3: max_pred_locks_per_page
- 4: max_pred_locks_per_relation
- 5: max_pred_locks_per_transaction
Dossier URLs remain flat; this category exists only to organize browsing and the sidebar.
1 - deadlock_timeout
Fact — official short description: “Sets the time to wait on a lock before checking for deadlock.”
Identity
Type,- Upstream pg_settings type
Context,- Settable at runtime by a superuser
Unit,- Raw unit
Range,- Raw limits in the last observed version
Enum values,- — for non-enum types
Category,- Upstream classification
Latest boot value,- 1 s
Lifecycle
| Fact | Value |
|---|---|
| First observed | PG9.0 (research boundary) |
| Present in | PG9.0–19 Beta 3 |
| Removed in | No |
| Introduction commit | Not asserted: predates the PG9.0 research boundary |
| Commit date | — |
| Discussion | — |
Default history
| Versions | Raw boot_val |
Unit | Human value |
|---|---|---|---|
| PG9.0–19 Beta 3 | 1000 |
ms |
1 s |
How it works
Sets the time to wait on a lock before checking for deadlock. A superuser or a role granted SET privilege can change it for the relevant session or configuration scope.
PostgreSQL waits this long before running the comparatively expensive deadlock detector. The same interval controls lock-wait logging when log_lock_waits is enabled, so lowering it improves diagnostics and deadlock response at the cost of more checks during ordinary contention.
Monitor and change deadlock_timeout together with log_lock_waits, lock_timeout, max_locks_per_transaction. Validate on the relevant server role and real workload, then use its superuser context to choose session change, reload, or restart; a historical boot default is not the current effective value.
Tuning advice
Advice. These are workload-specific starting points and must be validated with measurements.
| Workload | Guidance |
|---|---|
| OLTP | Calibrate deadlock_timeout 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 | 50ms |
different | 50ms |
| OLAP | 50ms |
different | 50ms |
| CRIT | 50ms |
different | 50ms |
| TINY | 50ms |
different | 50ms |
Advice — pending human review. Fact from the current Pigsty template projection: OLTP: PG9.0–19 Beta 3 = 50ms (dcs); OLAP: PG9.0–19 Beta 3 = 50ms (dcs); CRIT: PG9.0–19 Beta 3 = 50ms (dcs); TINY: PG9.0–19 Beta 3 = 50ms (dcs). Advice, pending human review — Editorial interpretation, pending human maintainer review: the override appears intended to detect true deadlocks and emit lock-wait diagnostics faster than upstream; confirm it against the current Pigsty templates, hardware fixture, and operational guarantees before publication.
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.
Related parameters
log_lock_waits · lock_timeout · max_locks_per_transaction · max_pred_locks_per_transaction · max_pred_locks_per_page · max_pred_locks_per_relation
References
2 - max_locks_per_transaction
Fact — official short description: “Sets the maximum number of locks per transaction.”
Identity
Type,- Upstream pg_settings type
Context,- Requires a server restart
Unit,- Raw unit
Range,- Raw limits in the last observed version
Enum values,- — for non-enum types
Category,- Upstream classification
Latest boot value,- 128
Lifecycle
| Fact | Value |
|---|---|
| First observed | PG9.0 (research boundary) |
| Present in | PG9.0–19 Beta 3 |
| Removed in | No |
| Introduction commit | Not asserted: predates the PG9.0 research boundary |
| Commit date | — |
| Discussion | — |
Default history
| Versions | Raw boot_val |
Unit | Human value |
|---|---|---|---|
| PG9.0–18 | 64 |
— | 64 |
| PG19 Beta 3 | 128 |
— | 128 |
How it works
Sets the maximum number of locks per transaction. The value is fixed when the server starts, so changing it requires a restart.
The shared lock table is sized for this average number of distinct lockable objects per backend or prepared transaction. A single transaction may exceed the number if space remains; it does not limit row locks, and standbys need a value at least as large as the primary.
Monitor and change max_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
Advice. These are workload-specific starting points and must be validated with measurements.
| Workload | Guidance |
|---|---|
| OLTP | Calibrate max_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 | 500 |
different | {{ pg_max_locks_per_transaction }} |
| OLAP | 1000 |
different | {{ pg_max_locks_per_transaction }} |
| CRIT | 500 |
different | {{ pg_max_locks_per_transaction }} |
| TINY | 250 |
different | {{ pg_max_locks_per_transaction }} |
Advice — pending human review. Fact from the current Pigsty template projection: OLTP: PG9.0–19 Beta 3 = 500 (dcs); OLAP: PG9.0–19 Beta 3 = 1000 (dcs); CRIT: PG9.0–19 Beta 3 = 500 (dcs); TINY: PG9.0–19 Beta 3 = 250 (dcs). Advice, pending human review — Editorial interpretation, pending human maintainer review: the override appears intended to reserve shared lock-table capacity for partition-heavy and schema-rich workloads; confirm it against the current Pigsty templates, hardware fixture, and operational guarantees before publication.
Common pitfalls
- Reading it as a row-lock limit or a hard limit for one transaction.
- Raising it without accounting for max_connections and prepared transactions.
- Setting a standby below its primary and preventing standby queries.
- Reading an average shared-memory sizing value as a hard per-transaction limit.
- Raising it without the multiplier from connections and prepared transactions.
Related parameters
deadlock_timeout · log_lock_waits · lock_timeout · max_pred_locks_per_transaction · max_pred_locks_per_relation · max_pred_locks_per_page
References
3 - max_pred_locks_per_page
Fact — official short description: “Sets the maximum number of predicate-locked tuples per page.”
Identity
Type,- Upstream pg_settings type
Context,- Takes effect after configuration reload
Unit,- Raw unit
Range,- Raw limits in the last observed version
Enum values,- — for non-enum types
Category,- Upstream classification
Latest boot value,- 2
Lifecycle
| Fact | Value |
|---|---|
| First observed | PG10 |
| Present in | PG10–19 Beta 3 |
| Removed in | No |
| Introduction commit | c63172d60f24 — Add GUCs for predicate lock promotion thresholds. |
| Commit date | 2017-04-07 |
| Discussion | — |
Default history
| Versions | Raw boot_val |
Unit | Human value |
|---|---|---|---|
| PG10–19 Beta 3 | 2 |
— | 2 |
How it works
Sets the maximum number of predicate-locked tuples per page. A configuration reload applies a new value; existing work already in flight is not retroactively changed.
Serializable Snapshot Isolation promotes tuple-level predicate locks to a page-level lock after this many tuples on one page. Promotion saves shared memory but increases the chance that unrelated writes appear to conflict and cause serialization failures.
Monitor and change max_pred_locks_per_page together with max_pred_locks_per_transaction, max_pred_locks_per_relation, default_transaction_isolation. Validate on the relevant server role and real workload, then use its sighup context to choose session change, reload, or restart; a historical boot default is not the current effective value.
Tuning advice
Advice. These are workload-specific starting points and must be validated with measurements.
| Workload | Guidance |
|---|---|
| OLTP | Calibrate max_pred_locks_per_page 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 | — | — |
Advice — pending human review. Fact from the current Pigsty template projection: OLTP: PG10–19 Beta 3 unmodified; OLAP: PG10–19 Beta 3 unmodified; CRIT: PG10–19 Beta 3 unmodified; TINY: PG10–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.
Related parameters
max_pred_locks_per_transaction · max_pred_locks_per_relation · default_transaction_isolation · max_locks_per_transaction · deadlock_timeout
References
4 - max_pred_locks_per_relation
Fact — official short description: “Sets the maximum number of predicate-locked pages and tuples per relation.”
Identity
Type,- Upstream pg_settings type
Context,- Takes effect after configuration reload
Unit,- Raw unit
Range,- Raw limits in the last observed version
Enum values,- — for non-enum types
Category,- Upstream classification
Latest boot value,- -2
Lifecycle
| Fact | Value |
|---|---|
| First observed | PG10 |
| Present in | PG10–19 Beta 3 |
| Removed in | No |
| Introduction commit | c63172d60f24 — Add GUCs for predicate lock promotion thresholds. |
| Commit date | 2017-04-07 |
| Discussion | — |
Default history
| Versions | Raw boot_val |
Unit | Human value |
|---|---|---|---|
| PG10–19 Beta 3 | -2 |
— | -2 |
How it works
Sets the maximum number of predicate-locked pages and tuples per relation. A configuration reload applies a new value; existing work already in flight is not retroactively changed.
SSI promotes page/tuple predicate locks to one relation-level lock at this threshold. A negative value means max_pred_locks_per_transaction divided by its absolute value; promotion changes granularity, not SQL lock strength.
Monitor and change max_pred_locks_per_relation together with max_pred_locks_per_transaction, max_pred_locks_per_page, default_transaction_isolation. Validate on the relevant server role and real workload, then use its sighup context to choose session change, reload, or restart; a historical boot default is not the current effective value.
Tuning advice
Advice. These are workload-specific starting points and must be validated with measurements.
| Workload | Guidance |
|---|---|
| OLTP | Calibrate max_pred_locks_per_relation 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 | — | — |
Advice — pending human review. Fact from the current Pigsty template projection: OLTP: PG10–19 Beta 3 unmodified; OLAP: PG10–19 Beta 3 unmodified; CRIT: PG10–19 Beta 3 unmodified; TINY: PG10–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.
Related parameters
max_pred_locks_per_transaction · max_pred_locks_per_page · default_transaction_isolation · max_locks_per_transaction · deadlock_timeout
References
5 - max_pred_locks_per_transaction
Fact — official short description: “Sets the maximum number of predicate locks per transaction.”
Identity
Type,- Upstream pg_settings type
Context,- Requires a server restart
Unit,- Raw unit
Range,- Raw limits in the last observed version
Enum values,- — for non-enum types
Category,- Upstream classification
Latest boot value,- 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
| 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
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 | — | — |
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.
Related parameters
deadlock_timeout · log_lock_waits · lock_timeout · max_locks_per_transaction · max_pred_locks_per_relation · max_pred_locks_per_page