pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Use case for enabling log_duration other than benchmarking
6+ messages / 4 participants
[nested] [flat]

* Use case for enabling log_duration other than benchmarking
@ 2023-01-10 13:14  Alicja Kucharczyk <zaledwie10minut@gmail.com>
  0 siblings, 1 reply; 6+ messages in thread

From: Alicja Kucharczyk @ 2023-01-10 13:14 UTC (permalink / raw)
  To: pgsql-general

Do you know any use case for enabling log_duration? Like 3rd party tools
for instance.
I find this parameter pretty much useless (in opposite to
log_min_duration_statement) as it does not show the query text, so besides
having just the timing logged it is of no use in troubleshooting and often
causes huge overhead. Am I missing something?

pozdrawiam,
best regards,
Alicja Kucharczyk

^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: Use case for enabling log_duration other than benchmarking
@ 2023-01-10 13:57  Ron <ronljohnsonjr@gmail.com>
  parent: Alicja Kucharczyk <zaledwie10minut@gmail.com>
  0 siblings, 1 reply; 6+ messages in thread

From: Ron @ 2023-01-10 13:57 UTC (permalink / raw)
  To: pgsql-general@lists.postgresql.org

On 1/10/23 07:14, Alicja Kucharczyk wrote:
> Do you know any use case for enabling log_duration? Like 3rd party tools 
> for instance.
> I find this parameter pretty much useless (in opposite to 
> log_min_duration_statement) as it does not show the query text, so besides 
> having just the timing logged it is of no use in troubleshooting and often 
> causes huge overhead. Am I missing something?

https://www.postgresql.org/docs/current/runtime-config-logging.html


      Note

The difference between enabling|log_duration|and 
settinglog_min_duration_statement 
<https://www.postgresql.org/docs/current/runtime-config-logging.html#GUC-LOG-MIN-DURATION-STATEMENT&g... 
zero is that exceeding|log_min_duration_statement|forces the text of the 
query to be logged, but this option doesn't. Thus, 
if|log_duration|is|on|and|log_min_duration_statement|has a positive value, 
all durations are logged but the query text is included only for statements 
exceeding the threshold. *This behavior can be useful for gathering 
statistics in high-load installations.*



-- 
Born in Arizona, moved to Babylonia.

^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: Use case for enabling log_duration other than benchmarking
@ 2023-01-10 15:57  Alicja Kucharczyk <zaledwie10minut@gmail.com>
  parent: Ron <ronljohnsonjr@gmail.com>
  0 siblings, 2 replies; 6+ messages in thread

From: Alicja Kucharczyk @ 2023-01-10 15:57 UTC (permalink / raw)
  To: Ron <ronljohnsonjr@gmail.com>; +Cc: pgsql-general@lists.postgresql.org

wt., 10 sty 2023 o 14:57 Ron <ronljohnsonjr@gmail.com> napisał(a):

> On 1/10/23 07:14, Alicja Kucharczyk wrote:
>
> Do you know any use case for enabling log_duration? Like 3rd party tools
> for instance.
> I find this parameter pretty much useless (in opposite to
> log_min_duration_statement) as it does not show the query text, so besides
> having just the timing logged it is of no use in troubleshooting and often
> causes huge overhead. Am I missing something?
>
>
> https://www.postgresql.org/docs/current/runtime-config-logging.html
>
> Note
>
> The difference between enabling log_duration and setting
> log_min_duration_statement
> <https://www.postgresql.org/docs/current/runtime-config-logging.html#GUC-LOG-MIN-DURATION-STATEMENT;
>  to zero is that exceeding log_min_duration_statement forces the text of
> the query to be logged, but this option doesn't. Thus, if log_duration is
> on and log_min_duration_statement has a positive value, all durations are
> logged but the query text is included only for statements exceeding the
> threshold. *This behavior can be useful for gathering statistics in
> high-load installations.*
>

thank you Ron.
My question is a bit more practical - Does anyone really find it useful?
What value brings the info that 20% of my query are under 1ms and 10% over
1 minute - If just checked once and then turned off - I can understand to
have more visibility into the overall characteristics. But let say someone
have it enabled on a production system all the time - what could be the
reason for that?

^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: Use case for enabling log_duration other than benchmarking
@ 2023-01-10 16:28  Ron <ronljohnsonjr@gmail.com>
  parent: Alicja Kucharczyk <zaledwie10minut@gmail.com>
  1 sibling, 1 reply; 6+ messages in thread

From: Ron @ 2023-01-10 16:28 UTC (permalink / raw)
  To: pgsql-general@lists.postgresql.org

On 1/10/23 09:57, Alicja Kucharczyk wrote:
> wt., 10 sty 2023 o 14:57 Ron <ronljohnsonjr@gmail.com> napisał(a):
>
>     On 1/10/23 07:14, Alicja Kucharczyk wrote:
>>     Do you know any use case for enabling log_duration? Like 3rd party
>>     tools for instance.
>>     I find this parameter pretty much useless (in opposite to
>>     log_min_duration_statement) as it does not show the query text, so
>>     besides having just the timing logged it is of no use in
>>     troubleshooting and often causes huge overhead. Am I missing something?
>
>     https://www.postgresql.org/docs/current/runtime-config-logging.html
>
>
>           Note
>
>     The difference between enabling|log_duration|and
>     settinglog_min_duration_statement
>     <https://www.postgresql.org/docs/current/runtime-config-logging.html#GUC-LOG-MIN-DURATION-STATEMENT&g...
>     zero is that exceeding|log_min_duration_statement|forces the text of
>     the query to be logged, but this option doesn't. Thus,
>     if|log_duration|is|on|and|log_min_duration_statement|has a positive
>     value, all durations are logged but the query text is included only
>     for statements exceeding the threshold. *This behavior can be useful
>     for gathering statistics in high-load installations.*
>
>
> thank you Ron.
> My question is a bit more practical - Does anyone really find it useful?
> What value brings the info that 20% of my query are under 1ms and 10% over 
> 1 minute

If your application /*requires*/ subsecond response, and you're only getting 
subsecond response some of the time, then you obviously want to know why.  
Part of that is checking to see if the database and queries are doing their job.

> - If just checked once and then turned off - I can understand to have more 
> visibility into the overall characteristics. But let say someone have it 
> enabled on a production system all the time - what could be the reason for 
> that?

-- 
Born in Arizona, moved to Babylonia.

^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: Use case for enabling log_duration other than benchmarking
@ 2023-01-11 05:02  Julien Rouhaud <rjuju123@gmail.com>
  parent: Ron <ronljohnsonjr@gmail.com>
  0 siblings, 0 replies; 6+ messages in thread

From: Julien Rouhaud @ 2023-01-11 05:02 UTC (permalink / raw)
  To: Ron <ronljohnsonjr@gmail.com>; +Cc: pgsql-generallists.postgresql.org <pgsql-general@lists.postgresql.org>

Le mer. 11 janv. 2023 à 00:28, Ron <ronljohnsonjr@gmail.com> a écrit :

> If your application *requires* subsecond response, and you're only
> getting subsecond response some of the time, then you obviously want to
> know why.  Part of that is checking to see if the database and queries are
> doing their job.
>

now that log_line_prefix can display the query_id, it could also be used to
get a limited version of what log_min_duration_statements does (you can
know what query was but not the exact parameters), but in a way cheaper
way. of course it assumes that you have something like pg_stat_statements
installed and that you need some more granularity than regular snapshots of
its information.

>

^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: Use case for enabling log_duration other than benchmarking
@ 2023-01-17 21:26  Bruce Momjian <bruce@momjian.us>
  parent: Alicja Kucharczyk <zaledwie10minut@gmail.com>
  1 sibling, 0 replies; 6+ messages in thread

From: Bruce Momjian @ 2023-01-17 21:26 UTC (permalink / raw)
  To: Alicja Kucharczyk <zaledwie10minut@gmail.com>; +Cc: Ron <ronljohnsonjr@gmail.com>; pgsql-general@lists.postgresql.org

On Tue, Jan 10, 2023 at 04:57:11PM +0100, Alicja Kucharczyk wrote:
> thank you Ron.
> My question is a bit more practical - Does anyone really find it useful? 
> What value brings the info that 20% of my query are under 1ms and 10% over 1
> minute - If just checked once and then turned off - I can understand to have
> more visibility into the overall characteristics. But let say someone have it
> enabled on a production system all the time - what could be the reason for
> that?

I think the big value is that enabling log_statement and log_duration
prints the statement text when it _starts, while enabling only
log_min_duration_statement prints the statement and duration when it
_ends_.

-- 
  Bruce Momjian  <bruce@momjian.us>        https://momjian.us
  EDB                                      https://enterprisedb.com

Embrace your flaws.  They make you human, rather than perfect,
which you will never be.





^ permalink  raw  reply  [nested|flat] 6+ messages in thread


end of thread, other threads:[~2023-01-17 21:26 UTC | newest]

Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2023-01-10 13:14 Use case for enabling log_duration other than benchmarking Alicja Kucharczyk <zaledwie10minut@gmail.com>
2023-01-10 13:57 ` Ron <ronljohnsonjr@gmail.com>
2023-01-10 15:57   ` Alicja Kucharczyk <zaledwie10minut@gmail.com>
2023-01-10 16:28     ` Ron <ronljohnsonjr@gmail.com>
2023-01-11 05:02       ` Julien Rouhaud <rjuju123@gmail.com>
2023-01-17 21:26     ` Bruce Momjian <bruce@momjian.us>

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