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 1umdte-001KRy-DF for pgsql-hackers@arkaria.postgresql.org; Thu, 14 Aug 2025 19:45:58 +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 1umdtc-009OJ3-Vu for pgsql-hackers@arkaria.postgresql.org; Thu, 14 Aug 2025 19:45:57 +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 1umdtc-009OGE-Ln for pgsql-hackers@lists.postgresql.org; Thu, 14 Aug 2025 19:45:56 +0000 Received: from mail-wr1-x42f.google.com ([2a00:1450:4864:20::42f]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1umdta-000bDd-1Q for pgsql-hackers@lists.postgresql.org; Thu, 14 Aug 2025 19:45:55 +0000 Received: by mail-wr1-x42f.google.com with SMTP id ffacd0b85a97d-3b9170db547so1048625f8f.1 for ; Thu, 14 Aug 2025 12:45:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bowt-ie.20230601.gappssmtp.com; s=20230601; t=1755200753; x=1755805553; 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=fZiBbthdrEMBMcD9m68Eph8/ZKg+p8oeYe04XorcgAc=; b=hewZPXQqNUWa/r9A00CDiqNeHdYm5n/A4fnHLYlRcmdPPIDmwMhi7YIcgu27v9bCRN 2c4sZ7e7A7r9khjfF3B0zk0cpbHNPyxxv+8YIQimv2Gh3bcsd939gVOQjripQywxdGQG te43TKbv+xZGGIRt2bKanNKDUFCzFTvhx6L+k8e8QrBPfVNntqpe/aKIPC6Yg4jXkFlR Lz2dBNGus13I1Xx+VUWuCMpZ+XN7LNlCoYG4/11OVN1enpzY05wT+G8MCE02Yqu3mlzy fcMwu7/+UfVk6chgrBj7EVYdAIHbI8JzZWnFFLeXkSdIwhgxlTRInObWNLcf3lUhdTW8 YdqA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1755200753; x=1755805553; 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=fZiBbthdrEMBMcD9m68Eph8/ZKg+p8oeYe04XorcgAc=; b=ctsdT1TlFIABOCMLPQJgvN+U/g/MVmC/TkyrCFza3YKjD3Zbn/pqWRVFtpU2IEYTEZ EcPigSUpRCah8clvQo3W1x976d3T1hwo/6dqMkXpP1cXxJSlrra1wnlUpfZI/lTl4wUR zMkbcp1vB7CDDEtlywW7J3f9KLLwbBxDpfMKH3FAi9SJUVvNEcOln83hgzkHeTV9KeZ/ CTeJBgDJv7RBgapgZZrHb5VCEJXKYsW6afHTmlfLFY7bVyAoPayvypT8tRnqImqkQzp8 uc6mq0ThWjcZWPZcP3ZZKY6mbHLH6lGr3ipywdu/n0Tj/1szkgv44KcIEpYrjcMVOwaR 1RZg== X-Forwarded-Encrypted: i=1; AJvYcCUaux2CZRDDAVGuaZmK7ksJ7964K7Zaqodhl6UecW1oXHONqTKIHO4OyklFD5Lrx/vP2DNJFtRnlQ7hb8jL@lists.postgresql.org X-Gm-Message-State: AOJu0YzQM2h8YQ2H1v4IC+kScU4xW7OdObe8eE7jjnvoZST13gToppJB qHdpWDYNfm3xhfIweHh/YiV5QjGbCjdmR/J3370WPaTIFD56QWvIAbSWnEx/g1LXDBzU0v3H6wM QYdgqy2Nq+HEbOTWDcbM9Nu+dxRvreWhlTzQlPduffw== X-Gm-Gg: ASbGncuGj0i/9TK5j68s7E5743WF7uijGVPGOVahnGCq06n2IYGvmur58EMhmfYlwFU l3GCWKYTDwdQcn/L/r0of/Xi4q7zAZjNJE5aHBBCwrcae6dq9j4nWcNmQhcE5FvOS53wTx77990 yYFvzNTEnrJxHkShj03ZPb7pGuhTV27FxQcJs37HR/A2kfkk8UnnqPNxZ/4BMa0ca3240M3p+Lx 5Sep98= X-Google-Smtp-Source: AGHT+IGslzqkUD5YnbEit9AwZtHl8eERB5A6g2CNAyDjcsSfjTPpJaV8o/yOU6VzU1ohTbAJwycAOHb4ium1Yi+Yqbs= X-Received: by 2002:a05:6000:2f84:b0:3b8:d337:cc2d with SMTP id ffacd0b85a97d-3ba508eb0b2mr3280546f8f.18.1755200753501; Thu, 14 Aug 2025 12:45:53 -0700 (PDT) MIME-Version: 1.0 References: <6cb6109d-71d6-490c-8056-d8885081b008@vondra.me> <7c308720-5cd4-4508-8cc0-6e55a6352731@vondra.me> <6wyxbnry2unm3kbcu2sabhzhs7baoedlg77xqm42chpofjq45g@igst42zpl7ok> In-Reply-To: From: Peter Geoghegan Date: Thu, 14 Aug 2025 15:45:26 -0400 X-Gm-Features: Ac12FXyUiVApGiRYUWr7obnhBggzdrfanjG5O9BVoRbHsIK0eGtlcVW25cYZ888 Message-ID: Subject: Re: index prefetching To: Andres Freund Cc: Tomas Vondra , Thomas Munro , Nazir Bilal Yavuz , 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, Aug 14, 2025 at 3:15=E2=80=AFPM Peter Geoghegan wrote: > Then why does the exact same pair of runs show "I/O Timings: shared > read=3D194.629" for the sequential table backwards scan (with total > execution time 1132.360 ms), versus "I/O Timings: shared read=3D352.88" > (with total execution time 697.681 ms) for the random table backwards > scan? If you're interested in trying this out for yourself, I've pushed my working branch here: https://github.com/petergeoghegan/postgres/tree/index-prefetch-batch-v1.2 Note that the test case you'll run is added by the most recent commit: https://github.com/petergeoghegan/postgres/commit/c9ceb765f3b138f53b7f1fdf4= 94ba7c816082aa1 Run microbenchmarks/random_backwards_weird.sql to do an initial load of both of the tables. Then run microbenchmarks/queries_random_backwards_weird.sql to actually run the relevant queries. There are 4 such queries, but only the 2 backwards scan queries really seem relevant. --=20 Peter Geoghegan