From: Laurenz Albe <laurenz.albe@cybertec.at>
To: Robert Haas <robertmhaas@gmail.com>
Cc: pgsql-hackers@lists.postgresql.org
Subject: Re: Set log_lock_waits=on by default
Date: Fri, 22 Dec 2023 12:00:33 +0100
Message-ID: <cf3e8e3aadf380d7a6627fccdbc086b2c36d98df.camel@cybertec.at> (raw)
In-Reply-To: <CA+TgmobPaKeiXQ3q2Qb-ToLGPxy1kkOwi1AS16ZS0ryPKvPHTw@mail.gmail.com>
References: <b8b8502915e50f44deb111bc0b43a99e2733e117.camel@cybertec.at>
<CA+TgmobPaKeiXQ3q2Qb-ToLGPxy1kkOwi1AS16ZS0ryPKvPHTw@mail.gmail.com>
On Thu, 2023-12-21 at 09:14 -0500, Robert Haas wrote:
>
> I think it depends somewhat on the lock type, and also on your
> threshold for what constitutes a problem. For example, you can wait
> for 1 second for a relation extension lock pretty easily, I think,
> just because the I/O system is busy. Or I think also a VXID lock held
> by some transaction that has a tuple locked could be not particularly
> exciting. A conflict on a relation lock seems more likely to represent
> a real issue, but I guess it's all kind of a judgement call. A second
> isn't really all that long on an overloaded system, and I see an awful
> lot of overloaded systems (because those are the people who call me).
Sure, you don't want "log_lock_waits = on" in all conceivable databases.
I have seen applications that use database locks to synchronize
application threads (*shudder*). If it is normal for your database
to experience long lock waits, disable the parameter.
My point is that in the vast majority of cases, long lock waits
indicate a problem that you would like to know about, so the parameter
should default to "on".
(Out of curiosity: what would ever wait for a VXID lock?)
> Just a random idea but what if we separated log_lock_waits from
> deadlock_timeout? Say, it becomes time-valued rather than
> Boolean-valued, but it has to be >= deadlock_timeout? Because I'd
> probably be more interested in hearing about a lock wait that was more
> than say 10 seconds, but I don't necessarily want to wait 10 seconds
> for the deadlock detector to trigger.
That is an appealing thought, but as far as I know, "log_lock_waits"
is implemented by the deadlock detector, which is why it is tied to
"deadlock_timeout". So if we want that, we'd need a separate "live
lock detector". I don't know if we want to go there.
Yours,
Laurenz Albe
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-hackers@postgresql.org
Cc: laurenz.albe@cybertec.at, robertmhaas@gmail.com
Subject: Re: Set log_lock_waits=on by default
In-Reply-To: <cf3e8e3aadf380d7a6627fccdbc086b2c36d98df.camel@cybertec.at>
References: <b8b8502915e50f44deb111bc0b43a99e2733e117.camel@cybertec.at> <CA+TgmobPaKeiXQ3q2Qb-ToLGPxy1kkOwi1AS16ZS0ryPKvPHTw@mail.gmail.com> <cf3e8e3aadf380d7a6627fccdbc086b2c36d98df.camel@cybertec.at>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox