1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-14 18:42:34 +03:00

Doc: improve descriptions of max_[pred_]locks_per_transaction GUCs.

The old wording described these as being multiplied by max_connections
plus max_prepared_transactions, which hasn't been exactly right for
some time thanks to the addition of various auxiliary processes.
Moreover, exactness here is a bit pointless given that the lock tables
can expand into the initially-unallocated "slop" space in shared
memory.  Rather than trying to track exactly what the code is doing,
let's just use the term "server processes".

Likewise adjust these GUCs' description strings in guc_tables.c.

Wang Wei, reviewed by Nathan Bossart and myself

Discussion: https://postgr.es/m/OS3PR01MB6275BDD09C9B875C65FCC5AB9EA39@OS3PR01MB6275.jpnprd01.prod.outlook.com
This commit is contained in:
Tom Lane
2023-04-07 13:29:29 -04:00
parent 888f2ea0a8
commit ff245a3788
2 changed files with 18 additions and 20 deletions

View File

@ -10236,13 +10236,12 @@ dynamic_library_path = 'C:\tools\postgresql;H:\my_project\lib;$libdir'
</term> </term>
<listitem> <listitem>
<para> <para>
The shared lock table tracks locks on The shared lock table has space for
<varname>max_locks_per_transaction</varname> * (<xref <varname>max_locks_per_transaction</varname> objects
linkend="guc-max-connections"/> + <xref (e.g., tables) per server process or prepared transaction;
linkend="guc-max-prepared-transactions"/>) objects (e.g., tables);
hence, no more than this many distinct objects can be locked at hence, no more than this many distinct objects can be locked at
any one time. This parameter controls the average number of object any one time. This parameter limits the average number of object
locks allocated for each transaction; individual transactions locks used by each transaction; individual transactions
can lock more objects as long as the locks of all 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 fit in the lock table. This is <emphasis>not</emphasis> the number of
rows that can be locked; that value is unlimited. The default, rows that can be locked; that value is unlimited. The default,
@ -10253,8 +10252,8 @@ dynamic_library_path = 'C:\tools\postgresql;H:\my_project\lib;$libdir'
</para> </para>
<para> <para>
When running a standby server, you must set this parameter to the When running a standby server, you must set this parameter to have the
same or higher value than on the primary server. Otherwise, queries same or higher value as on the primary server. Otherwise, queries
will not be allowed in the standby server. will not be allowed in the standby server.
</para> </para>
</listitem> </listitem>
@ -10268,17 +10267,16 @@ dynamic_library_path = 'C:\tools\postgresql;H:\my_project\lib;$libdir'
</term> </term>
<listitem> <listitem>
<para> <para>
The shared predicate lock table tracks locks on The shared predicate lock table has space for
<varname>max_pred_locks_per_transaction</varname> * (<xref <varname>max_pred_locks_per_transaction</varname> objects
linkend="guc-max-connections"/> + <xref (e.g., tables) per server process or prepared transaction;
linkend="guc-max-prepared-transactions"/>) objects (e.g., tables);
hence, no more than this many distinct objects can be locked at hence, no more than this many distinct objects can be locked at
any one time. This parameter controls the average number of object any one time. This parameter limits the average number of object
locks allocated for each transaction; individual transactions locks used by each transaction; individual transactions
can lock more objects as long as the locks of all 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 fit in the lock table. This is <emphasis>not</emphasis> the number of
rows that can be locked; that value is unlimited. The default, rows that can be locked; that value is unlimited. The default,
64, has generally been sufficient in testing, but you might need to 64, has historically proven sufficient, but you might need to
raise this value if you have clients that touch many different raise this value if you have clients that touch many different
tables in a single serializable transaction. This parameter can tables in a single serializable transaction. This parameter can
only be set at server start. only be set at server start.

View File

@ -2599,9 +2599,9 @@ struct config_int ConfigureNamesInt[] =
{ {
{"max_locks_per_transaction", PGC_POSTMASTER, LOCK_MANAGEMENT, {"max_locks_per_transaction", PGC_POSTMASTER, LOCK_MANAGEMENT,
gettext_noop("Sets the maximum number of locks per transaction."), gettext_noop("Sets the maximum number of locks per transaction."),
gettext_noop("The shared lock table is sized on the assumption that " gettext_noop("The shared lock table is sized on the assumption that at most "
"at most max_locks_per_transaction * max_connections distinct " "max_locks_per_transaction objects per server process or prepared "
"objects will need to be locked at any one time.") "transaction will need to be locked at any one time.")
}, },
&max_locks_per_xact, &max_locks_per_xact,
64, 10, INT_MAX, 64, 10, INT_MAX,
@ -2612,8 +2612,8 @@ struct config_int ConfigureNamesInt[] =
{"max_pred_locks_per_transaction", PGC_POSTMASTER, LOCK_MANAGEMENT, {"max_pred_locks_per_transaction", PGC_POSTMASTER, LOCK_MANAGEMENT,
gettext_noop("Sets the maximum number of predicate locks per transaction."), gettext_noop("Sets the maximum number of predicate locks per transaction."),
gettext_noop("The shared predicate lock table is sized on the assumption that " gettext_noop("The shared predicate lock table is sized on the assumption that "
"at most max_pred_locks_per_transaction * max_connections distinct " "at most max_pred_locks_per_transaction objects per server process "
"objects will need to be locked at any one time.") "or prepared transaction will need to be locked at any one time.")
}, },
&max_predicate_locks_per_xact, &max_predicate_locks_per_xact,
64, 10, INT_MAX, 64, 10, INT_MAX,