Re: Set log_lock_waits=on by default - Mailing list pgsql-hackers

From Nikolay Samokhvalov
Subject Re: Set log_lock_waits=on by default
Date
Msg-id CANNMO+LTYrO35eNsa5qbCf+2UuSRWFYFdORGXwyMe=+Sa_MV1Q@mail.gmail.com
Whole thread Raw
In response to Set log_lock_waits=on by default  (Laurenz Albe <laurenz.albe@cybertec.at>)
Responses Re: Set log_lock_waits=on by default
List pgsql-hackers
On Thu, Dec 21, 2023 at 05:29 Laurenz Albe <laurenz.albe@cybertec.at> wrote:
Here is a patch to implement this.
Being stuck behind a lock for more than a second is almost
always a problem, so it is reasonable to turn this on by default.

I think it's a very good idea. On all heavily loaded systems I have observed so far, we always have turned it on. 1s (default deadlock_timeout) is quite large value for web/mobile apps, meaning that default frequency of logging is quite low, so any potential suffering from observer effect doesn't happen -- saturation related active session number happens much, much earlier, even if you have very slow disk IO for logging.

At the same time, I like the idea by Robert to separate logging of log waits and deadlock_timeout logic -- the current implementation is a quite confusing for new users. I also had cases when people wanted to log lock waits earlier than deadlock detection. And also, most always lock wait logging lacks the information another the blocking session (its state, and last query, first of all), but is maybe an off topic worthing another effort of improvements.

Nik

pgsql-hackers by date:

Previous
From: Bertrand Drouvot
Date:
Subject: Re: Track in pg_replication_slots the reason why slots conflict?
Next
From: Alexander Lakhin
Date:
Subject: Re: trying again to get incremental backup