# max_pred_locks_per_relation

> max_pred_locks_per_relation — Sets the maximum number of predicate-locked pages and tuples per relation. Observed in PG10–19 Beta 3; its last measured boot default is -2 in PG19 Beta 3, with sighup 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-locked pages and tuples per relation.”

## Identity {#identity}

| Field | Value | Meaning |
| --- | --- | --- |
| Type | `integer` | Upstream pg_settings type |
| Context | `sighup` | Takes effect after configuration reload |
| Unit | — | Raw unit |
| Range | `-2147483648` – `2147483647` | Raw limits in the last observed version |
| Enum values | — | — for non-enum types |
| Category | Lock Management | Upstream classification |
| Latest boot value | `-2` | -2 |
{.fields meta="-"}

## Lifecycle {#lifecycle}

| Fact | Value |
| --- | --- |
| First observed | PG10 |
| Present in | PG10–19 Beta 3 |
| Removed in | No |
| Introduction commit | [`c63172d60f24`](https://git.postgresql.org/gitweb/?p=postgresql.git;a=commit;h=c63172d60f242ad3581c83723a5b315bbe547a0e) — Add GUCs for predicate lock promotion thresholds. |
| Commit date | 2017-04-07 |
| Discussion | — |

## Default history {#default-history}

| Versions | Raw `boot_val` | Unit | Human value |
| --- | --- | --- | --- |
| PG10–19 Beta 3 | `-2` | — | -2 |
{.full-width caption="Measured PG9.0–19 Beta 3 boot defaults"}

## How it works {#mechanism}

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 {#tuning-advice}

> [!TIP]
> **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. |
{.full-width}

## Pigsty {#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 | — | — |
{.full-width}

> [!CAUTION]
> **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 {#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 {#related-parameters}

[`max_pred_locks_per_transaction`](/parameters/max-pred-locks-per-transaction/) · [`max_pred_locks_per_page`](/parameters/max-pred-locks-per-page/) · [`default_transaction_isolation`](/parameters/default-transaction-isolation/) · [`max_locks_per_transaction`](/parameters/max-locks-per-transaction/) · [`deadlock_timeout`](/parameters/deadlock-timeout/)

## References {#references}

- [PostgreSQL 19 Beta 3 — max_pred_locks_per_relation](https://www.postgresql.org/docs/19/runtime-config-locks.html#GUC-MAX-PRED-LOCKS-PER-RELATION)
- [PostgreSQL 19 release notes](https://www.postgresql.org/docs/19/release-19.html)
- [Machine-readable GUC export](/data/guc.jsonl)
