diff options
author | Fujii Masao <fujii@postgresql.org> | 2025-03-14 23:14:12 +0900 |
---|---|---|
committer | Fujii Masao <fujii@postgresql.org> | 2025-03-14 23:14:12 +0900 |
commit | 6d376c3b0d1e79c318d2a1c04097025784e28377 (patch) | |
tree | d1ed6941bfa91892223567b1aa2659a31abc660f /doc/src | |
parent | e80171d57c25caf4362a7de17e96195f905386ea (diff) | |
download | postgresql-6d376c3b0d1e79c318d2a1c04097025784e28377.tar.gz postgresql-6d376c3b0d1e79c318d2a1c04097025784e28377.zip |
Add GUC option to log lock acquisition failures.
This commit introduces a new GUC, log_lock_failure, which controls whether
a detailed log message is produced when a lock acquisition fails. Currently,
it only supports logging lock failures caused by SELECT ... NOWAIT.
The log message includes information about all processes holding or
waiting for the lock that couldn't be acquired, helping users analyze and
diagnose the causes of lock failures.
Currently, this option does not log failures from SELECT ... SKIP LOCKED,
as that could generate excessive log messages if many locks are skipped,
causing unnecessary noise.
This mechanism can be extended in the future to support for logging
lock failures from other commands, such as LOCK TABLE ... NOWAIT.
Author: Yuki Seino <seinoyu@oss.nttdata.com>
Co-authored-by: Fujii Masao <masao.fujii@gmail.com>
Reviewed-by: Jelte Fennema-Nio <postgres@jeltef.nl>
Discussion: https://postgr.es/m/411280a186cc26ef7034e0f2dfe54131@oss.nttdata.com
Diffstat (limited to 'doc/src')
-rw-r--r-- | doc/src/sgml/config.sgml | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml index 8c82b39a89d..3d62c8bd274 100644 --- a/doc/src/sgml/config.sgml +++ b/doc/src/sgml/config.sgml @@ -7757,6 +7757,26 @@ log_line_prefix = '%m [%p] %q%u@%d/%a ' </listitem> </varlistentry> + <varlistentry id="guc-log-lock-failure" xreflabel="log_lock_failure"> + <term><varname>log_lock_failure</varname> (<type>boolean</type>) + <indexterm> + <primary><varname>log_lock_failure</varname> configuration parameter</primary> + </indexterm> + </term> + <listitem> + <para> + Controls whether a detailed log message is produced + when a lock acquisition fails. This is useful for analyzing + the causes of lock failures. Currently, only lock failures + due to <literal>SELECT NOWAIT</literal> is supported. + The default is <literal>off</literal>. Only superusers and + users with the appropriate <literal>SET</literal> privilege + can change this setting. + </para> + </listitem> + </varlistentry> + + <varlistentry id="guc-log-recovery-conflict-waits" xreflabel="log_recovery_conflict_waits"> <term><varname>log_recovery_conflict_waits</varname> (<type>boolean</type>) <indexterm> |