public inbox for [email protected]
help / color / mirror / Atom feedFrom: Laurenz Albe <[email protected]>
To: Shinya Kato <[email protected]>
Cc: Michael Banck <[email protected]>
Cc: Tom Lane <[email protected]>
Cc: Nathan Bossart <[email protected]>
Cc: [email protected]
Subject: Re: Set log_lock_waits=on by default
Date: Sun, 07 Sep 2025 23:46:32 +0200
Message-ID: <[email protected]> (raw)
In-Reply-To: <CAOzEurS0jbDrjmVFgE4QQ_O0bnDtJMaaFsy3=pX0RLYXBcjVpg@mail.gmail.com>
References: <[email protected]>
<[email protected]>
<[email protected]>
<20240206165343.GA3841415@nathanxps13>
<[email protected]>
<[email protected]>
<[email protected]>
<[email protected]>
<CAOzEurS0jbDrjmVFgE4QQ_O0bnDtJMaaFsy3=pX0RLYXBcjVpg@mail.gmail.com>
On Thu, 2025-09-04 at 14:12 +0900, Shinya Kato wrote:
> Due to 635998965 [0], you need to change guc_parameters.dat instead of
> guc_tables.c.
Thanks for pointing that out to me!
Here is an updated patch.
Yours,
Laurenz Albe
Attachments:
[text/x-patch] v2-0001-Default-to-log_lock_waits-on.patch (3.2K, ../[email protected]/2-v2-0001-Default-to-log_lock_waits-on.patch)
download | inline diff:
From aa04f6cf6e7c89f1107ffc6eb661da65082459fe Mon Sep 17 00:00:00 2001
From: Laurenz Albe <[email protected]>
Date: Sun, 7 Sep 2025 23:44:38 +0200
Subject: [PATCH v2] Default to log_lock_waits=on
If someone is stuck behind a lock for more than a second,
that is almost always a problem that is worth a log entry.
Author: Laurenz Albe <[email protected]>
Reviewed-By: Michael Banck <[email protected]>
Reviewed-By: Robert Haas <[email protected]>
Reviewed-By: Christoph Berg <[email protected]>
Reviewed-By: Stephen Frost <[email protected]>
Discussion: https://postgr.es/m/b8b8502915e50f44deb111bc0b43a99e2733e117.camel%40cybertec.at
---
doc/src/sgml/config.sgml | 2 +-
src/backend/storage/lmgr/proc.c | 2 +-
src/backend/utils/misc/guc_parameters.dat | 2 +-
src/backend/utils/misc/postgresql.conf.sample | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml
index 2a3685f474a..3c33d5d0fbc 100644
--- a/doc/src/sgml/config.sgml
+++ b/doc/src/sgml/config.sgml
@@ -7929,7 +7929,7 @@ log_line_prefix = '%m [%p] %q%u@%d/%a '
Controls whether a log message is produced when a session waits
longer than <xref linkend="guc-deadlock-timeout"/> to acquire a
lock. This is useful in determining if lock waits are causing
- poor performance. The default is <literal>off</literal>.
+ poor performance. The default is <literal>on</literal>.
Only superusers and users with the appropriate <literal>SET</literal>
privilege can change this setting.
</para>
diff --git a/src/backend/storage/lmgr/proc.c b/src/backend/storage/lmgr/proc.c
index e9ef0fbfe32..96f29aafc39 100644
--- a/src/backend/storage/lmgr/proc.c
+++ b/src/backend/storage/lmgr/proc.c
@@ -60,7 +60,7 @@ int LockTimeout = 0;
int IdleInTransactionSessionTimeout = 0;
int TransactionTimeout = 0;
int IdleSessionTimeout = 0;
-bool log_lock_waits = false;
+bool log_lock_waits = true;
/* Pointer to this process's PGPROC struct, if any */
PGPROC *MyProc = NULL;
diff --git a/src/backend/utils/misc/guc_parameters.dat b/src/backend/utils/misc/guc_parameters.dat
index 0da01627cfe..6bc6be13d2a 100644
--- a/src/backend/utils/misc/guc_parameters.dat
+++ b/src/backend/utils/misc/guc_parameters.dat
@@ -566,7 +566,7 @@
{ name => 'log_lock_waits', type => 'bool', context => 'PGC_SUSET', group => 'LOGGING_WHAT',
short_desc => 'Logs long lock waits.',
variable => 'log_lock_waits',
- boot_val => 'false',
+ boot_val => 'true',
},
{ name => 'log_lock_failures', type => 'bool', context => 'PGC_SUSET', group => 'LOGGING_WHAT',
diff --git a/src/backend/utils/misc/postgresql.conf.sample b/src/backend/utils/misc/postgresql.conf.sample
index 26c08693564..c36fcb9ab61 100644
--- a/src/backend/utils/misc/postgresql.conf.sample
+++ b/src/backend/utils/misc/postgresql.conf.sample
@@ -624,7 +624,7 @@
# processes
# %% = '%'
# e.g. '<%u%%%d> '
-#log_lock_waits = off # log lock waits >= deadlock_timeout
+#log_lock_waits = on # log lock waits >= deadlock_timeout
#log_lock_failures = off # log lock failures
#log_recovery_conflict_waits = off # log standby recovery conflict waits
# >= deadlock_timeout
--
2.51.0
view thread (15+ messages) latest in thread
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected], [email protected], [email protected], [email protected], [email protected]
Subject: Re: Set log_lock_waits=on by default
In-Reply-To: <[email protected]>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox