Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes15kdownloads
runtime-config-locks.html86 linesDownload Raw Back to html
1<?xml version="1.0" encoding="UTF-8" standalone="no"?>2<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>20.12. Lock Management</title><link rel="stylesheet" type="text/css" href="stylesheet.css" /><link rev="made" href="pgsql-docs@lists.postgresql.org" /><meta name="generator" content="DocBook XSL Stylesheets Vsnapshot" /><link rel="prev" href="runtime-config-client.html" title="20.11. Client Connection Defaults" /><link rel="next" href="runtime-config-compatible.html" title="20.13. Version and Platform Compatibility" /></head><body id="docContent" class="container-fluid col-10"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="5" align="center">20.12. Lock Management</th></tr><tr><td width="10%" align="left"><a accesskey="p" href="runtime-config-client.html" title="20.11. Client Connection Defaults">Prev</a> </td><td width="10%" align="left"><a accesskey="u" href="runtime-config.html" title="Chapter 20. Server Configuration">Up</a></td><th width="60%" align="center">Chapter 20. Server Configuration</th><td width="10%" align="right"><a accesskey="h" href="index.html" title="PostgreSQL 16.3 Documentation">Home</a></td><td width="10%" align="right"> <a accesskey="n" href="runtime-config-compatible.html" title="20.13. Version and Platform Compatibility">Next</a></td></tr></table><hr /></div><div class="sect1" id="RUNTIME-CONFIG-LOCKS"><div class="titlepage"><div><div><h2 class="title" style="clear: both">20.12. Lock Management <a href="#RUNTIME-CONFIG-LOCKS" class="id_link">#</a></h2></div></div></div><div class="variablelist"><dl class="variablelist"><dt id="GUC-DEADLOCK-TIMEOUT"><span class="term"><code class="varname">deadlock_timeout</code> (<code class="type">integer</code>)3      <a id="id-1.6.7.15.2.1.1.3" class="indexterm"></a>4      <a id="id-1.6.7.15.2.1.1.4" class="indexterm"></a>5      <a id="id-1.6.7.15.2.1.1.5" class="indexterm"></a>6      </span> <a href="#GUC-DEADLOCK-TIMEOUT" class="id_link">#</a></dt><dd><p>7        This is the amount of time to wait on a lock8        before checking to see if there is a deadlock condition. The9        check for deadlock is relatively expensive, so the server doesn't run10        it every time it waits for a lock. We optimistically assume11        that deadlocks are not common in production applications and12        just wait on the lock for a while before checking for a13        deadlock. Increasing this value reduces the amount of time14        wasted in needless deadlock checks, but slows down reporting of15        real deadlock errors.16        If this value is specified without units, it is taken as milliseconds.17        The default is one second (<code class="literal">1s</code>),18        which is probably about the smallest value you would want in19        practice. On a heavily loaded server you might want to raise it.20        Ideally the setting should exceed your typical transaction time,21        so as to improve the odds that a lock will be released before22        the waiter decides to check for deadlock.23        Only superusers and users with the appropriate <code class="literal">SET</code>24        privilege can change this setting.25       </p><p>26        When <a class="xref" href="runtime-config-logging.html#GUC-LOG-LOCK-WAITS">log_lock_waits</a> is set,27        this parameter also determines the amount of time to wait before28        a log message is issued about the lock wait.  If you are trying29        to investigate locking delays you might want to set a shorter than30        normal <code class="varname">deadlock_timeout</code>.31       </p></dd><dt id="GUC-MAX-LOCKS-PER-TRANSACTION"><span class="term"><code class="varname">max_locks_per_transaction</code> (<code class="type">integer</code>)32      <a id="id-1.6.7.15.2.2.1.3" class="indexterm"></a>33      </span> <a href="#GUC-MAX-LOCKS-PER-TRANSACTION" class="id_link">#</a></dt><dd><p>34        The shared lock table has space for35        <code class="varname">max_locks_per_transaction</code> objects36        (e.g., tables) per server process or prepared transaction;37        hence, no more than this many distinct objects can be locked at38        any one time.  This parameter limits the average number of object39        locks used by each transaction; individual transactions40        can lock more objects as long as the locks of all transactions41        fit in the lock table.  This is <span class="emphasis"><em>not</em></span> the number of42        rows that can be locked; that value is unlimited.  The default,43        64, has historically proven sufficient, but you might need to44        raise this value if you have queries that touch many different45        tables in a single transaction, e.g., query of a parent table with46        many children.  This parameter can only be set at server start.47       </p><p>48        When running a standby server, you must set this parameter to have the49        same or higher value as on the primary server. Otherwise, queries50        will not be allowed in the standby server.51       </p></dd><dt id="GUC-MAX-PRED-LOCKS-PER-TRANSACTION"><span class="term"><code class="varname">max_pred_locks_per_transaction</code> (<code class="type">integer</code>)52      <a id="id-1.6.7.15.2.3.1.3" class="indexterm"></a>53      </span> <a href="#GUC-MAX-PRED-LOCKS-PER-TRANSACTION" class="id_link">#</a></dt><dd><p>54        The shared predicate lock table has space for55        <code class="varname">max_pred_locks_per_transaction</code> objects56        (e.g., tables) per server process or prepared transaction;57        hence, no more than this many distinct objects can be locked at58        any one time.  This parameter limits the average number of object59        locks used by each transaction; individual transactions60        can lock more objects as long as the locks of all transactions61        fit in the lock table.  This is <span class="emphasis"><em>not</em></span> the number of62        rows that can be locked; that value is unlimited.  The default,63        64, has historically proven sufficient, but you might need to64        raise this value if you have clients that touch many different65        tables in a single serializable transaction. This parameter can66        only be set at server start.67       </p></dd><dt id="GUC-MAX-PRED-LOCKS-PER-RELATION"><span class="term"><code class="varname">max_pred_locks_per_relation</code> (<code class="type">integer</code>)68      <a id="id-1.6.7.15.2.4.1.3" class="indexterm"></a>69      </span> <a href="#GUC-MAX-PRED-LOCKS-PER-RELATION" class="id_link">#</a></dt><dd><p>70        This controls how many pages or tuples of a single relation can be71        predicate-locked before the lock is promoted to covering the whole72        relation.  Values greater than or equal to zero mean an absolute73        limit, while negative values74        mean <a class="xref" href="runtime-config-locks.html#GUC-MAX-PRED-LOCKS-PER-TRANSACTION">max_pred_locks_per_transaction</a> divided by75        the absolute value of this setting.  The default is -2, which keeps76        the behavior from previous versions of <span class="productname">PostgreSQL</span>.77        This parameter can only be set in the <code class="filename">postgresql.conf</code>78        file or on the server command line.79       </p></dd><dt id="GUC-MAX-PRED-LOCKS-PER-PAGE"><span class="term"><code class="varname">max_pred_locks_per_page</code> (<code class="type">integer</code>)80      <a id="id-1.6.7.15.2.5.1.3" class="indexterm"></a>81      </span> <a href="#GUC-MAX-PRED-LOCKS-PER-PAGE" class="id_link">#</a></dt><dd><p>82        This controls how many rows on a single page can be predicate-locked83        before the lock is promoted to covering the whole page.  The default84        is 2.  This parameter can only be set in85        the <code class="filename">postgresql.conf</code> file or on the server command line.86       </p></dd></dl></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="runtime-config-client.html" title="20.11. Client Connection Defaults">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="runtime-config.html" title="Chapter 20. Server Configuration">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="runtime-config-compatible.html" title="20.13. Version and Platform Compatibility">Next</a></td></tr><tr><td width="40%" align="left" valign="top">20.11. Client Connection Defaults </td><td width="20%" align="center"><a accesskey="h" href="index.html" title="PostgreSQL 16.3 Documentation">Home</a></td><td width="40%" align="right" valign="top"> 20.13. Version and Platform Compatibility</td></tr></table></div></body></html>
codekingpro/portable-devtools · Team Ai