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.94.2) (envelope-from ) id 1udese-00B2ZS-HW for pgsql-hackers@arkaria.postgresql.org; Mon, 21 Jul 2025 00:59:48 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1udesc-00D0e7-Ae for pgsql-hackers@arkaria.postgresql.org; Mon, 21 Jul 2025 00:59:46 +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.94.2) (envelope-from ) id 1udesc-00D0dy-1D for pgsql-hackers@lists.postgresql.org; Mon, 21 Jul 2025 00:59:46 +0000 Received: from mail-oa1-x2a.google.com ([2001:4860:4864:20::2a]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1udesZ-008Lre-2m for pgsql-hackers@lists.postgresql.org; Mon, 21 Jul 2025 00:59:44 +0000 Received: by mail-oa1-x2a.google.com with SMTP id 586e51a60fabf-2ff053c32adso445858fac.0 for ; Sun, 20 Jul 2025 17:59:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1753059581; x=1753664381; darn=lists.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=K3GmxyJWsRe90JdqHoDZK4zPj8Om0IfRhqEgBuoB2wI=; b=hj5vboDBb/L7gYRsQUZ0gL0a1h4+t2F9euWkSfV8vqkk1OqeAEmJrQtZN3tcQn4EXh OGc7S2IW0nBBNL9VrCIcBApX50NjteO35STw9qQgURVS/G38VblELruZcGFHwQKKtDDh BlbOLKvVeJVYfml9Nr75EopNxcWm4vKz85Nfe1ghxOLkKbIug+Xzpxv8kV61I9ncPBGi kfYkqlvG9i4SPz/VFF89vBcWqZuF8qsv51Eyp4TnbiLu6LaPvuKH8O7de6gb61NsDN4p 6RRUpuO1E4qHomBusZyqrAbhboHVw17N8f6f1zi20AYdX/x56GP8jZdWEIZA5l/D+Mjx Z0hQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1753059581; x=1753664381; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=K3GmxyJWsRe90JdqHoDZK4zPj8Om0IfRhqEgBuoB2wI=; b=JeNUEFcMMVsGMIzhszfRsIY4xOk2tTbZM0fy5gROjJMhMJMWmj9hZNaR09Jf+rY0Ia r0s43YCn1tZW6b9nemTqaOcRdxTdiQdS2idEJuoFgfjqS1Os1u0ZSQQbh73Vm7mAC3WI lhgRFfUC8S8y36DbRnQFHFsQhSwbGS/onxWer/rZz6NJr7tkKwh6VaQrabf05tp1/thf myZcxWeNWO6YmPq8aHGgYyG5NoBMfJyaiW6YGUYhlVaVMcyKNls6Fb84/m5q83L5CLa5 fbwUSZVs2772FiW/v0XQYhMGhooH1zGeo4mbBBmaSRTewgXzhd7xS4mQznG6s8CLsUOf SEGg== X-Forwarded-Encrypted: i=1; AJvYcCXScl1xr8qJA/Kzg8r1zDzi4NXQJq7Yxycdh3o4ROLVkWFZBDcLKENAAaVMl3I9yCobgd8++96AZzR0xZPg@lists.postgresql.org X-Gm-Message-State: AOJu0YyY768PluismJh5fXVXwV4JmQLnjfYi9b51SNdJQRniyclD5w0p qVItRG1f4ZvhKC6vnTmblTuRps3F2PxxOcJ2YCVBYqSVMSiZCbNK4j72ho24e6sugURR+NYc5d/ 07QdVDYkIAhZxynV/zeiX2Zna+vm488k= X-Gm-Gg: ASbGncsZ8/z9JmvdPUHlluYYDV2e7dtq+/QgJNN+6BQfpPfgvz6Vk+Er3wTYh/vV5ga FnD35yZRwyDjz+ReWhyprtXlGHsGw0F2bgOmlE4VV+63Ha7kDV06IMhZnz7OfDntK4AN5dryyst xLyVjI7GyXhpRGC3+5vywP2oHpCLKEcAlBo7UEWuQACm19vQiRXDFYOb/UlqClA3OwlzVnO6mdo IYI5OfLDoNbpEbpQ1/jz8RaaEG8lzi8U+JjcaSr5w== X-Google-Smtp-Source: AGHT+IGa5xBRAmhVfz6KBWDsYcP3fQzcUiCA9W1HzhRAkKww7QDxSmi3vHn5CancqvB/2li3vyW+OgkSH3Gs1AVvzCQ= X-Received: by 2002:a05:6870:1f10:b0:2cf:c478:190d with SMTP id 586e51a60fabf-2ffaf4fec2dmr4987859fac.9.1753059580630; Sun, 20 Jul 2025 17:59:40 -0700 (PDT) MIME-Version: 1.0 References: <57d0e292-73d5-4ab9-9855-110ee9cbd90a@vondra.me> <32c15a30-6e25-4f6d-9191-76a19482c556@vondra.me> <64c8b824-6203-46a3-b045-5e95b796feee@vondra.me> <03dcc1a9-c5d0-4965-889c-684dc0a7580c@vondra.me> <23f490f4-8325-408c-91a0-a6757ab2441c@vondra.me> In-Reply-To: From: Thomas Munro Date: Mon, 21 Jul 2025 12:59:04 +1200 X-Gm-Features: Ac12FXxV_ux2wHfAB5-voZ0TsJGfBWqVkZ7gQRKGQaSM-eify4SlWU_LtGEov6Y Message-ID: Subject: Re: index prefetching To: Tomas Vondra Cc: Peter Geoghegan , Andres Freund , Robert Haas , Melanie Plageman , PostgreSQL Hackers , Georgios , Konstantin Knizhnik , Dilip Kumar 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 Sun, Jul 20, 2025 at 1:07=E2=80=AFAM Thomas Munro wrote: > On Sat, Jul 19, 2025 at 11:23=E2=80=AFPM Tomas Vondra w= rote: > > The thing that however concerns me is that what I observed was not the > > distance getting reset to 1, and then ramping up. Which should happen > > pretty quickly, thanks to the doubling. In my experiments it *never* > > ramped up again, it stayed at 1. I still don't quite understand why. > > Huh. Will look into that on Monday. I suspect that it might be working as designed, but suffering from a bit of a weakness in the distance control algorithm, which I described in another thread[1]. In short, the simple minded algorithm that doubles on miss and subtracts one on hit can get stuck alternating between 1 and 2 if you hit certain patterns. Bilal pinged me off-list to say that he'd repro'd something like your test case and that's what seemed to be happening, anyway? I will dig out my experimental patches that tried different adjustments to escape from that state.... [1] https://www.postgresql.org/message-id/flat/CA%2BhUKGLPakwZiFUa5fQXpYDpC= XvZXQ%3DP3cWOGACCoobh7U2r3A%40mail.gmail.com