gooderp18绿色标准版
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

83 lines
8.5KB

  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>19.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 V1.79.1" /><link rel="prev" href="runtime-config-client.html" title="19.11. Client Connection Defaults" /><link rel="next" href="runtime-config-compatible.html" title="19.13. Version and Platform Compatibility" /></head><body><div xmlns="http://www.w3.org/TR/xhtml1/transitional" class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="5" align="center">19.12. Lock Management</th></tr><tr><td width="10%" align="left"><a accesskey="p" href="runtime-config-client.html" title="19.11. Client Connection Defaults">Prev</a> </td><td width="10%" align="left"><a accesskey="u" href="runtime-config.html" title="Chapter 19. Server Configuration">Up</a></td><th width="60%" align="center">Chapter 19. Server Configuration</th><td width="10%" align="right"><a accesskey="h" href="index.html" title="PostgreSQL 12.4 Documentation">Home</a></td><td width="10%" align="right"> <a accesskey="n" href="runtime-config-compatible.html" title="19.13. Version and Platform Compatibility">Next</a></td></tr></table><hr></hr></div><div class="sect1" id="RUNTIME-CONFIG-LOCKS"><div class="titlepage"><div><div><h2 class="title" style="clear: both">19.12. Lock Management</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.6.15.2.1.1.3" class="indexterm"></a>
  4. <a id="id-1.6.6.15.2.1.1.4" class="indexterm"></a>
  5. <a id="id-1.6.6.15.2.1.1.5" class="indexterm"></a>
  6. </span></dt><dd><p>
  7. This is the amount of time to wait on a lock
  8. before checking to see if there is a deadlock condition. The
  9. check for deadlock is relatively expensive, so the server doesn't run
  10. it every time it waits for a lock. We optimistically assume
  11. that deadlocks are not common in production applications and
  12. just wait on the lock for a while before checking for a
  13. deadlock. Increasing this value reduces the amount of time
  14. wasted in needless deadlock checks, but slows down reporting of
  15. 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 in
  19. 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 before
  22. the waiter decides to check for deadlock. Only superusers can change
  23. this setting.
  24. </p><p>
  25. When <a class="xref" href="runtime-config-logging.html#GUC-LOG-LOCK-WAITS">log_lock_waits</a> is set,
  26. this parameter also determines the amount of time to wait before
  27. a log message is issued about the lock wait. If you are trying
  28. to investigate locking delays you might want to set a shorter than
  29. normal <code class="varname">deadlock_timeout</code>.
  30. </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>)
  31. <a id="id-1.6.6.15.2.2.1.3" class="indexterm"></a>
  32. </span></dt><dd><p>
  33. The shared lock table tracks locks on
  34. <code class="varname">max_locks_per_transaction</code> * (<a class="xref" href="runtime-config-connection.html#GUC-MAX-CONNECTIONS">max_connections</a> + <a class="xref" href="runtime-config-resource.html#GUC-MAX-PREPARED-TRANSACTIONS">max_prepared_transactions</a>) objects (e.g., tables);
  35. hence, no more than this many distinct objects can be locked at
  36. any one time. This parameter controls the average number of object
  37. locks allocated for each transaction; individual transactions
  38. can lock more objects as long as the locks of all transactions
  39. fit in the lock table. This is <span class="emphasis"><em>not</em></span> the number of
  40. rows that can be locked; that value is unlimited. The default,
  41. 64, has historically proven sufficient, but you might need to
  42. raise this value if you have queries that touch many different
  43. tables in a single transaction, e.g. query of a parent table with
  44. many children. This parameter can only be set at server start.
  45. </p><p>
  46. When running a standby server, you must set this parameter to the
  47. same or higher value than on the master server. Otherwise, queries
  48. will not be allowed in the standby server.
  49. </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>)
  50. <a id="id-1.6.6.15.2.3.1.3" class="indexterm"></a>
  51. </span></dt><dd><p>
  52. The shared predicate lock table tracks locks on
  53. <code class="varname">max_pred_locks_per_transaction</code> * (<a class="xref" href="runtime-config-connection.html#GUC-MAX-CONNECTIONS">max_connections</a> + <a class="xref" href="runtime-config-resource.html#GUC-MAX-PREPARED-TRANSACTIONS">max_prepared_transactions</a>) objects (e.g., tables);
  54. hence, no more than this many distinct objects can be locked at
  55. any one time. This parameter controls the average number of object
  56. locks allocated for each transaction; individual transactions
  57. can lock more objects as long as the locks of all transactions
  58. fit in the lock table. This is <span class="emphasis"><em>not</em></span> the number of
  59. rows that can be locked; that value is unlimited. The default,
  60. 64, has generally been sufficient in testing, but you might need to
  61. raise this value if you have clients that touch many different
  62. tables in a single serializable transaction. This parameter can
  63. only be set at server start.
  64. </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>)
  65. <a id="id-1.6.6.15.2.4.1.3" class="indexterm"></a>
  66. </span></dt><dd><p>
  67. This controls how many pages or tuples of a single relation can be
  68. predicate-locked before the lock is promoted to covering the whole
  69. relation. Values greater than or equal to zero mean an absolute
  70. limit, while negative values
  71. mean <a class="xref" href="runtime-config-locks.html#GUC-MAX-PRED-LOCKS-PER-TRANSACTION">max_pred_locks_per_transaction</a> divided by
  72. the absolute value of this setting. The default is -2, which keeps
  73. the behavior from previous versions of <span class="productname">PostgreSQL</span>.
  74. This parameter can only be set in the <code class="filename">postgresql.conf</code>
  75. file or on the server command line.
  76. </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>)
  77. <a id="id-1.6.6.15.2.5.1.3" class="indexterm"></a>
  78. </span></dt><dd><p>
  79. This controls how many rows on a single page can be predicate-locked
  80. before the lock is promoted to covering the whole page. The default
  81. is 2. This parameter can only be set in
  82. the <code class="filename">postgresql.conf</code> file or on the server command line.
  83. </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">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="runtime-config.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="runtime-config-compatible.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">19.11. Client Connection Defaults </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> 19.13. Version and Platform Compatibility</td></tr></table></div></body></html>
上海开阖软件有限公司 沪ICP备12045867号-1