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 1vmxaZ-000enQ-34 for pgsql-hackers@arkaria.postgresql.org; Mon, 02 Feb 2026 17:19:51 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vmxaY-000bhD-15 for pgsql-hackers@arkaria.postgresql.org; Mon, 02 Feb 2026 17:19:50 +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 1vmxaY-000bh4-05 for pgsql-hackers@lists.postgresql.org; Mon, 02 Feb 2026 17:19:49 +0000 Received: from mail-wr1-x431.google.com ([2a00:1450:4864:20::431]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1vmxaW-00000000DMB-0VXo for pgsql-hackers@lists.postgresql.org; Mon, 02 Feb 2026 17:19:48 +0000 Received: by mail-wr1-x431.google.com with SMTP id ffacd0b85a97d-42fed090e5fso3762826f8f.1 for ; Mon, 02 Feb 2026 09:19:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1770052785; x=1770657585; 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=OPzu92404+YLEW5ObvQbkRhFBOIAMebPfP4eYSAt6g0=; b=WjF20L841v+Q2tnDJbu+H75F7t8KtJNc26+2XAB4xSr2sOhqvNn+ABoe8KYStz6Ypd bA5XYu/VLHjWemgn9GrH8fO9o2fPw5SRgXeo08gRwZZML6gZcriQZiOykfMS6yQciGCz yCLAnC9j8ntCugsvSimP5uigBYjQkruUkISl6FedBKOuGd+31Vk8tSYJ0eybwXc1JYAQ GxAdeKYY4inhaoy5SD2AusWZcv/Yt58WvVoo40cFxyDDa5X7Dqm3cMh4zLukllGb3I0N uVRDf2ajweahev/aOeoAIF6pacyytahWbebUII+IxoUpZERctwOWbZxGnnyuD4im9G4Y Ym3g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770052785; x=1770657585; 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=OPzu92404+YLEW5ObvQbkRhFBOIAMebPfP4eYSAt6g0=; b=V4sVg6fR9ZlL2vEJQpHkHe59V6vsvUIMRXD4Z1kVuJfG/agTJCQozFtFdw2eePS5P2 wftbXGSUWwrZdTYOH/PFYvTAcowzVdboqch5nQ8SSVBG/Q236giXpYsJnU/FdKd2mhUJ KA0Dn5D4L2E8icp9YZM9Cs1MUrj1Z5l87zJtvxwffa2J7yKC58E//gl17LYMEBfs+5FJ ubnvdg8xAcXhhztKD2RXdYcAana0PuzAPUgsRyQilHrXwo3COJhlFi2HuJ/eav5vKOcC CI+BJ3stabk5LKA2j8aRR9PjOxCTOdqLuFiLjLUj71RV9bOaIjm4zoBE5IYwDzSjJ4rv h+8Q== X-Forwarded-Encrypted: i=1; AJvYcCVaS6SxiNVsL3rLN7iwthamFubAd5Qfse/4yZYwJyPRngUtuoqqv8mFE/hgclTXiCU8LlYr5vCtDoqoYRqO@lists.postgresql.org X-Gm-Message-State: AOJu0YzCQaraNkdmZz4Dii3CHCbp7WmdiuUZd9PhFK6Q1PtsnGWxB1jQ W9hULb84teHM4eiLL5wFSUSLpV1xbqaES4TlSSFUArKxGARRb55fpohg X-Gm-Gg: AZuq6aLROw0fWg6txbzXoefqxc2PlH/pYmJAgEOqIqdr12xdJh6TEPOefy6tE1gUJ31 /YbHNFiKQQrZzVV/C9dO2Nqb/ZFafAYA67eGx9MIQxlGMlJlZgV9PLZgAoghdGDhi+aGXGdoz4G HopjjJnsyzsHbj72h4wCZkmApAb+n5MG9lGUa4TrfTpTzAbAZfzwyOysBrfjh3++563Gb6EUrcp Jv213izIwcHhgIk8fK7LmWHaeezForFECRQCYfNardi3bsz126QdL7Yqa30ObW5ycol7b/C+7Iv L/wVXUhtXdiI6fsSG292CxterUvtiRwuleqLJ2loX1LPJTi1PCBKG77MNk9UurYMvW3JYbTos37 0sBDxXdGujw0sksAkJJ4QL977h37W0EdtoAybfInYp6AtQkaPVVa1yiPHA2cKVMd7GfOar4t1O5 uwmqGemcY4JiYfFN64YI2vLpnJi0r9B7WFT4TuGowCyC31WIrm82jV9SS6rCaoF8OAuUIhU9Lo8 DRKcP0NXM1ERMr5cfRKT7wPix7yJnjgOOqpvQlgMGbeVw== X-Received: by 2002:a05:6000:22c5:b0:435:b67d:c304 with SMTP id ffacd0b85a97d-435f3aaf790mr17177662f8f.38.1770052785224; Mon, 02 Feb 2026 09:19:45 -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 ffacd0b85a97d-435e13235f5sm43351460f8f.29.2026.02.02.09.19.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Feb 2026 09:19:44 -0800 (PST) Date: Mon, 2 Feb 2026 17:19:43 +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 Mon, Feb 02, 2026 at 04:31:48PM +0900, Michael Paquier wrote: > On Sat, Jan 31, 2026 at 11:16:03AM -0600, Sami Imseih wrote: > > Also, the anytime flush callback does not need to check if there are > > any variable-numbered stats to flush. This will not be needed as > > it is in v4-0004 > > > > ``` > > + /* > > + * Check if there are any non-transactional stats to flush. Avoid > > + * unnecessarily locking the entry if nothing accumulated. > > + */ > > + if (!(lstats->counts.numscans > 0 || > > + lstats->counts.tuples_returned > 0 || > > + lstats->counts.tuples_fetched > 0 || > > + lstats->counts.blocks_fetched > 0 || > > + lstats->counts.blocks_hit > 0)) > > + return true; > > ``` > > I think that this kind of check may finish by being expensive. > Reducing the number of fields to check for a non-flushing state, if > required, would be preferrable. Done, in v5 just shared up-thread. Oh and I forgot to mention that with the new design in v5, then the fix for the issue discovered by Masao-san is not needed anymore (and so has been removed from 0001). Regards, -- Bertrand Drouvot PostgreSQL Contributors Team RDS Open Source Databases Amazon Web Services: https://aws.amazon.com