Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hC6mq-0007sG-CZ for pgsql-hackers@arkaria.postgresql.org; Thu, 04 Apr 2019 18:08:28 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hC6mp-0008TE-5k for pgsql-hackers@arkaria.postgresql.org; Thu, 04 Apr 2019 18:08:27 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hC6lc-0003B9-AJ for pgsql-hackers@lists.postgresql.org; Thu, 04 Apr 2019 18:07:12 +0000 Received: from mail-qt1-x842.google.com ([2607:f8b0:4864:20::842]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hC6lZ-0000Wx-4m for pgsql-hackers@postgresql.org; Thu, 04 Apr 2019 18:07:11 +0000 Received: by mail-qt1-x842.google.com with SMTP id p20so4319731qtc.9 for ; Thu, 04 Apr 2019 11:07:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :content-transfer-encoding:in-reply-to:user-agent; bh=gMk+LRNYyCoybKf+J9E12SameVHvWAp6U0r3tqicFOg=; b=xvov5zpWAni59ZPqW/Ci8Ijv6SXl3mvjiHF07JR8kLm0XHp8fMIqLeDsJuqMpgIs3r QJs7+VUjjxq3cyy2wG5sOrLhNstb3X9CuxI0R6Xh+MYF1XCSQeNy7nfvAvI95X8so/aY AEJkYaWbE2/89q0FbI0vZ1t6jbLUicNIUPbCszHTU4e1SKr8eoA6p8Wh8kToNt55ATXO XQPeFdg2unohCNyMQHGAHlENgZc4e+nDL1prE/CS4ToyNihXJI6IhBPaTQpM2EHwPWkD sB0x8qpnH6i6lUkvnIFUBospA1APGwclVPoej4I60zx7VBsBTGTvfInz9+gUFKMHfFBn he/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=gMk+LRNYyCoybKf+J9E12SameVHvWAp6U0r3tqicFOg=; b=s2VgyXGW2TTTGVPT17EYrzIr1tjoeyvfzWrmtG9rQu/CgsV4oPKMfAsDBpOcRW4Yjj RaFbaR4xyB/4pouC/M3U8c0u0fVyY1f+OuKFxOFMU+88ACA1K5uE2xYJDLbABzIIw8Qj zzx/MzoC9a7WXm5z0br3ui17oz91iDpX4HDpc9T4jo9/TG0dC5tsQVVtSbFdcDPTpd6u SCETwCkZ694XKk2f24pxoknwqyg7wVjicRDofSsFydgPLafzpdWZlFJDrVN1qb3Z2kWF 9eGOOgn5sW2MQILJzLJRU6Hl0ZXYXxwKcSGf79feANohWyksHpY+W3UzluEo4b6OAAC9 xj3A== X-Gm-Message-State: APjAAAUf1NrtFdeoRiCQy1mj08G2UgLp5gLdGS95jQ/YL7aMjSHuAYz/ z9RQEcnPC/6p1YlJatPf+LHoqQ== X-Google-Smtp-Source: APXvYqxeNWgnMAsTDyTZuQSjPZMqOqcRyd36C5YJGx+rRaWK9xDuI57H3TK06BtoIeQgmvcZYtfr4Q== X-Received: by 2002:a0c:fac9:: with SMTP id p9mr5973165qvo.195.1554401227385; Thu, 04 Apr 2019 11:07:07 -0700 (PDT) Received: from nimloth.alvh.no-ip.org ([190.121.29.3]) by smtp.gmail.com with ESMTPSA id i11sm9776064qkg.33.2019.04.04.11.07.06 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 04 Apr 2019 11:07:06 -0700 (PDT) Received: by nimloth.alvh.no-ip.org (Postfix, from userid 1000) id AE93C120F3B; Thu, 4 Apr 2019 15:07:04 -0300 (-03) Date: Thu, 4 Apr 2019 15:07:04 -0300 From: Alvaro Herrera To: Justin Pryzby Cc: Arthur Zakirov , pgsql-hackers@postgresql.org Subject: Re: query logging of prepared statements Message-ID: <20190404180704.GA31569@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20190304183150.GK29584@telsasoft.com> User-Agent: Mutt/1.9.4 (2018-02-28) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 2019-Mar-04, Justin Pryzby wrote: > Thanks for reviewing. I'm also interested in discussion about whether this > change is undesirable for someone else for some reason ? For me, the existing > output seems duplicative and "denormalized". :) Some digging turned up that the function you're removing was added by commit 893632be4e17. The commit message mentions output for testlibpq3, so I ran that against a patched server. With log_min_duration_statement=0 I get this, which looks good: 2019-04-04 14:59:15.529 -03 [31723] LOG: duration: 0.108 ms statement: SET search_path = testlibpq3 2019-04-04 14:59:15.530 -03 [31723] LOG: duration: 0.303 ms parse : SELECT * FROM test1 WHERE t = $1 2019-04-04 14:59:15.530 -03 [31723] LOG: duration: 0.231 ms bind 2019-04-04 14:59:15.530 -03 [31723] DETAIL: parameters: $1 = 'joe''s place' 2019-04-04 14:59:15.530 -03 [31723] LOG: duration: 0.016 ms execute 2019-04-04 14:59:15.530 -03 [31723] DETAIL: parameters: $1 = 'joe''s place' 2019-04-04 14:59:15.530 -03 [31723] LOG: duration: 0.096 ms parse : SELECT * FROM test1 WHERE i = $1::int4 2019-04-04 14:59:15.530 -03 [31723] LOG: duration: 0.053 ms bind 2019-04-04 14:59:15.530 -03 [31723] DETAIL: parameters: $1 = '2' 2019-04-04 14:59:15.530 -03 [31723] LOG: duration: 0.007 ms execute 2019-04-04 14:59:15.530 -03 [31723] DETAIL: parameters: $1 = '2' An unpatched server emits this: 2019-04-04 15:03:01.176 -03 [1165] LOG: duration: 0.163 ms statement: SET search_path = testlibpq3 2019-04-04 15:03:01.176 -03 [1165] LOG: duration: 0.475 ms parse : SELECT * FROM test1 WHERE t = $1 2019-04-04 15:03:01.177 -03 [1165] LOG: duration: 0.403 ms bind : SELECT * FROM test1 WHERE t = $1 2019-04-04 15:03:01.177 -03 [1165] DETAIL: parameters: $1 = 'joe''s place' 2019-04-04 15:03:01.177 -03 [1165] LOG: duration: 0.028 ms execute : SELECT * FROM test1 WHERE t = $1 2019-04-04 15:03:01.177 -03 [1165] DETAIL: parameters: $1 = 'joe''s place' 2019-04-04 15:03:01.177 -03 [1165] LOG: duration: 0.177 ms parse : SELECT * FROM test1 WHERE i = $1::int4 2019-04-04 15:03:01.177 -03 [1165] LOG: duration: 0.096 ms bind : SELECT * FROM test1 WHERE i = $1::int4 2019-04-04 15:03:01.177 -03 [1165] DETAIL: parameters: $1 = '2' 2019-04-04 15:03:01.177 -03 [1165] LOG: duration: 0.014 ms execute : SELECT * FROM test1 WHERE i = $1::int4 2019-04-04 15:03:01.177 -03 [1165] DETAIL: parameters: $1 = '2' Note that with your patch we no longer get the statement in the "bind" and "execute" lines, which seems good; that was far too noisy. However, turning duration logging off and using log_statement=all, this is what I get: 2019-04-04 14:58:42.564 -03 [31685] LOG: statement: SET search_path = testlibpq3 2019-04-04 14:58:42.565 -03 [31685] LOG: execute 2019-04-04 14:58:42.565 -03 [31685] DETAIL: parameters: $1 = 'joe''s place' 2019-04-04 14:58:42.565 -03 [31685] LOG: execute 2019-04-04 14:58:42.565 -03 [31685] DETAIL: parameters: $1 = '2' which does not look good -- the statement is nowhere to be seen. The commit message quotes this as desirable output: LOG: statement: execute : SELECT * FROM test1 WHERE t = $1 DETAIL: parameters: $1 = 'joe''s place' LOG: statement: execute : SELECT * FROM test1 WHERE i = $1::int4 DETAIL: parameters: $1 = '2' which is approximately what I get with an unpatched server: 2019-04-04 15:04:25.718 -03 [1235] LOG: statement: SET search_path = testlibpq3 2019-04-04 15:04:25.719 -03 [1235] LOG: execute : SELECT * FROM test1 WHERE t = $1 2019-04-04 15:04:25.719 -03 [1235] DETAIL: parameters: $1 = 'joe''s place' 2019-04-04 15:04:25.720 -03 [1235] LOG: execute : SELECT * FROM test1 WHERE i = $1::int4 2019-04-04 15:04:25.720 -03 [1235] DETAIL: parameters: $1 = '2' So I think this needs a bit more work. -- Álvaro Herrera https://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services