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 1vipdo-00GY2p-2P for pgsql-hackers@arkaria.postgresql.org; Thu, 22 Jan 2026 08:02:09 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vipdn-00Bqb1-2D for pgsql-hackers@arkaria.postgresql.org; Thu, 22 Jan 2026 08:02:08 +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 1vipdn-00Bqas-13 for pgsql-hackers@lists.postgresql.org; Thu, 22 Jan 2026 08:02:07 +0000 Received: from mail-wm1-x32a.google.com ([2a00:1450:4864:20::32a]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1vipdl-001jWO-0f for pgsql-hackers@lists.postgresql.org; Thu, 22 Jan 2026 08:02:06 +0000 Received: by mail-wm1-x32a.google.com with SMTP id 5b1f17b1804b1-4801c1ad878so6276145e9.1 for ; Thu, 22 Jan 2026 00:02:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1769068923; x=1769673723; 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=FeVWqvm/W05QqqA1xHRkGxP7wE3b8WqPTYFdyztdb4g=; b=giEFdcAGOlQhSi46TWTCzCsaPZ6OKteZU8qz/1wWLDNDj0nkIulizwOWlYhC7dnx4+ hyOexnTtdMmkD9LeMfA3KGCbdX+orTbh+8mC/mJZ9EDEDdiI5nDc2Z/GFCZz2GkQQyOo 3tLw78C6wKcs1NRp+bnPSJiLiNcZB4aaIcA0EWrPzsQbu4Bj92nP5550VsIZ0/7QofGi 2pLCfcUvUtPSRuzgw8WKTYomWXRWFPDmOnhELzB6uybsD3XBORL8E5PB/wdHdHGdrjRT IOWvWXddIfVyHL6aNZcIyZYCUB8xk5Dnv3nfD+yZF7xlGCxF9gdoXF9hiWTCUmIcG19g qQtA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769068923; x=1769673723; 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=FeVWqvm/W05QqqA1xHRkGxP7wE3b8WqPTYFdyztdb4g=; b=tw1z5iTOFTxhmZ2D2q0yZSAvHejYVIhs2AdoPOIrti1abit3ljgyhjvD2kUQKuPTmb /8W23W6FZk6qpOdIQk3cSSuQ3yiGcAqikIVGO0mq+3IGC5J4/2qU7QtQjqUvAe2Gh+jD 86uBE9pZyjbTro8kBPkn1xqvibMgkR6kYgz2Tc/QaoVrkM5LsXrxcl8Ei94//3XqbKf9 yG/sZv1LviiCS3TfyI+R94ql0Jy/5yFhkeDXIB/mdWIQiGzoJn4NgAjuEFmvX42NaLVd ywrYbO6KAWvnwW1Uba/zhVavXpasVYWtRulyaIJZ7lgMLQWth3ZUn41lApd9Pp7gbDs7 oRVw== X-Forwarded-Encrypted: i=1; AJvYcCXQZjEV8thQeyRRWKdR8gEiv8FGaOv9CyAEmGgZcrwyu1QzwqZ8L18Se5n9k/TyJN830CHuZnUUc5ZGyyFp@lists.postgresql.org X-Gm-Message-State: AOJu0Yxfw8yIuxAeyMF5JDKPhU9BbHhpoDKzXPSU/KCczWiSrM7ePwKB xlv7qL7zD7/VXU/8csTPmNktWbUSqhADscYlBPn+tZh061/44oOrXdWA X-Gm-Gg: AZuq6aKcJBJ5CxfC7sjZupYYQ9be2wVqHZjfmo+UBBlA5Ox2P1OHa99UlKlpRt8IDW0 6xzNLcPfEcYPuI25mx3m8RYxz3cWK+ER42Sic9LGzGLBLQABsHTNjbRNnxBDMRfpOt0VDWVuMY1 xYDieBeR2nD615q4UAERnq2vwJzC6AbI5vFBNvBShKtszjKKqNTsTtWMy6Sxa0SiUYo1OXEmN6F iwrV+aF1p2YgC9m5gwmTScaFTh5W6dnjjVWpXSIMiW5msnI0PByBaD6wVR/YoQd34ee8vqhblVj QhcN4qjB2OxcD/+xUgfr0oBOoXj+zBvnUDOoAi2Hx1ilh9qzu+q8HO6pMJoNLxP53l5DZkUUtl7 TkZ7Muvi8JJ3K2XHiLNsklyG4GQs/iSc2O82b2/ZVtJaTdecw6ypNvJPgJjtQ3EeJJs6Kx6Fec/ VVaDmKb9VsFeASRfwAp+hpd1Jrrj+25AlL1lrIVtFbQko0A5rs3TZRa9GUWAqSzwhqgaZDaFuat qvDhvvN5nEaUMkSAtlIe5t5vdb1z8AFxDnZBZxmMtAcdA== X-Received: by 2002:a05:600c:821b:b0:47e:de9c:92ec with SMTP id 5b1f17b1804b1-4803e7a39cdmr133260805e9.14.1769068923450; Thu, 22 Jan 2026 00:02:03 -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-4804702876asm52130785e9.1.2026.01.22.00.02.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Jan 2026 00:02:03 -0800 (PST) Date: Thu, 22 Jan 2026 08:02:01 +0000 From: Bertrand Drouvot To: Michael Paquier Cc: Sami Imseih , 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, Jan 22, 2026 at 11:28:06AM +0900, Michael Paquier wrote: > On Wed, Jan 21, 2026 at 07:41:30PM -0600, Sami Imseih wrote: > > Another one would be n_mod_since_analyze, That should > > only be updated after commit (or not after rollback). Otherwise, > > it may throw autovanalyze threshold calculations way off. Same > > for n_dead_tup and autovacuum. > > Point taken. It sounds like it is going to be super important to > document in the patch these kind of current expectations, so as one > does not flip the flush mode one way or another incorrectly, or > assigns an incorrect flush mode when adding a new stats kind. It's > probably worth documenting that the end-of-transaction flush should be > the default norm, while the out-of-transaction case should be an > exception one needs to be careful of. Agreed, I'll add more explanations around that. > > Sure, Bertrand mentioned early in the thread that the anytime flushes > > could be made configurable. Perhaps that is a good idea where we can > > default with something large like 10s intervals for anytime flushes, but allow > > the user to configure a more frequent flushes ( although I would think > > that 1 sec is the minimum we should allow ). > > Sure, I am just mentioning that we should not be that aggressive for > everybody. I'm not opposed to increase the flush frequency but I suppose most of the monitoring tools are sampling at a 1s frequency. So, if we set the flush frequency to say 10s, that would result in "spikes" every 10s. That's misleading, because it's not a spike in activity, it's a delay in reporting. I think that would make sense if we expect the 1s interval to have a negative impact, but that's not what I expect and observed. > If this can be made configurable on a call-basis, even if > it means a new GUC, that may be better in the long run. If we think that the 1s interval is a problem, we could go in that direction. Though it might be better to hardcode a larger value instead of letting the users set values that could be problematic. Regards, -- Bertrand Drouvot PostgreSQL Contributors Team RDS Open Source Databases Amazon Web Services: https://aws.amazon.com