{"Entry":{"collection":"guc","key":"max_pred_locks_per_transaction","name":"max_pred_locks_per_transaction","aliases":[],"metadata":{"baseline":false,"boot_human":"Not specified","boot_val":null,"category":"Lock Management","category_zh":"","changed_in":["16","17"],"changes":[{"documentation_changed":false,"fields":{},"from":"9.0","status":"added","to":"9.1"},{"documentation_changed":true,"fields":{},"from":"9.2","status":"changed","to":"9.3"},{"documentation_changed":true,"fields":{"extra_desc":{"from":"The shared predicate lock table is sized on the assumption that at most max_pred_locks_per_transaction * max_connections distinct objects will need to be locked at any one time.","to":"The shared predicate lock table is sized on the assumption that at most max_pred_locks_per_transaction objects per server process or prepared transaction will need to be locked at any one time."}},"from":"15","status":"changed","to":"16"},{"documentation_changed":false,"fields":{"extra_desc":{"from":"The shared predicate lock table is sized on the assumption that at most max_pred_locks_per_transaction objects per server process or prepared transaction will need to be locked at any one time.","to":"The shared predicate lock table is sized on the assumption that at most \"max_pred_locks_per_transaction\" objects per server process or prepared transaction will need to be locked at any one time."}},"from":"16","status":"changed","to":"17"}],"content_hash":"f586c577c8fa78300ba6536f006cfaa062fdef2cb7a3f0d7dcddaeb501492fd0","context":"","default_changed_in":[],"default_history":[{"from":"9.1","to":"19","value":"64"}],"editorial":{"advice":{"olap":"Partitioned queries, bulk DDL, and SERIALIZABLE reports may touch many objects; test the worst plan, not only an average transaction.","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.","small":"Defaults are usually sufficient. If raising a startup lock-table setting, account for max_connections, prepared transactions, and standby consistency together."},"mechanism":["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."],"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."],"references":[{"title":"PostgreSQL 19 Beta 4: max_pred_locks_per_transaction","url":"https://www.postgresql.org/docs/19/runtime-config-locks.html#GUC-MAX-PRED-LOCKS-PER-TRANSACTION"},{"title":"PostgreSQL 19 release notes","url":"https://www.postgresql.org/docs/19/release-19.html"}],"related":["deadlock_timeout","log_lock_waits","lock_timeout","max_locks_per_transaction","max_pred_locks_per_relation","max_pred_locks_per_page"],"summary":"max_pred_locks_per_transaction — Sets the maximum number of predicate locks per transaction. Observed in PG9.1–19 Beta 4; its last measured boot default is 64 in PG19 Beta 4, with postmaster context. This is a beta-snapshot fact and can change before PostgreSQL 19 GA."},"enumvals":[],"first_version":"9.1","group":"Lock Management","group_slug":"locks","imported_at":"2026-09-27T17:57:31.727283+08:00","intro_commit":{"authored_at":"2011-02-15T08:00:04-05:00","discussion":[],"hash":"6a77e9385eb46829ce80971bc655df9f3ef00d9a","subject":"Rename max_predicate_locks_per_transaction.","url":"https://git.postgresql.org/gitweb/?p=postgresql.git;a=commit;h=6a77e9385eb46829ce80971bc655df9f3ef00d9a"},"key":"max_pred_locks_per_transaction","last_version":"20","max_val":"","min_val":"","name":"max_pred_locks_per_transaction","position":279,"present_in":["9.1","9.2","9.3","9.4","9.5","9.6","10","11","12","13","14","15","16","17","18","19","20"],"short_desc":"The shared predicate lock table has space for max_pred_locks_per_transaction objects (e.g., tables) per server process or prepared transaction; hence, no more than this many distinct objects can be locked at any one time.","short_desc_zh":"","source_rev":"english-manuals:de750b44ee5effa7fd0f6eb8a7710e1a0a1ff69b1a94c3440a20d26d2ed67567","unit":"","vartype":"integer"}},"Definition":{"Collection":"guc","Key":"max_pred_locks_per_transaction","SourceDatabase":"center","Version":"18","SourceTable":"guc","SourceKey":"max_pred_locks_per_transaction","SourceRevision":"english-manuals:de750b44ee5effa7fd0f6eb8a7710e1a0a1ff69b1a94c3440a20d26d2ed67567","Facts":{"boot_val":"64","category":"Lock Management","context":"postmaster","description":"The shared predicate lock table has space for max_pred_locks_per_transaction objects (e.g., tables) per server process or prepared transaction; hence, no more than this many distinct objects can be locked at any one time. This parameter limits the average number of object locks used by each transaction; individual transactions can lock more objects as long as the locks of all transactions fit in the lock table. This is not the number of rows that can be locked; that value is unlimited. The default, 64, has historically proven sufficient, but you might need to raise this value if you have clients that touch many different tables in a single serializable transaction. This parameter can only be set at server start.","doc":{"anchor":"GUC-MAX-PRED-LOCKS-PER-TRANSACTION","file":"runtime-config-locks.html","lang":"en","sha256":"5faab37986a9ca9ff362569c12b8c63e8df57c76c9aea6e40d06e44e9abee87b","slug":"18"},"documented":true,"enumvals":null,"extra_desc":"The shared predicate lock table is sized on the assumption that at most \"max_pred_locks_per_transaction\" objects per server process or prepared transaction will need to be locked at any one time.","lang":"en","max_val":"2147483647","metadata_version":"18","min_val":"10","name":"max_pred_locks_per_transaction","short_desc":"Sets the maximum number of predicate locks per transaction.","source":"pg-settings-source-snapshot","unit":null,"vartype":"integer"},"ManualEvidence":{"doc":{"anchor":"GUC-MAX-PRED-LOCKS-PER-TRANSACTION","file":"runtime-config-locks.html","lang":"en","sha256":"5faab37986a9ca9ff362569c12b8c63e8df57c76c9aea6e40d06e44e9abee87b","slug":"18"}},"MeasuredEvidence":{"metadata_version":"18"}},"Text":{"Collection":"guc","Key":"max_pred_locks_per_transaction","SourceDatabase":"center","Version":"18","Locale":"en","Title":"max_pred_locks_per_transaction","Summary":"The shared predicate lock table has space for max_pred_locks_per_transaction objects (e.g., tables) per server process or prepared transaction; hence, no more than this many distinct objects can be locked at any one time. This parameter limits the average number of object locks used by each transaction; individual transactions can lock more objects as long as the locks of all transactions fit in the lock table. This is not the number of rows that can be locked; that value is unlimited. The default, 64, has historically proven sufficient, but you might need to raise this value if you have clients that touch many different tables in a single serializable transaction. This parameter can only be set at server start.","BodyHTML":"\u003cp\u003eThe shared predicate lock table has space for max_pred_locks_per_transaction objects (e.g., tables) per server process or prepared transaction; hence, no more than this many distinct objects can be locked at any one time. This parameter limits the average number of object locks used by each transaction; individual transactions can lock more objects as long as the locks of all transactions fit in the lock table. This is not the number of rows that can be locked; that value is unlimited. The default, 64, has historically proven sufficient, but you might need to raise this value if you have clients that touch many different tables in a single serializable transaction. This parameter can only be set at server start.\u003c/p\u003e","SourceRevision":"english-manuals:de750b44ee5effa7fd0f6eb8a7710e1a0a1ff69b1a94c3440a20d26d2ed67567","ContentHash":"c4145c3e04727f4b88e702d50e969fbb5bbfeef10cddabb515b3b5a8834ded7f","Payload":{"description":"The shared predicate lock table has space for max_pred_locks_per_transaction objects (e.g., tables) per server process or prepared transaction; hence, no more than this many distinct objects can be locked at any one time. This parameter limits the average number of object locks used by each transaction; individual transactions can lock more objects as long as the locks of all transactions fit in the lock table. This is not the number of rows that can be locked; that value is unlimited. The default, 64, has historically proven sufficient, but you might need to raise this value if you have clients that touch many different tables in a single serializable transaction. This parameter can only be set at server start."}},"RequestedLocale":"zh-Hans","Fallback":true,"Versions":["10","11","12","13","14","15","16","17","18","19","20","9.1","9.2","9.3","9.4","9.5","9.6"],"Locales":["en"],"Signatures":null,"Spellings":null,"SQLState":null,"Evidence":null}
