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 1m7hTo-0004j6-KF for pgsql-hackers@arkaria.postgresql.org; Sun, 25 Jul 2021 16:59:56 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1m7hTl-0000tk-Tj for pgsql-hackers@arkaria.postgresql.org; Sun, 25 Jul 2021 16:59:53 +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 1m7hTl-0000tc-Lq for pgsql-hackers@lists.postgresql.org; Sun, 25 Jul 2021 16:59:53 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1m7hTe-00011w-KT for pgsql-hackers@postgresql.org; Sun, 25 Jul 2021 16:59:52 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 16PGxZlV081236; Sun, 25 Jul 2021 12:59:35 -0400 From: Tom Lane To: Julien Rouhaud cc: Fujii Masao , Sergei Kornilov , "imai.yoshikazu@fujitsu.com" , legrand legrand , "pgsql-hackers@postgresql.org" Subject: Re: Planning counters in pg_stat_statements (using pgss_store) In-reply-to: <20210725163637.qkslpe24mgzen73t@nol> References: <8c6449d4-5fd7-f544-182b-a4bb7da1d18c@oss.nttdata.com> <20200331060307.e7kypfynz7jous62@nol> <20200331073321.bhnx2p63gp5px37f@nol> <20200331184217.tf3x534uz4vusgmp@nol> <13923268-bad9-80f9-2542-5fd5e8b8c500@oss.nttdata.com> <42557.1627229005@sss.pgh.pa.us> <20210725163637.qkslpe24mgzen73t@nol> Comments: In-reply-to Julien Rouhaud message dated "Mon, 26 Jul 2021 00:36:37 +0800" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <81234.1627232375.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Sun, 25 Jul 2021 12:59:35 -0400 Message-ID: <81235.1627232375@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Julien Rouhaud writes: > On Sun, Jul 25, 2021 at 12:03:25PM -0400, Tom Lane wrote: >> So AFAICS this test is inherently unstable and there is no code bug >> to be fixed. We could drop the "plans" column from this query, or >> print something approximate like "plans > 0 AND plans <=3D calls". >> Thoughts? > I think we should go with the latter. Checking for a legit value, even = if it's > a bit imprecise is still better than nothing. > Would it be worth to split the query for the prepared statement row vs t= he rest > to keep the full "plans" coverage when possible? +1, the same thought occurred to me later. Also, if we're making it specific to the one PREPARE example, we could get away with checking "plans >=3D 2 AND plans <=3D calls", with a comment like "we expect at least one replan event, but there could be more". Do you want to prepare a patch? regards, tom lane