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 1vsQjq-000mSW-1h for pgsql-hackers@arkaria.postgresql.org; Tue, 17 Feb 2026 19:28:03 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vsQjp-00BhGd-2S for pgsql-hackers@arkaria.postgresql.org; Tue, 17 Feb 2026 19:28:01 +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 1vsQjp-00BhGK-1V for pgsql-hackers@lists.postgresql.org; Tue, 17 Feb 2026 19:28:01 +0000 Received: from fout-a4-smtp.messagingengine.com ([103.168.172.147]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1vsQjm-000000016Uy-1xSU for pgsql-hackers@lists.postgresql.org; Tue, 17 Feb 2026 19:28:00 +0000 Received: from phl-compute-02.internal (phl-compute-02.internal [10.202.2.42]) by mailfout.phl.internal (Postfix) with ESMTP id 1E86BEC0619; Tue, 17 Feb 2026 14:27:58 -0500 (EST) Received: from phl-frontend-04 ([10.202.2.163]) by phl-compute-02.internal (MEProxy); Tue, 17 Feb 2026 14:27:58 -0500 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=fm3; t=1771356478; x=1771442878; bh=XtWgQ7Ejun6UdeYAq8FRfkXPpRYaQMfj36tTmRv/yx8=; b= o8QSV5zTznoO8kaPrfVTofHIhYaIcj+c9dD0Uc94WJWzvnaDQ31H9nA2RnRy9J9u UyE13oFFGVRgr+sY3dDUArTpYkj1k0MUqWgIV7VAdy/5wtmLjJcYL6M4tSR3aDVA SmpFsF9o+nHRLhVZUB5DJzKKFC7011/JyE/81CPJV58fDXbl45HQl9C5B0VvyorN GJmNmA3a62aRJMvMUsJIuqEDLaWCDJW729RHgZ5JDpQDQ36yzVaHUQmmeq0cqqtG 9qRkyBubHMgX7F77HLeSgn6ioeR9ffG+ZZGlcuwl3CORuHusnL/ZMdTACGdMgxoA a2IQMNaYoFWYuuFXZ94l9g== 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=fm3; t=1771356478; x= 1771442878; bh=XtWgQ7Ejun6UdeYAq8FRfkXPpRYaQMfj36tTmRv/yx8=; b=s IFqHT05MW3oTLGs06KsZEe8oQTxMNncZjoQ03g1XXPLOudeTlFS8b8ak1Xtt6bvH J0F/PyCDTYKr+nn51WX7J6+pvUkeAf0+HhOrhXUMsRwScI+wfDHuRpWZM1ax1sBI 7boMeStk7qdUgCXH+3wVHMjQWOLtG4yjoDQ/x/zQknabn7MtOCnjfqZyx7ljGRZ/ FPSmiAbupUen1TVY6L5bjshxwacrCHtynkOeL/4jzGWBsgn5blFphtJ3pe7oAFwp im9swwzFkuc2HKv8bpVDe/bDH+Tcgso3Tkcw3lWyCCpBl0h6O0SET8ZZZ2DisF8A OB7g7aB05FiEEdtZL+BGQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgddvvddtiedtucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujf gurhepfffhvfevuffkfhggtggugfgjsehtkefstddttdejnecuhfhrohhmpeetnhgurhgv shcuhfhrvghunhguuceorghnughrvghssegrnhgrrhgriigvlhdruggvqeenucggtffrrg htthgvrhhnpedtleelvdfgjedvffeiueekfeeuleffhfegfffhgfffkeevueehieehhfei gffhvdenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpe grnhgurhgvshesrghnrghrrgiivghlrdguvgdpnhgspghrtghpthhtohepuddupdhmohgu vgepshhmthhpohhuthdprhgtphhtthhopehpghessghofihtrdhivgdprhgtphhtthhope hknhhiiihhnhhikhesghgrrhhrvghtrdhruhdprhgtphhtthhopegshigrvhhuiiekudes ghhmrghilhdrtghomhdprhgtphhtthhopeguihhlihhpsggrlhgruhhtsehgmhgrihhlrd gtohhmpdhrtghpthhtohepmhgvlhgrnhhivghplhgrghgvmhgrnhesghhmrghilhdrtgho mhdprhgtphhtthhopehordgrlhgvgigrnhgurhgvrdhfvghlihhpvgesghhmrghilhdrtg homhdprhgtphhtthhopehrohgsvghrthhmhhgrrghssehgmhgrihhlrdgtohhmpdhrtghp thhtohepthhhohhmrghsrdhmuhhnrhhosehgmhgrihhlrdgtohhmpdhrtghpthhtohepph hgshhqlhdqhhgrtghkvghrsheslhhishhtshdrphhoshhtghhrvghsqhhlrdhorhhg X-ME-Proxy: Feedback-ID: id4a34324:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 17 Feb 2026 14:27:57 -0500 (EST) Date: Tue, 17 Feb 2026 14:27:56 -0500 From: Andres Freund To: Peter Geoghegan Cc: Tomas Vondra , Alexandre Felipe , Thomas Munro , Nazir Bilal Yavuz , Robert Haas , Melanie Plageman , PostgreSQL Hackers , Georgios , Konstantin Knizhnik , Dilip Kumar Subject: Re: index prefetching Message-ID: <64mfcfv7iihc4pmqlxarii4esnmqry52ckz5m7lmwylnfnuxuz@oxh4ioxkjtep> References: <64a2re223ajj4popowsyu4xekbuvvyfwkrihn5yzyrkwsmsuvp@2lls3tpww5dl> <52512325-b1f2-4fff-819e-f68122b2e427@vondra.me> 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-02-17 12:16:23 -0500, Peter Geoghegan wrote: > On Mon, Feb 16, 2026 at 11:48 AM Andres Freund wrote: > I agree that the current heuristics (which were invented recently) are > too conservative. I overfit the heuristics to my current set of > adversarial queries, as a stopgap measure. Are you doing any testing on higher latency storage? I found it to be quite valuable to use dm_delay to have a disk with reproducible (i.e. not cloud) higher latency (i.e. not just a local SSD). Low latency NVMe can reduce the penalty of not enough readahead so much that it's hard to spot problems... > > Note that there is pretty much *no* readhead, because the yields happen more > > frequently than a io_combine_limit sized IO can be formed. > > ISTM that we need the yields to better cooperate with whatever's > happening on the read stream side. Plausible. It could be that we could get away with controlling the rampup to be slower in potentially problematic cases, without needing the yielding, but not sure. If that doesn't work, it might just be sufficient to increase the number of batches that trigger yields as the scan goes on (perhaps by taking the number of already "consumed" batches into account). To evaluate the amount of wasted work, it could be useful to make the read stream stats page spit out the amount of "unconsumed" IOs at the end of the scan. > > With the yielding logic disabled: > > > The comment seems to say it's about avoiding to look very into the future when > > using index only scans that just need a few heap lookups. Certainly an > > important goal. > > The main motivation for yielding is to deal with things like merge > joins fed by at least one plain index scan, and plain scans for an > "ORDER BY .... LIMIT N" query. Would be good to document why the yielding exists more extensively in the comment above it... > I attach an example of where disabling the yield mechanism hurts > instead of helping, to give you a sense of the problems in this area. What data/schema is that? Looks kinda but not really TPC-H like. I assume that there are no mark & restores in the query, given that presumably the inner side is unique? Greetings, Andres Freund