aboutsummaryrefslogtreecommitdiff
path: root/doc/src
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2013-03-16 23:22:17 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2013-03-16 23:22:57 -0400
commitd43837d03067487560af481474ae985df894f786 (patch)
tree7289d038a184fa3dc59195aaa27538714ea85ad9 /doc/src
parentd2bef5f7db5f3afdbbb3f58b8eff49f0bc7ef790 (diff)
downloadpostgresql-d43837d03067487560af481474ae985df894f786.tar.gz
postgresql-d43837d03067487560af481474ae985df894f786.zip
Add lock_timeout configuration parameter.
This GUC allows limiting the time spent waiting to acquire any one heavyweight lock. In support of this, improve the recently-added timeout infrastructure to permit efficiently enabling or disabling multiple timeouts at once. That reduces the performance hit from turning on lock_timeout, though it's still not zero. Zoltán Böszörményi, reviewed by Tom Lane, Stephen Frost, and Hari Babu
Diffstat (limited to 'doc/src')
-rw-r--r--doc/src/sgml/config.sgml40
1 files changed, 37 insertions, 3 deletions
diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml
index 575b40b58df..8c520e1267b 100644
--- a/doc/src/sgml/config.sgml
+++ b/doc/src/sgml/config.sgml
@@ -5077,7 +5077,7 @@ COPY postgres_log FROM '/full/path/to/logfile.csv' WITH csv;
</indexterm>
<listitem>
<para>
- Abort any statement that takes over the specified number of
+ Abort any statement that takes more than the specified number of
milliseconds, starting from the time the command arrives at the server
from the client. If <varname>log_min_error_statement</> is set to
<literal>ERROR</> or lower, the statement that timed out will also be
@@ -5086,8 +5086,42 @@ COPY postgres_log FROM '/full/path/to/logfile.csv' WITH csv;
<para>
Setting <varname>statement_timeout</> in
- <filename>postgresql.conf</> is not recommended because it
- affects all sessions.
+ <filename>postgresql.conf</> is not recommended because it would
+ affect all sessions.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry id="guc-lock-timeout" xreflabel="lock_timeout">
+ <term><varname>lock_timeout</varname> (<type>integer</type>)</term>
+ <indexterm>
+ <primary><varname>lock_timeout</> configuration parameter</primary>
+ </indexterm>
+ <listitem>
+ <para>
+ Abort any statement that waits longer than the specified number of
+ milliseconds while attempting to acquire a lock on a table, index,
+ row, or other database object. The time limit applies separately to
+ each lock acquisition attempt. The limit applies both to explicit
+ locking requests (such as <command>LOCK TABLE</>, or <command>SELECT
+ FOR UPDATE</> without <literal>NOWAIT</>) and to implicitly-acquired
+ locks. If <varname>log_min_error_statement</> is set to
+ <literal>ERROR</> or lower, the statement that timed out will be
+ logged. A value of zero (the default) turns this off.
+ </para>
+
+ <para>
+ Unlike <varname>statement_timeout</>, this timeout can only occur
+ while waiting for locks. Note that if <varname>statement_timeout</>
+ is nonzero, it is rather pointless to set <varname>lock_timeout</> to
+ the same or larger value, since the statement timeout would always
+ trigger first.
+ </para>
+
+ <para>
+ Setting <varname>lock_timeout</> in
+ <filename>postgresql.conf</> is not recommended because it would
+ affect all sessions.
</para>
</listitem>
</varlistentry>