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 1oIYVz-0002df-Sx for pgsql-bugs@arkaria.postgresql.org; Mon, 01 Aug 2022 16:43:35 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1oIYVy-0000z7-N8 for pgsql-bugs@arkaria.postgresql.org; Mon, 01 Aug 2022 16:43:34 +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 1oIYVy-0000yv-F7 for pgsql-bugs@lists.postgresql.org; Mon, 01 Aug 2022 16:43:34 +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 1oIYVw-00050W-DM for pgsql-bugs@lists.postgresql.org; Mon, 01 Aug 2022 16:43:34 +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 271GhNI71845221; Mon, 1 Aug 2022 12:43:23 -0400 From: Tom Lane To: Andres Freund cc: Laetitia Avrot , Peter Eisentraut , Japin Li , "David G. Johnston" , John Naylor , PostgreSQL mailing lists Subject: Re: Statistics updates is delayed when using `commit and chain` In-reply-to: <20220801164004.kybukw4j3svgcv54@awork3.anarazel.de> References: <3455196.1626234760@sss.pgh.pa.us> <20220801161256.ogcacmw6txiecvfb@awork3.anarazel.de> <1839632.1659371158@sss.pgh.pa.us> <20220801164004.kybukw4j3svgcv54@awork3.anarazel.de> Comments: In-reply-to Andres Freund message dated "Mon, 01 Aug 2022 09:40:04 -0700" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1845219.1659372203.1@sss.pgh.pa.us> Date: Mon, 01 Aug 2022 12:43:23 -0400 Message-ID: <1845220.1659372203@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Andres Freund writes: > On 2022-08-01 12:25:58 -0400, Tom Lane wrote: >> What I suggested a few days ago is that it should be in CommitTransaction. > I wonder how we'd best deal with the idle timer if we go for that. That only > makes sense in some contexts (normal backends), but not others (everything > else). Yeah. I think we'd need to get rid of the "bool force" argument of pgstat_report_stat, and instead have it manage things internally based on understanding whether the current process uses a reporting timeout timer or not (if not, always send the report right away). That seems like it'd be more robust than the current mechanism anyway, as we're currently relying on every call site to get that right. regards, tom lane