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 1urfIJ-00AJCm-Ky for pgsql-hackers@arkaria.postgresql.org; Thu, 28 Aug 2025 16:16:13 +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 1urfII-003nME-RD for pgsql-hackers@arkaria.postgresql.org; Thu, 28 Aug 2025 16:16:11 +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 1urfII-003nM6-HK for pgsql-hackers@lists.postgresql.org; Thu, 28 Aug 2025 16:16:11 +0000 Received: from fout-a1-smtp.messagingengine.com ([103.168.172.144]) by makus.postgresql.org with smtp (Exim 4.96) (envelope-from ) id 1urfIG-002DWR-20 for pgsql-hackers@lists.postgresql.org; Thu, 28 Aug 2025 16:16:10 +0000 Received: from phl-compute-12.internal (phl-compute-12.internal [10.202.2.52]) by mailfout.phl.internal (Postfix) with ESMTP id CE64DEC00B9; Thu, 28 Aug 2025 12:16:08 -0400 (EDT) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-12.internal (MEProxy); Thu, 28 Aug 2025 12:16:08 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=anarazel.de; h= cc:cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm1; t=1756397768; x=1756484168; bh=pcu1lU+ivp Xz5+QscNSYl3J/LNyZe0AevfFPMJtLFrQ=; b=Hkt021jmfScat1gzj75zxzbvBB d7BRvcTZMLzcfyrKUdyKYSBicvIur9jJKqn3fbOC4auEUQYkVFCuxr0m+/SX+Mwc WElpU9YiNsLIkkZp6wlISWFTeWXBME2EbKkyzr2zRkcT1EccuYDf9IlO6ULWPXV7 y0AD6XZYFmHhbHBSE/PVQMjh8OvEjmzHSqVXl/ExbEA1JQ7kR0WjKmUe4CbjzcHV 5bTuxGAgisF7D1lr29YdoljkvxGF0Hxd+xSk8+8ajivld4vWjoUZjLbvwgxRX7Ca oOxTqYgCInwBAzsFldViZtodK5JZKtdxMFiHE9JQVi8JXNdCO24jqq+UUUTA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t= 1756397768; x=1756484168; bh=pcu1lU+ivpXz5+QscNSYl3J/LNyZe0AevfF PMJtLFrQ=; b=EO/YcfHAOtwaqDmdFADSAixw6C1V6knoL4xvwD9cIrtje1sBZav z5zqw/v7s1LCM9f6h2FIr/bzJ/cBVNDju+Wg8Qxmi3J8O4yMzh+8TRegZr5r76I+ 6EpyoEWHgiui7xcEKKefs9etUx++TfPZ3RrZltiQOxRUIzckvJKdzhYYVkecZ0fq LmT+WQYwwqV5z19XJikNhNDfcpV3yt6/DND2IVeT35hCaKZxxUJO4kPpDEH5c3Cq bvmTc3/CjP/woOi728D2FWCiX4p/fVbjdz5kSvAp0KgZQxWHEle1PF2SCufE2PMx 1vLZ1cY/uhYyIET5eiU7jGisAu633iWDZSg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtdefgddukedugeelucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujf gurhepfffhvfevuffkfhggtggujgesthdtsfdttddtvdenucfhrhhomheptehnughrvghs ucfhrhgvuhhnugcuoegrnhgurhgvshesrghnrghrrgiivghlrdguvgeqnecuggftrfgrth htvghrnhepfeffgfelvdffgedtveelgfdtgefghfdvkefggeetieevjeekteduleevjefh ueegnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheprg hnughrvghssegrnhgrrhgriigvlhdruggvpdhnsggprhgtphhtthhopedutddpmhhouggv pehsmhhtphhouhhtpdhrtghpthhtohepphhgsegsohifthdrihgvpdhrtghpthhtohepkh hnihiihhhnihhksehgrghrrhgvthdrrhhupdhrtghpthhtohepsgihrghvuhiikedusehg mhgrihhlrdgtohhmpdhrtghpthhtohepughilhhiphgsrghlrghuthesghhmrghilhdrtg homhdprhgtphhtthhopehmvghlrghnihgvphhlrghgvghmrghnsehgmhgrihhlrdgtohhm pdhrtghpthhtoheprhhosggvrhhtmhhhrggrshesghhmrghilhdrtghomhdprhgtphhtth hopehthhhomhgrshdrmhhunhhrohesghhmrghilhdrtghomhdprhgtphhtthhopehpghhs qhhlqdhhrggtkhgvrhhssehlihhsthhsrdhpohhsthhgrhgvshhqlhdrohhrghdprhgtph htthhopehgkhhokhholhgrthhoshesphhrohhtohhnmhgrihhlrdgtohhm X-ME-Proxy: Feedback-ID: id4a34324:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 28 Aug 2025 12:16:08 -0400 (EDT) Date: Thu, 28 Aug 2025 12:16:07 -0400 From: Andres Freund To: Tomas Vondra Cc: Peter Geoghegan , Thomas Munro , Nazir Bilal Yavuz , Robert Haas , Melanie Plageman , PostgreSQL Hackers , Georgios , Konstantin Knizhnik , Dilip Kumar Subject: Re: index prefetching Message-ID: References: <5v2wuxg65l5e3s6uf373zskcqqoukmraxiucnvgn4t7b5cmeqx@5mhqsurdj6xn> <6butbqln6ewi5kuxz3kfv2mwomnlgtate4mb4lpa7gb2l63j4t@stlwbi2dvvev> <0dd33755-cab8-49c8-b1ed-698732577fbb@vondra.me> <1c9302da-c834-4773-a527-1c1a7029c5a3@vondra.me> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1c9302da-c834-4773-a527-1c1a7029c5a3@vondra.me> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi, On 2025-08-28 14:45:24 +0200, Tomas Vondra wrote: > On 8/26/25 17:06, Tomas Vondra wrote: > I kept thinking about this, and in the end I decided to try to measure > this IPC overhead. The backend/ioworker communicate by sending signals, > so I wrote a simple C program that does "signal echo" with two processes > (one fork). It works like this: > > 1) fork a child process > 2) send a signal to the child > 3) child notices the signal, sends a response signal back > 4) after receiving response, go back to (2) Nice! I think this might under-estimate the IPC cost a bit, because typically the parent and child process do not want to run at the same time, probably leading to them often being scheduled on the same core. Whereas a shollow IO queue will lead to some concurrent activity, just not enough to hide the IPC latency... But I don't think this matters in the grand scheme of things. > So I think the IPC overhead with "worker" can be quite significant, > especially for cases with distance=1. I don't think it's a major issue > for PG18, because seq/bitmap scans are unlikely to collapse the distance > like this. And with larger distances the cost amortizes. It's much > bigger issue for the index prefetching, it seems. I couldn't keep up with all the discussion, but is there actually valid I/O bound cases (i.e. not ones were we erroneously keep the distance short) where index scans end can't have a higher distance? Obviously you can construct cases with a low distance by having indexes point to a lot of tiny tuples pointing to perfectly correlated pages, but in that case IO can't be a significant factor. Greetings, Andres Freund