Log statement sample - take two - Mailing list pgsql-hackers

From Adrien Nayrat
Subject Log statement sample - take two
Date
Msg-id bbe0a1a8-a8f7-3be2-155a-888e661cc06c@anayrat.info
Whole thread Raw
Responses Re: Log statement sample - take two
List pgsql-hackers
Hello,

This patch propose a new way to sample statement to logs.

As a reminder, this feature was committed in PG12[1] then reverted[2] after the
proposition of log_statement_sample_limit[3]

The first implementation added a new GUC to sample statement logged by
log_min_duration_statement. Then, we wanted to add the ability to log all
statement whose duration exceed log_statement_sample_limit.

This was confusing because log_min_duration behaves as a minimum to enable
sampling. While log_statement_sample_limit behave as maximum to disable it.[4]

Tomas Vondra proposed to use two minimum thresholds:

> 1) log_min_duration_sample - enables sampling of commands, using the
> existing GUC log_statement_sample_rate
>
> 2) log_min_duration_statement - logs all commands exceeding this

This patch implement this idea.

PS: I notice I forgot to mention "Only superusers can change this setting" in
the log_transaction_sample_rate documentation. It attached a second patch to fix
this.


Regards,

1:
https://git.postgresql.org/gitweb/?p=postgresql.git;a=commit;h=799e220346f1387e823a4dbdc3b1c8c3cdc5c3e0
2:
https://git.postgresql.org/gitweb/?p=postgresql.git;a=commit;h=75506195da81d75597a4025b72f8367e6c45f60d
3:
https://www.postgresql.org/message-id/CAFj8pRDS8tQ3Wviw9%3DAvODyUciPSrGeMhJi_WPE%2BEB8%2B4gLL-Q%40mail.gmail.com
4:
https://www.postgresql.org/message-id/20190727221948.irg6sfqh57dynoc7%40development

--
Adrien NAYRAT


Attachment

pgsql-hackers by date:

Previous
From: Andrew Dunstan
Date:
Subject: Re: Backport "WITH ... AS MATERIALIZED" syntax to <12?
Next
From: Isaac Morland
Date:
Subject: Re: Backport "WITH ... AS MATERIALIZED" syntax to <12?