Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pFHUL-00044G-7K for pgsql-general@arkaria.postgresql.org; Tue, 10 Jan 2023 16:28:37 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pFHUK-0003AT-4a for pgsql-general@arkaria.postgresql.org; Tue, 10 Jan 2023 16:28:36 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pFHUJ-0003AK-PU for pgsql-general@lists.postgresql.org; Tue, 10 Jan 2023 16:28:35 +0000 Received: from mail-vk1-xa2a.google.com ([2607:f8b0:4864:20::a2a]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1pFHUH-0008Tq-8R for pgsql-general@lists.postgresql.org; Tue, 10 Jan 2023 16:28:35 +0000 Received: by mail-vk1-xa2a.google.com with SMTP id l129so5012290vkh.6 for ; Tue, 10 Jan 2023 08:28:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=in-reply-to:from:references:to:content-language:subject:user-agent :mime-version:date:message-id:from:to:cc:subject:date:message-id :reply-to; bh=yR2izR3xr3DzuaMfj9XMWa6a2qwkOp7DfOP2VX24eOY=; b=px62AKr5DeIQL3sw1yy4hnXH5OQwFXW7Jv0TBvyWlGiW53WJCNHMh14qPYJwCgqRKp EYHpvChm781n3uAs3K6rf03/rCCIb8JrrDcMnsnApsldfYRs00KLATv9MHVzGZrTlObA /yZAX4r82jM8aSvKrkswnB3KsLPxARKJjQYiXGtmn7d6dU8krd76Xd9arKdf+QZJOc8o mguZdm/VQtho7kNDDbWkQc5oNw2/OrAP5oNaH/soqmBt0CqW1FjswY01e0ek7sX1K63D ZwO7ZHsiAUHcPXmH1RfVwPi2HitiqDzYGJtc8UzFXjWUgywDGbeiE3hwpvIzGDlPOkKA USog== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:from:references:to:content-language:subject:user-agent :mime-version:date:message-id:x-gm-message-state:from:to:cc:subject :date:message-id:reply-to; bh=yR2izR3xr3DzuaMfj9XMWa6a2qwkOp7DfOP2VX24eOY=; b=Nua4p7La1Ca8t4EwBlezFSkW2aU3QEqi79S0Lc23D1do5wC0w5wrNLudHy/GslAEI+ Zx2TQ3WQLY7T7+rmSmekpX5yTO6UFBaWfxRqgA9ZIx0bvjgbzg+u5LUAh2sMtahNhmZK o2imI5Ja6mR63JDpbJ4snr8QwFRzQ44KfhKK9Un8BAStjUUIq1NATvQAwl+zN5oKe0/g AwiiPMbKAN40lo/3ceAyVZrWOPI3+y7AWuIIX6teUIGpvRV8Ebi4H7ch0dXQj8ICMkOB +S+ef95MYK50ijXiHO+Txr/mb9B03ImQWpNvij/G1jjYP5sXYA5Y1QmwwW/SP6Cug28u T7aw== X-Gm-Message-State: AFqh2koF+f3sm94rpvG46cg4yC8loZjobbIt+XISfCs4KHjju6FbJ3JX mvEuJeVO25O/fYtSuZd6fvKqK4Jg/Qw= X-Google-Smtp-Source: AMrXdXtOZkxkCeN2SnMGdsmtxA9biU7szkYSVihi2mb1fzQS7O55AHvTKX1DjsWWEyvswaZ7v1a9bA== X-Received: by 2002:a1f:320f:0:b0:3bc:b7f6:5fde with SMTP id y15-20020a1f320f000000b003bcb7f65fdemr33495794vky.4.1673368110943; Tue, 10 Jan 2023 08:28:30 -0800 (PST) Received: from [192.168.1.66] (108-250-206-84.lightspeed.nworla.sbcglobal.net. [108.250.206.84]) by smtp.googlemail.com with ESMTPSA id h8-20020a05620a284800b006fa7b5ea2d1sm7345947qkp.125.2023.01.10.08.28.29 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 10 Jan 2023 08:28:29 -0800 (PST) Content-Type: multipart/alternative; boundary="------------mxUGlFrz5G04Ejc8EPG0J0V8" Message-ID: Date: Tue, 10 Jan 2023 10:28:29 -0600 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.2.2 Subject: Re: Use case for enabling log_duration other than benchmarking Content-Language: en-US To: pgsql-general@lists.postgresql.org References: From: Ron In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk This is a multi-part message in MIME format. --------------mxUGlFrz5G04Ejc8EPG0J0V8 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 1/10/23 09:57, Alicja Kucharczyk wrote: > wt., 10 sty 2023 o 14:57 Ron 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 > 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 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. --------------mxUGlFrz5G04Ejc8EPG0J0V8 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 setting 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 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.
--------------mxUGlFrz5G04Ejc8EPG0J0V8--