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 1w8hen-000nSl-1d for pgsql-hackers@arkaria.postgresql.org; Fri, 03 Apr 2026 16:46:05 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1w8hem-00CePU-0s for pgsql-hackers@arkaria.postgresql.org; Fri, 03 Apr 2026 16:46:04 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1w8hem-00CePM-00 for pgsql-hackers@lists.postgresql.org; Fri, 03 Apr 2026 16:46:04 +0000 Received: from mail-ed1-x532.google.com ([2a00:1450:4864:20::532]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1w8hek-00000000PAB-03Zo for pgsql-hackers@postgresql.org; Fri, 03 Apr 2026 16:46:04 +0000 Received: by mail-ed1-x532.google.com with SMTP id 4fb4d7f45d1cf-66c304dbfd2so477801a12.0 for ; Fri, 03 Apr 2026 09:46:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1775234761; cv=none; d=google.com; s=arc-20240605; b=VEqO/kRwWlL1wxuzZSnPKmWQlTYaIfQuTOGyj5jrvNKbp+Wvhm2uG0lz6JF4mxizqd w7JjcalRge79PmVCq6mX2fjehL1VPdjm+vgMIzKXLoImS0pw39dZPVzg8ITUJgnd1oCT DnSJ6m3eWA7VIOI885/bvBO5fxfch0CviJx1qOhahWndstQFACUEnvVpPR0dq5FQZ9Cp Vz0OmTDLv+q/xYbz2Ko2dK29XO0v09pifk+Yw0Zz2TiOvwMMlJNHoRJJl40VTO+sPhyV A1tM5dbDglfY8oBWS3mnSM0WCZXljkO+smTTqcv2h4VxjnAmPqxzuVbs7WLP1hgLhXRP YKfw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=hq6fOQgAihXekB1AinOyngvarmBTiViIOPCxOpWdEUI=; fh=6kU5ZoEgIsrGDmwQUFHA4n270MihNmGMGqetxYGywuU=; b=D+60mX+TzeegymSbUIr1yuQ/s6NQX/CQxJzLv9N2/LXCPBZkw2w9loU1xRHEjFcnkf qE+OBVUIG6mwdE1R3elc4DKCRQ7h1eqd2cDlT82KqMWiOp0OqVyq42FO3nnsjrWkemWv gvGuzxAWvIsW5SatrIMiw5kGI8s5WEpKhHPQnHP2oYqaT2msPScRn488stT6iL7TrcoQ DLpnSWphkawLEdA4Prx75CmRoveSO4qHKtaTBRziA/f6aMuay2v6mmRNIWQa1R2Divkc 62/iu3QmXik8/YwDum4QeUa4Ewt5MIDPwQn2zkz+8LtSejrFXKN4LE7hKk/eg8DIq3rs w/dg==; darn=postgresql.org ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1775234761; x=1775839561; darn=postgresql.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=hq6fOQgAihXekB1AinOyngvarmBTiViIOPCxOpWdEUI=; b=sW50vpp65fIrT/XfdZ48hzxp5PoWTzxIlJ5yF+JdtpK0Na40d2YStNJCUa6JDdpJJD p7dbOoMtiKJO9cSnm/39kGSJHjP1sNQ9QBhMs2RdwbmEX1OBH7lnxQlk2f+3u3T16JuL dBQEtdgQOZt8RM9DCDrQ0E/r+8a0m05i3m9lb23ARStQfdeiIOYGklyJpHAIajW9HT8m D40873WN7NwwPQhT3ndXhK5dNx7XgtpzAXkSyq51Bvxrrv7J+Ufhn8rH2cKHOsDmrtN5 LDFyf0hyukYkvFvhZLw+1hzqyZ+tO0Or/YZYsG9BlHgwMlDxbvBh9C+j7SZN3QRAXKeq xCDQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1775234761; x=1775839561; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=hq6fOQgAihXekB1AinOyngvarmBTiViIOPCxOpWdEUI=; b=OUWRJxIGPDfpyYb5PbGRii6+G2f9m0RujB26PeZxM+nzy+NjaYK3IdZLpVe2G/zzyP pd/LZsMU1gbyBCr08hM9A9RwGxN7N6oY6yrxUfUAgJAfOdeliWWk7VJEpBPJTGMQOyLE BlEcuy1dEytUBICgijvDqvTsFf6KH6+iqI/yRKKCJmv/aCwXcQ4SYKiA17cTJhE0J63I YFhlLTtPzUmfr5j/MzvV7oIup6bPKN9sy+ekKQLfKsBG3EVeq7UHG/XZso1+isUyhrgE C9yR9ERfLbPJLKglrxX52Sj+W46Ousv7rnln3YeB2/YYQ5MkGZHkiDrlKBAVI4g0VMUp 9zHw== X-Forwarded-Encrypted: i=1; AJvYcCX73X0EqkeIbUGL73maeJprJ57R4iZx2FGzyGLFpC833zdrE0frWSNfLeQt+1gEJwjE6q1EvH+rHG3ZV1fC@postgresql.org X-Gm-Message-State: AOJu0YwxTrsQAN57DAVlEsBvPMhheRD8ryBmhYqgrOg6JZSceSZTPhhT S2f7rgH7fCxxyBGQf+EscsxRs8Aiz/gmx518CYGKI31iG1mkTKuFCiL+LiG3V7KFJ/jo/iEpHi+ pQ1FDHJjQElwLnJr1jBrCNq28wu+QrMc= X-Gm-Gg: AeBDies661CsIYAAqf7uw2PwdbBbKkKfniWXa5MPXMq/oakazC7HJi6ptnRP75yhnvn hNpssNt9B5MIrPtS5DvfmVOYT1UWcl/b73i0R+HjDL6PdeV1epxhn+2D2Cm1e/6SdiXk+LC+8dQ vxsC2qyAul+refflDw7DhqMyWVdqbOcxPJ0+3Ce6EdrBA5ZrUpm9R4WrzM4SktrXTSbwar+dddB 6u+WDLK51fIZ/iw7QZBKxqhykAlz1GMqA4vgbsdl849Igy53qrayCUw2aWEI/51e1siWoY2mo2w hZEl5ni9cMtRIm3wshUvERlg+scViBwGUtLKqYefir5vqoTovMs1wAZGZlEvW3LvIA1J9WbXlKi mK8J4UIPq X-Received: by 2002:a05:6402:a590:20b0:66d:d11c:fa0e with SMTP id 4fb4d7f45d1cf-66e07b2a743mr2443899a12.12.1775234761422; Fri, 03 Apr 2026 09:46:01 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Melanie Plageman Date: Fri, 3 Apr 2026 12:45:50 -0400 X-Gm-Features: AQROBzBKSKwu8EOuZBtGCupnbiVTVqISPDk7Rejl0cGjWUBUa2Myn2p3GDGsu_E Message-ID: Subject: Re: AIO / read stream heuristics adjustments for index prefetching To: Andres Freund Cc: Nazir Bilal Yavuz , pgsql-hackers@postgresql.org, Thomas Munro , Peter Geoghegan , Tomas Vondra Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Thu, Apr 2, 2026 at 9:33=E2=80=AFAM Andres Freund w= rote: > > > + /* > > + * XXX: Should we actually reduce this at any time oth= er than > > + * a reset? For now we have to, as this is also a cond= ition > > + * for re-enabling fast_path. > > + */ > > + if (stream->combine_distance > 1) > > + stream->combine_distance--; > > > > I don't think we need to reduce this other than reset. > > Hm. I go back and forth on that one :) Separate from the fast-path enablement, we also probably want to decrease combine distance when we decrease readahead_distance because there is a point where we still want to parallelize the IOs even when the distance is lower and to do that, we need to make smaller IOs. I'm not sure where this point is, but I wonder if a few 256kB IOs is faster than 1 1MB IO (could test that with fio actually). I imagine that there is some size where that is true because of peculiarities in how drives (and cloud storage) issue/break up IOs after they are a certain size, etc. - Melanie