Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vsyym-00CZvi-2w for pgsql-hackers@arkaria.postgresql.org; Thu, 19 Feb 2026 08:01:45 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vsyyk-002bL9-1D for pgsql-hackers@arkaria.postgresql.org; Thu, 19 Feb 2026 08:01:42 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vsyyk-002bL0-02 for pgsql-hackers@lists.postgresql.org; Thu, 19 Feb 2026 08:01:42 +0000 Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1vsyyg-000000006Pr-2u72 for pgsql-hackers@lists.postgresql.org; Thu, 19 Feb 2026 08:01:40 +0000 Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-48371bb515eso8572105e9.1 for ; Thu, 19 Feb 2026 00:01:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1771488098; x=1772092898; darn=lists.postgresql.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=sH2OPX3XJpT6tD4zdkfMurD9P7yA63zWpHK9XUZISjw=; b=R3s+1lY9X9p1vbWwlqWK1/h3RieMPl/KQMfkZe0r8cDXHaGvsnFcWBYmErwMwFhMFf g2qUBYNDioLK6czHq8thZopP+VjgT9w11Fs/Wzgeeg64+MUH2pbiRBEhku4tdVnGFKKR Gtc4DkfvEqWug+VlaLmYUJyoRcqKog8Q3MIIZd4jjAtcBsqRMj9vxnl/NqKNLlcxfmGn KQGZsREJvYrxfml/8WY1K8EUajtJwyoSGZ6/hjGOIL5uWBjUNn+HHjiywhMQ3bb6Yspn NYU9sAMPDzYYgE6/bUNoVXjNIIAMruZhF1XX08GjVINhS+tjLuZ25Nxl7Ow6B+mqq5RV 2NtA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1771488098; x=1772092898; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=sH2OPX3XJpT6tD4zdkfMurD9P7yA63zWpHK9XUZISjw=; b=W4stY8N47b4sB4HiK255WdeeDFpjqDgmVhmVDZWbN9omz8/NTbtD774jYlJ9cotHfF X/9vFhJt4YXJ4Zjh0FBDW8slqpe8TyL4qicpyxnzTxBnW9wwo7fDZ6tnbue9Wgl4uW+b 6Wf7bB62a8Q8dJSqg4iywvDA5z2Z9yX/PKjwMp0AuLslKYnKozzZY3bqtvbUU0yky6l8 DXQtDjF//vqAlurCRT/CxNLLae9teP0K1AHdm/kewlAuCpf1kIGHvy5chhc0ulCQIhyX J7nrU/urKsD28yPDpW5/R8/+Fo0CEXXBK3stNX0FN31HnI+IFNdd7SHrOwonedTMNbME VJzQ== X-Forwarded-Encrypted: i=1; AJvYcCVpQ6z8jD5pHPEDAXGrN4wFzK0W2fkMHBz56nLirqQQFJ9j8uFqBMqvgsA6ikDIRzXTYrf/kTzNA3gZxrJr@lists.postgresql.org X-Gm-Message-State: AOJu0Yzlz0d1ULxAQqlGEO9q28gUshX4QqcmhXVH9GQ+DHzr8ma15MQT imUGogauIOg0RTtMvhtr1TGJV9F1L4oGxLMKvJTQEgGQXRh90S5fBESg X-Gm-Gg: AZuq6aJ4VocVxfVOMBY4C63ox8M7V6bO83JHIfm3q+2KL03tPjRVCQ049Z0hYSFb98k rW8/Yqqa7ER3AiyItVMkwnYeM7b1BXrSRjcfxECpfRYJ9c8ewDovXlz5qevYXh0feTYotZH6KIG xUMwOb8tPIWU5RWo8kMoUW+AMAO+j0DZpuOB9pyn+fdgO4QVKRWT3zYGTl1mO0Ou4/+3bfw0Dij kdDyDM8ccI9NBiihpSGSahzW2JAIaJt5LAT8/Bv1kuZLFKFINm2aefrjrU/wDnKAJS2lTmCPxa3 yG2G495pAZq8Sj5jpNOqC7r7lHg0nxwH/lGmx2jArKUjuVNpcBsTTICTgVqG4Kz/m+B3jlOeS9s UrUnPoxJxoSL6hq8UDGs2XcokxIH8cDiIVmBIwWNt2p3WZ8MDXWaYsX1vvEvlpCa9nTDp1vuhFW CZb6NGyoNtKVBxmEnWeBIY00D5IwRzw/Nugq019aL509svP0ztafE73qmgfez6CK/rFFGZMlM00 hXHVX5G16GDa4jNY8eSBCGtv3w8nF9f8bLluqBURaFRD0OqTRHumvjt5w== X-Received: by 2002:a05:600c:a185:b0:47e:e91d:73c0 with SMTP id 5b1f17b1804b1-48398b5df09mr46974445e9.19.1771488098254; Thu, 19 Feb 2026 00:01:38 -0800 (PST) Received: from ip-10-97-1-34.eu-west-3.compute.internal (ec2-15-237-197-144.eu-west-3.compute.amazonaws.com. [15.237.197.144]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4839f990384sm18417045e9.5.2026.02.19.00.01.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Feb 2026 00:01:37 -0800 (PST) Date: Thu, 19 Feb 2026 08:01:36 +0000 From: Bertrand Drouvot To: Michael Paquier Cc: Sami Imseih , Fujii Masao , pgsql-hackers@lists.postgresql.org, Zsolt Parragi Subject: Re: Flush some statistics within running transactions Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi, On Thu, Feb 19, 2026 at 12:58:12PM +0900, Michael Paquier wrote: > On Wed, Feb 18, 2026 at 05:40:46AM +0000, Bertrand Drouvot wrote: > > PFA a mandatory rebase (nothing that needs review) due to a92b809f9da1. > > I don't find the design of this patch appealing, and my mind points > towards two pieces of it: > 1) The new requirement related to pgstat_schedule_anytime_update() > that a stats kind needs to call to enable a timeout. This partially > doubles with pgstat_report_fixed. And I suspect that this extra set > of requirements, introducing a new level of complexity for in-core > stats kinds as well as extension developers, would be the source of > more bugs. Yeah, maybe we should re-think the way we report that we have something to flush, but I think that's more a general discussion that should also take care of pgstat_report_fixed. > 2) The timeout requirement itself, relying on a timeout threshold > controlled by a backend-side configuration. What are you concerns with this? > With that in mind, wouldn't it be simpler if we introduced an API that > could be used from client applications instead, in a model similar > what we do for procsignal.c/h? That's another angle to look at it but I think that giving this responsability to the clients would not solve the concerns we had in [1] (that led to 039549d70f6 and to this thread). It seems to me that a solution/design that does not allow us to "revert" 039549d70f6 does not suit our needs. Thoughts? > Not a fan of the hardcoded sleeps in the tests, either. Yeah, after our off-list discussion yesterday, I tried to implement the same trick that f1e251be80a has done with injection points (nice trick by the way!), but that led to: TRAP: failed Assert("CritSectionCount == 0 || (context)->allowInCritSection"), File: "mcxt.c", Line: 1237 postgres: main: walwriter (ExceptionalCondition+0x9e)[0xc4ce4d] postgres: main: walwriter (MemoryContextAlloc+0x8c)[0xc8f0ec] postgres: main: walwriter (MemoryContextStrdup+0x37)[0xc8fea1] postgres: main: walwriter (pstrdup+0x22)[0xc8fee4] postgres: main: walwriter (substitute_path_macro+0x65)[0xc56068] postgres: main: walwriter [0xc55e90] postgres: main: walwriter (load_external_function+0x59)[0xc553db] postgres: main: walwriter [0xc7b858] postgres: main: walwriter [0xc7c125] postgres: main: walwriter (IsInjectionPointAttached+0x18)[0xc7c20c] postgres: main: walwriter (pgstat_count_backend_io_op+0x12f)[0xa9a116] postgres: main: walwriter (pgstat_count_io_op+0x169)[0xa9cb57] postgres: main: walwriter (pgstat_count_io_op_time+0x1cc)[0xa9cda7] So, I did not spend that much time on it. I could if we strongly think that those sleeps have to be discarded though. [1]: https://postgr.es/m/erpzwxoptqhuptdrtehqydzjapvroumkhh7lc6poclbhe7jk7l%40l3yfsq5q4pw7 Regards, -- Bertrand Drouvot PostgreSQL Contributors Team RDS Open Source Databases Amazon Web Services: https://aws.amazon.com