From fdd3849e3b9ca039c2a3cee4cdd0a443cca316e8 Mon Sep 17 00:00:00 2001
From: Wang Wei <wangw.fnst@fujitsu.com>
Date: Wed, 15 Feb 2023 15:25:59 +0800
Subject: [PATCH v3] Fix the description of shared lock table size and shared
 predicate lock table size

---
 doc/src/sgml/config.sgml            | 49 ++++++++++++++---------------
 src/backend/utils/misc/guc_tables.c | 10 +++---
 2 files changed, 28 insertions(+), 31 deletions(-)

diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml
index 25111d5caf..c3ebacdf54 100644
--- a/doc/src/sgml/config.sgml
+++ b/doc/src/sgml/config.sgml
@@ -10237,19 +10237,18 @@ dynamic_library_path = 'C:\tools\postgresql;H:\my_project\lib;$libdir'
       <listitem>
        <para>
         The shared lock table tracks locks on
-        <varname>max_locks_per_transaction</varname> * (<xref
-        linkend="guc-max-connections"/> + <xref
-        linkend="guc-max-prepared-transactions"/>) objects (e.g.,  tables);
-        hence, no more than this many distinct objects can be locked at
-        any one time.  This parameter controls the average number of object
-        locks allocated for each transaction;  individual transactions
-        can lock more objects as long as the locks of all transactions
-        fit in the lock table.  This is <emphasis>not</emphasis> 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 queries that touch many different
-        tables in a single transaction, e.g., query of a parent table with
-        many children.  This parameter can only be set at server start.
+        <varname>max_locks_per_transaction</varname> objects (e.g., tables)
+        per eligible process or prepared transaction; hence, no more than this
+        many distinct objects can be locked at any one time.  This parameter
+        controls the average number of object locks allocated for each
+        transaction;  individual transactions can lock more objects as long as
+        the locks of all transactions fit in the lock table.  This is
+        <emphasis>not</emphasis> 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 queries
+        that touch many different tables in a single transaction, e.g., query
+        of a parent table with many children.  This parameter can only be set
+        at server start.
        </para>
 
        <para>
@@ -10269,19 +10268,17 @@ dynamic_library_path = 'C:\tools\postgresql;H:\my_project\lib;$libdir'
       <listitem>
        <para>
         The shared predicate lock table tracks locks on
-        <varname>max_pred_locks_per_transaction</varname> * (<xref
-        linkend="guc-max-connections"/> + <xref
-        linkend="guc-max-prepared-transactions"/>) objects (e.g., tables);
-        hence, no more than this many distinct objects can be locked at
-        any one time.  This parameter controls the average number of object
-        locks allocated for each transaction;  individual transactions
-        can lock more objects as long as the locks of all transactions
-        fit in the lock table.  This is <emphasis>not</emphasis> the number of
-        rows that can be locked; that value is unlimited.  The default,
-        64, has generally been sufficient in testing, 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.
+        <varname>max_pred_locks_per_transaction</varname> objects (e.g.,
+        tables) per eligible process or prepared transaction; hence, no more
+        than this many distinct objects can be locked at any one time.  This
+        parameter controls the average number of object locks allocated for
+        each transaction;  individual transactions can lock more objects as
+        long as the locks of all transactions fit in the lock table.  This is
+        <emphasis>not</emphasis> the number of rows that can be locked; that
+        value is unlimited.  The default, 64, has generally been sufficient in
+        testing, 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.
        </para>
       </listitem>
      </varlistentry>
diff --git a/src/backend/utils/misc/guc_tables.c b/src/backend/utils/misc/guc_tables.c
index e8e8245e91..c07d2a8775 100644
--- a/src/backend/utils/misc/guc_tables.c
+++ b/src/backend/utils/misc/guc_tables.c
@@ -2599,9 +2599,9 @@ struct config_int ConfigureNamesInt[] =
 	{
 		{"max_locks_per_transaction", PGC_POSTMASTER, LOCK_MANAGEMENT,
 			gettext_noop("Sets the maximum number of locks per transaction."),
-			gettext_noop("The shared lock table is sized on the assumption that "
-						 "at most max_locks_per_transaction * max_connections distinct "
-						 "objects will need to be locked at any one time.")
+			gettext_noop("The shared lock table is sized on the assumption that at most "
+						 "max_locks_per_transaction objects per eligible process or prepared "
+						 "transaction will need to be locked at any one time.")
 		},
 		&max_locks_per_xact,
 		64, 10, INT_MAX,
@@ -2612,8 +2612,8 @@ struct config_int ConfigureNamesInt[] =
 		{"max_pred_locks_per_transaction", PGC_POSTMASTER, LOCK_MANAGEMENT,
 			gettext_noop("Sets the maximum number of predicate locks per transaction."),
 			gettext_noop("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.")
+						 "at most max_pred_locks_per_transaction objects per eligible process "
+						 "or prepared transaction will need to be locked at any one time.")
 		},
 		&max_predicate_locks_per_xact,
 		64, 10, INT_MAX,
-- 
2.39.1.windows.1

