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 1uf6YA-002BCM-6J for pgsql-hackers@arkaria.postgresql.org; Fri, 25 Jul 2025 00:44:39 +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 1uf6Y9-00CzRv-0H for pgsql-hackers@arkaria.postgresql.org; Fri, 25 Jul 2025 00:44:37 +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.94.2) (envelope-from ) id 1uf6Y8-00CzRn-I2 for pgsql-hackers@lists.postgresql.org; Fri, 25 Jul 2025 00:44:37 +0000 Received: from mail-wr1-x42e.google.com ([2a00:1450:4864:20::42e]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1uf6Y5-000h1p-1R for pgsql-hackers@lists.postgresql.org; Fri, 25 Jul 2025 00:44:36 +0000 Received: by mail-wr1-x42e.google.com with SMTP id ffacd0b85a97d-3b5e6bfb427so871423f8f.2 for ; Thu, 24 Jul 2025 17:44:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bowt-ie.20230601.gappssmtp.com; s=20230601; t=1753404272; x=1754009072; 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=zPSIVXxNoD1trUvKFyrKDTns4G+BAaZBRoyoXfLNp2I=; b=AOqSbXBf9U02C8dXyk7Q1oHwCJ22RnTybQ2MzzasOt1krwTepD1Q6vAd7lnW2JHei0 fPskNt4qS3CVO7adPyhu/Yr/MEJ3MGYyu06Fa3/WnS2X/ghu9xRY4KkkNe/l2VAz1PGS JF4/CXxI4fqvbxqb/Gsd2dTxb6UfO89TTUK7+aZe2QzIFbBX48guXtFQtaicxkBqgYRk Sq5+WYtF91p59qPt7C2Ou8bqFdiVGUlqbUipyEgLWoITr+0ny+Ditk2VMdSic6HoDZmh KTj7B8lwpqUUnYtvdyQLzVUes8ugKmZsYmjlZm82OFnZchD+j9gXWCcs6mjWRrX7YBSh owww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1753404272; x=1754009072; 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=zPSIVXxNoD1trUvKFyrKDTns4G+BAaZBRoyoXfLNp2I=; b=IoewQSx9LIls/hXudapMT2CQ+NGsbGsAiXWpApXeqWIScZzcJ4r7VHdv5rIQFDJOjp urE78YzPz3KkpzYgQmb1erJdE+bGFALpMB4udwKyt9rfh5sjlWz5Npck6P8yM/8U1x0C kSeO6Lv9pkGosaUh56sFifl7lwZYfquG9Oy9//Vkl2JHY+ar4qH1jNcFLvRB2RdshGU0 ilnBgNZY+YxxmCBBeALnqqDQRcWnywWJWgnrfI/LnBglsRkC5Vjrai4uWswcVoNL9dRd /wNTuXTRXshIErLAvuMsQ+fnqwE7Gc30T4Oa6D3HuVMj6XnFMl0b8H8vF/aCK6GSrUBn CY3A== X-Forwarded-Encrypted: i=1; AJvYcCWBRs9wZbxvW5bVkAMEIZ/Hs0o3/6dKHKGwGlKIq6o9yV/kGajN0B6+c6IF0z8SnUlAYMTvhgnZkTxIBi2h@lists.postgresql.org X-Gm-Message-State: AOJu0Yx+kljFWe14aVIeTNh4ORWZhDU7rFCw9K71Z0BBO15vJXpclmIA 1p7sekrrG86vq6rmHM0AoxbPT0wAxDkJUwkfB4DU+8Knt+EO20bWoedAW3ZP9AIgZ563ca1g59U mVlvaLGg7pXCTtn9uWXi0plYiyXkIdz4zRpBq/5iV+w== X-Gm-Gg: ASbGnctKNDmrRSM9TGq8DS9lv4v+2fKSrWK1Hm0MlQ+2bC0KAeZZGumGQL7rY3DDi2v 4KIgqQX1OH9fzJpfzwtvP/WyabF/D3sAoJ50CZGVSuZns7gxSme5rG0owYTpJkTG0hmjbVlY3mk Wa933tfS0Lshx7D8wrIuLo9hol87wzFu8Lb1dEL+a7R0MxdNJaNHab7kgD2U2TNZADSWkqfyBLp jSDlxs= X-Google-Smtp-Source: AGHT+IHQTJnMGCZAY0j3DhICrgI4v4S5anzQ2jjOWvDQA/P6/YGD1uCRKqCdSfA9yV4zoycw1vxCvMbzdkcU7/2Gcs8= X-Received: by 2002:a05:6000:26c1:b0:3b7:54b3:c512 with SMTP id ffacd0b85a97d-3b776693fabmr52514f8f.58.1753404271653; Thu, 24 Jul 2025 17:44:31 -0700 (PDT) MIME-Version: 1.0 References: <03dcc1a9-c5d0-4965-889c-684dc0a7580c@vondra.me> <23f490f4-8325-408c-91a0-a6757ab2441c@vondra.me> <1bebfd1b-aea5-4d41-80a6-eae64b8f9eaf@vondra.me> <8ed1d326-5c6e-476e-b3fd-30d3da210546@vondra.me> <38b865bd-2ae9-4a94-a788-6e3dc99ccd70@vondra.me> <306fc8c0-c882-4602-86f5-a106b9ace603@vondra.me> In-Reply-To: <306fc8c0-c882-4602-86f5-a106b9ace603@vondra.me> From: Peter Geoghegan Date: Thu, 24 Jul 2025 20:44:05 -0400 X-Gm-Features: Ac12FXxzFt_2a_2tyilT5ZqVOWEgDkJdNO-scVI5tVGpd8ZPET3u2S1bLN09vBU Message-ID: Subject: Re: index prefetching To: Tomas Vondra Cc: Nazir Bilal Yavuz , Thomas Munro , 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 Thu, Jul 24, 2025 at 7:52=E2=80=AFPM Tomas Vondra wrot= e: > Yeah, I forgot about that. Should be fixed in the v2. Admittedly I don't > know that much about nbtree internals, so this is mostly copy pasting > from verify_nbtree. As long as the scan only moves to the right (never the left), and as long as you don't forget about P_IGNORE() pages, everything should be fairly straightforward. You don't really need to understand things like page deletion, and you'll never need to hold more than a single buffer lock at a time, provided you stick to the happy path. I've taken a quick look at v2, and it looks fine to me. It's acceptable for the purpose that you have in mind, at least. > Yeah, probably. And we'll probably test on such uniform data sets, or at > least we we'll start with those. But at some point I'd like to test with > some of these "weird" indexes too, if only to test how well the prefetch > heuristics adjusts the distance. That makes perfect sense. I was just providing context. > I have a very good reason why I didn't do it that way. I was lazy. But > v2 should be doing that, I think. I respect that. That's why I framed my feedback as "it'll be less effort to just do it than to explain why you haven't done so". :-) > Yeah, this interface seems useful. I suppose it'll be handy when looking > at an index scan, to get stats from the currently loaded batches. In > principle you get that from v3 by filtering, but it might be slow on > large indexes. I'll try doing that in v3. Cool. --=20 Peter Geoghegan