From d43837d03067487560af481474ae985df894f786 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Sat, 16 Mar 2013 23:22:17 -0400 Subject: 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 --- doc/src/sgml/config.sgml | 40 +++++++++++++++++++++++++++++++++++++--- 1 file changed, 37 insertions(+), 3 deletions(-) (limited to 'doc/src') 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; - 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 log_min_error_statement is set to 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; Setting statement_timeout in - postgresql.conf is not recommended because it - affects all sessions. + postgresql.conf is not recommended because it would + affect all sessions. + + + + + + lock_timeout (integer) + + lock_timeout configuration parameter + + + + 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 LOCK TABLE, or SELECT + FOR UPDATE without NOWAIT) and to implicitly-acquired + locks. If log_min_error_statement is set to + ERROR or lower, the statement that timed out will be + logged. A value of zero (the default) turns this off. + + + + Unlike statement_timeout, this timeout can only occur + while waiting for locks. Note that if statement_timeout + is nonzero, it is rather pointless to set lock_timeout to + the same or larger value, since the statement timeout would always + trigger first. + + + + Setting lock_timeout in + postgresql.conf is not recommended because it would + affect all sessions. -- cgit v1.2.3