1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-31 22:04:40 +03:00

Add GUCs for predicate lock promotion thresholds.

Defaults match the fixed behavior of prior releases, but now DBAs
have better options to tune serializable workloads.

It might be nice to be able to set this per relation, but that part
will need to wait for another release.

Author: Dagfinn Ilmari Mannsåker
This commit is contained in:
Kevin Grittner
2017-04-07 21:38:05 -05:00
parent 9c7f5229ad
commit c63172d60f
6 changed files with 98 additions and 18 deletions

View File

@ -7337,7 +7337,43 @@ dynamic_library_path = 'C:\tools\postgresql;H:\my_project\lib;$libdir'
tables in a single serializable transaction. This parameter can
only be set at server start.
</para>
</listitem>
</varlistentry>
<varlistentry id="guc-max-pred-locks-per-relation" xreflabel="max_pred_locks_per_relation">
<term><varname>max_pred_locks_per_relation</varname> (<type>integer</type>)
<indexterm>
<primary><varname>max_pred_locks_per_relation</> configuration parameter</primary>
</indexterm>
</term>
<listitem>
<para>
This controls how many pages or tuples of a single relation can be
predicate-locked before the lock is promoted to covering the whole
relation. Values greater than or equal to zero mean an absolute
limit, while negative values
mean <xref linkend="guc-max-pred-locks-per-transaction"> divided by
the absolute value of this setting. The default is -2, which keeps
the behaviour from previous versions of <productname>PostgreSQL</>.
This parameter can only be set in the <filename>postgresql.conf</>
file or on the server command line.
</para>
</listitem>
</varlistentry>
<varlistentry id="guc-max-pred-locks-per-page" xreflabel="max_pred_locks_per_page">
<term><varname>max_pred_locks_per_page</varname> (<type>integer</type>)
<indexterm>
<primary><varname>max_pred_locks_per_page</> configuration parameter</primary>
</indexterm>
</term>
<listitem>
<para>
This controls how many rows on a single page can be predicate-locked
before the lock is promoted to covering the whole page. The default
is 2. This parameter can only be set in
the <filename>postgresql.conf</> file or on the server command line.
</para>
</listitem>
</varlistentry>

View File

@ -765,7 +765,9 @@ ERROR: could not serialize access due to read/write dependencies among transact
locks into a single relation-level predicate lock because the predicate
lock table is short of memory, an increase in the rate of serialization
failures may occur. You can avoid this by increasing
<xref linkend="guc-max-pred-locks-per-transaction">.
<xref linkend="guc-max-pred-locks-per-transaction">,
<xref linkend="guc-max-pred-locks-per-relation">, and/or
<xref linkend="guc-max-pred-locks-per-page">.
</para>
</listitem>
<listitem>