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 1ulc9g-003GHA-Fv for pgsql-hackers@arkaria.postgresql.org; Mon, 11 Aug 2025 23:42:16 +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 1ulc9e-004QUO-Uj for pgsql-hackers@arkaria.postgresql.org; Mon, 11 Aug 2025 23:42:15 +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 1ulc9e-004QUG-I3 for pgsql-hackers@lists.postgresql.org; Mon, 11 Aug 2025 23:42:14 +0000 Received: from mail-wr1-x433.google.com ([2a00:1450:4864:20::433]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1ulc9c-0006az-1S for pgsql-hackers@lists.postgresql.org; Mon, 11 Aug 2025 23:42:14 +0000 Received: by mail-wr1-x433.google.com with SMTP id ffacd0b85a97d-3b78a034f17so3740538f8f.2 for ; Mon, 11 Aug 2025 16:42:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bowt-ie.20230601.gappssmtp.com; s=20230601; t=1754955731; x=1755560531; 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=VT1I3D7bpb9V4D7hJzSdfyAtc3dCisFI2LsuyokIFMM=; b=hFbJ+LJA91YiN/kz2XsfHYgIdKbngeG/HOZuxqE+dzThFc+QZj7nJ6I9kmtHf8hW7m 95zspB2QDSezxjOP7fPCZT2XbDpM+wpp9HXmV7t4AmJnk/oSXkxOklvl3ilwKbEwZMTV /X0OVpTWLF/Nhc+SywoudD8SgARg1kNVoyttrkrqqKnySmCQbRPM3fVaDsPxhzBbXjB8 IWS6k1X5zFphaB2mEE9t/Ty9nh80I8crQd0EW7xk96xuTaR34IrYXiLCZ3Yxakca6xFh bU/cNwhrr3PYd+4K49k6s5adEuWCrLJlKbrz1txy0/R4U75TAb+ynhqO5KGN0hk3KorO CuIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1754955731; x=1755560531; 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=VT1I3D7bpb9V4D7hJzSdfyAtc3dCisFI2LsuyokIFMM=; b=oXBUuT8WgQxrJxIzMqNwkQDxTakj6IoXZWP9RYnM1AtD7sCH2btCpi/u+utigaFyH/ 8jFEnPjXLBsj6+2SG8J+VdkeOyeBdhLVh+2m5cf1296e4lnAg10T+6JjNmzmYqzqvSej y0NrHVGtUeiPhAnpdnFWTvRN8Rr00HDJDkm57d4wnYOyhCpcpNp9QACcK17+uFcaKk6m aMaQ/MNhXKooOJfm/g600Jy8Fs/WRcVPJgW9S8+8+L+TbogVWDPTOg6rkaE8dSuGO8TJ qnvLIe20K9o6qQ9yndzGT4RgCQYeph7RDxp7R5C7nuE/aeucZPwe0XedjejRGjGpKDWe R+kw== X-Forwarded-Encrypted: i=1; AJvYcCUZSJrOXy+/I/a+Vg3nC8mfN5VA6/4KYIAUboyZ7wvexH4upnr2oeqU/UqcTOZldrRIH41+9XBSNtwIjk5M@lists.postgresql.org X-Gm-Message-State: AOJu0YzFDuHB3T2mhnTWa+ojYtSHHt/MaqwasTxCxffEn8R+Vs8ep0sI GA9IH5Cu3f8bh/Z5qLyQA1acchbZqQCd25p08NbltSCZfJp7Ph0TsoHDC3BAInQOFsS4AX+08jd Ns6PtIoyxo7VR7lIJ8xmLAyJCEBsmEd0RdFLAzfKERw== X-Gm-Gg: ASbGncuxo9RjVYDmIH2TOgEuoi+nmXbzVSpgH6H4aTgXL1cJ3JSwqwAQPUl+Tik4iBD rGSU08YKCL503ckVtTINMnYgGl+perMCdhxlv6c8L8f/kGfQ0KAGOKeatDA3Ag8Sk99a98fQ9sW WFVMtOVK3auVA+4OELPFoihrll63zTGBAfFEZDF8KdXFUA0TgtQ+pie/L9w6+5bkV8OcsYdtb8M ri2Bw0= X-Google-Smtp-Source: AGHT+IEsIyKBssDOooA3VE1Kdanz0wLsKu4psvjl4d+2j8ZlD0eQtACzCIDSfFr0kXvg0w0u1a7EtuDiOFXvpYVHmuw= X-Received: by 2002:a05:6000:310f:b0:3b7:925b:571c with SMTP id ffacd0b85a97d-3b900b83ca6mr10829846f8f.57.1754955730312; Mon, 11 Aug 2025 16:42:10 -0700 (PDT) MIME-Version: 1.0 References: <8ed1d326-5c6e-476e-b3fd-30d3da210546@vondra.me> <38b865bd-2ae9-4a94-a788-6e3dc99ccd70@vondra.me> <306fc8c0-c882-4602-86f5-a106b9ace603@vondra.me> <152ea782-5bd4-4435-b021-0ab2da61e63d@vondra.me> <7c2f6350-6fca-4e39-b0a8-8ac735f5d58a@vondra.me> <2e63cadd-2a03-46b1-866e-7ea5d3ffd37f@vondra.me> In-Reply-To: From: Peter Geoghegan Date: Mon, 11 Aug 2025 19:41:44 -0400 X-Gm-Features: Ac12FXw4YvHcfhu3yxDzhlGhWxKFyESQEuBoCU_f9SzBeGjoPFiqhmt0I-ZtmPI Message-ID: Subject: Re: index prefetching To: Tomas Vondra Cc: Andres Freund , Nazir Bilal Yavuz , Thomas Munro , 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 Mon, Aug 11, 2025 at 5:07=E2=80=AFPM Tomas Vondra wrot= e: > I can do some tests with forward vs. backwards scans. Of course, the > trouble with finding these weird cases is that they may be fairly rare. > So hitting them is a matter or luck or just happening to generate the > right data / query. But I'll give it a try and we'll see. I was talking more about finding "performance bugs" through a semi-directed process of trying random things while looking out for discrepancies. Something like that shouldn't require the usual "benchmarking rigor", since suspicious inconsistencies should be fairly obvious once encountered. I expect similar queries to have similar performance, regardless of superficial differences such as scan direction, DESC vs ASC column order, etc. I tested this issue again (using my original pgbench_account query), having rebased on top of HEAD as of today. I found that the inconsistency seems to be much smaller now -- so much so that I don't think that the remaining inconsistency is particularly suspicious. I also think that performance might have improved across the board. I see that the same TPC-C query that took 768.454 ms a few weeks back now takes only 617.408 ms. Also, while I originally saw "I/O Timings: shared read=3D138.856" with this query, I now see "I/O Timings: shared read=3D46.745". That feels like a performance bug fix to me. I wonder if today's commit b4212231 from Thomas ("Fix rare bug in read_stream.c's split IO handling") fixed the issue, without anyone realizing that the bug in question could manifest like this. -- Peter Geoghegan