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 1wE8bq-003iCA-30 for pgsql-hackers@arkaria.postgresql.org; Sat, 18 Apr 2026 16:33:31 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wE8bq-00DMVZ-0D for pgsql-hackers@arkaria.postgresql.org; Sat, 18 Apr 2026 16:33:30 +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 1wE8bp-00DMVR-2Y for pgsql-hackers@lists.postgresql.org; Sat, 18 Apr 2026 16:33:29 +0000 Received: from fhigh-a3-smtp.messagingengine.com ([103.168.172.154]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1wE8bn-00000001e9J-2LyE for pgsql-hackers@lists.postgresql.org; Sat, 18 Apr 2026 16:33:28 +0000 Received: from phl-compute-02.internal (phl-compute-02.internal [10.202.2.42]) by mailfhigh.phl.internal (Postfix) with ESMTP id 756481400123; Sat, 18 Apr 2026 12:33:27 -0400 (EDT) Received: from phl-frontend-04 ([10.202.2.163]) by phl-compute-02.internal (MEProxy); Sat, 18 Apr 2026 12:33:27 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=anarazel.de; h= cc:cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm2; t=1776530007; x=1776616407; bh=twQNkDyb6QPkXXCQIs+dT6WYRn3+J3ruXm9vzdx6/UM=; b= onwEfnt0L7MfdpcrWw8Yof5rGJFO+5dPWXcHGe/vC3nIiNglmmQjpSL91/lK8D1o To+mujFo2YafkGkxVFgkkrCXKMdGAUKpeZTtAtV66Fh1rtYOWVljtzPUrHvQ4En3 3Pv0CZzhxS+yN9+NoW/BHZtKK37VC8PT50XcYkH+uomd6HMvp7Rv73zMktvHxnf4 aR2JviXjqQILtn5d9ApSXQZUkBF6leT8rDWrWSRFP4P7hJXJ4ZpQ+aYCkf+L8Ml9 1McTEw1Fb4Tyr7UQegH7+ZrgWhUJ/seDWVGgeMGCbya5QeMq+Iy6+W+EWQt9sRXu Zrgutn6wNH548B55CuHV3A== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1776530007; x= 1776616407; bh=twQNkDyb6QPkXXCQIs+dT6WYRn3+J3ruXm9vzdx6/UM=; b=R spIbBSSKV3hsXs0cf2Gk3v2L/61CkuSCLqk13u067+UqefayGtZX60AHjFDcK0v6 sLH1oJPTnd7muwJK/Oux08e/wG37/p/eHAapcjXJaLTSRjR4C1y4hFY97apweaAR QHdhdtPXY0mGuLfuGPTN3OTlO/tAd3HgKQSjxKot6cdEBG9TFF1wcX8e1QWDenkU 6qAVx9pIauEPI9q3bDGczUt0huc9YE+IOxwYvabznbH92iI8T1L1MwO0yEoQYh0c bdb/pjeLHqRELitoPknrtb1+iR16RFiZ68nGptxGX2cToJwuwz6r0ODqLWR7lksv PGrXomk2JNzRlWTKonKng== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefhedrtddtgdehfedvhecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpuffrtefokffrpgfnqfghnecuuegr ihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjug hrpeffhffvvefukfhfgggtugfgjgestheksfdttddtjeenucfhrhhomheptehnughrvghs ucfhrhgvuhhnugcuoegrnhgurhgvshesrghnrghrrgiivghlrdguvgeqnecuggftrfgrth htvghrnheptdelledvgfejvdffieeukeefueelfffhgeffhffgffekveeuheeihefhiefg hfdvnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheprg hnughrvghssegrnhgrrhgriigvlhdruggvpdhnsggprhgtphhtthhopeduuddpmhhouggv pehsmhhtphhouhhtpdhrtghpthhtohepughgrhhofihlvgihmhhlsehgmhgrihhlrdgtoh hmpdhrtghpthhtohepvgigtghluhhsihhonhesghhmrghilhdrtghomhdprhgtphhtthho pehlihdrvghvrghnrdgthhgrohesghhmrghilhdrtghomhdprhgtphhtthhopehmvghlrg hnihgvphhlrghgvghmrghnsehgmhgrihhlrdgtohhmpdhrtghpthhtoheprhgvshhhkhgv khhirhhilhhlsehgmhgrihhlrdgtohhmpdhrtghpthhtoheprhhosggvrhhtmhhhrggrsh esghhmrghilhdrtghomhdprhgtphhtthhopeiguhhnvghnghiihhhouhesghhmrghilhdr tghomhdprhgtphhtthhopehhlhhinhhnrghkrgesihhkihdrfhhipdhrtghpthhtohepph hgshhqlhdqhhgrtghkvghrsheslhhishhtshdrphhoshhtghhrvghsqhhlrdhorhhg X-ME-Proxy: Feedback-ID: id4a34324:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sat, 18 Apr 2026 12:33:27 -0400 (EDT) Date: Sat, 18 Apr 2026 12:33:26 -0400 From: Andres Freund To: Melanie Plageman Cc: Alexander Lakhin , Tomas Vondra , David Rowley , Kirill Reshke , Chao Li , Andrey Borodin , Xuneng Zhou , Robert Haas , PostgreSQL Hackers , Heikki Linnakangas Subject: Re: eliminate xl_heap_visible to reduce WAL (and eventually set VM on-access) Message-ID: References: <97529f5a-ec10-46b1-ab50-4653126c6889@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi, On 2026-04-16 16:21:35 -0400, Melanie Plageman wrote: > On Sun, Apr 5, 2026 at 11:49 AM Andres Freund wrote: > > > > I think we should probably just have GetLocalPinLimit() return something > > considerably smaller than num_temp_buffers, e.g. num_temp_buffers / 4 or > > so. > > I think num_temp_buffers / 4 seems reasonable for GetLocalPinLimit(). > We'd also need to make this change in GetAdditionalLocalPinLimit(). Right. > We will likely see an impact on performance impact because this will > keep the readahead distance substantially lower for temp table cases > with only one read stream. I don't think it's likely to be practically relevant. Unless you use a toy sized temp_buffers - in which case readahead won't be a relevant performance bottleneck - the pinned limit will often even be higher than with shared buffers (due to the shared buffers pin limit being divided by MaxBackends). Even at the default temp_buffers=1024/8MB, the limit would be 256. That's quite high for a single scan in such a tiny pool. > > There always may be more than one scan going on, so we can't ever promise that > > there's at least a certain number of pins available. The main goal of the > > shared pin limit is to prevent one backend from pinning disproportionally much > > of s_b. And for that eventually scaling down to just needing 1-2 pins per > > scan is sufficient. > > With the last sentence "And for that eventually scaling down to just > needing 1-2 pins per scan is sufficient." -- how do you mean to relate > that to what we will do with local buffers case? Just explaining why we shouldn't see these limits as hard limits that may never be exceeded, but as caps that make problems less likely. I guess I could see an argument for doing something more complicated for temp buffers than num_temp_buffers / 4, e.g. Min(1, (num_temp_buffers - NLocalPinnedBuffers) / 4) so that we get more conservative the more scans are concurrently in progress. But I'd not go there right now, that seems like a more complicated project (and we'd presumably want to do something roughly similar for the s_b case). Greetings, Andres Freund