Re: Patch: Show queries of processes holding a lock

Alexey Orlov <aporlov@gmail.com>

From: Alexey Orlov <aporlov@gmail.com>
To: wenhui qiu <qiuwenhuifx@gmail.com>
Cc: pgsql-hackers@lists.postgresql.org
Date: 2024-10-02T09:43:03Z
Lists: pgsql-hackers

Attachments

On Tue, Oct 1, 2024 at 11:45 AM wenhui qiu <qiuwenhuifx@gmail.com> wrote:
>
> Hi Alexey Orlov
>      Thank you for your work on this path,The lock information is recorded in detail,Easy to trace the lock competition at that time there is a detailed lock competition log,But I have a concern,Frequent calls to this function (pgstat_get_backend_current_activity) in heavy lock contention or high concurrency environments may cause performance degradation, especially when processes frequently enter and exit lock waits. Can you add a guc parameter to turn this feature on or off?After all communities for this parameter( log_lock_waits )default values set to on many people concern (https://commitfest.postgresql.org/49/4718/)
>
>
>
> Thanks
>
Yeah, agree, thank you. I just think changing the parameter type would
be nice too.

 typedef enum
{
 LOG_LOCK_WAIT_NONE = 0,
 LOG_LOCK_WAIT_TERSE,
 LOG_LOCK_WAIT_VERBOSE,
} LogLockWaitVerbosity;

LOG_LOCK_WAIT_NONE is "off", LOG_LOCK_WAIT_TERSE is "on",
LOG_LOCK_WAIT_VERBOSE enables  writing the query to to the log.

I've attached a slightly modified patch to use the new log_lock_wait values.

--
Regards,
 Alexey Orlov!