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 1thDZP-0006vT-6O for pgsql-hackers@arkaria.postgresql.org; Sun, 09 Feb 2025 20:06:23 +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 1thDZL-00GFwx-71 for pgsql-hackers@arkaria.postgresql.org; Sun, 09 Feb 2025 20:06:19 +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 1thDZK-00GFvR-LJ for pgsql-hackers@lists.postgresql.org; Sun, 09 Feb 2025 20:06:18 +0000 Received: from mail-lf1-x12b.google.com ([2a00:1450:4864:20::12b]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1thDZH-004Clm-2s for pgsql-hackers@postgresql.org; Sun, 09 Feb 2025 20:06:17 +0000 Received: by mail-lf1-x12b.google.com with SMTP id 2adb3069b0e04-545075ff6d5so1016490e87.3 for ; Sun, 09 Feb 2025 12:06:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jeltef.nl; s=google; t=1739131574; x=1739736374; darn=postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=AbvyRZwvcVyfJuNvo+Z7lFgPN3iXCkAhS072KjBArKY=; b=XLP7t6W1j5bjmxUh2nmUXPipU/UsR4C5R6BMmlKxF/W2v5sBwrULC1KgRXz1e936nr eTxl2rjHctgB6KERU2f/8o5V8MGiIFPpMr3tiwRliJtD2b+9BPYI+Vtjq/o/ToTdAp+s RwObJCDzYUVUjaC/z5UFoBznyCFH65i3sj7SAQ//TLoNTnUUUOIBrvFESOFNpG1ThKJh +q3jeZn2F+QyhnurP+Ej5SLF3ijTKa5DqeRCscyHrLpbviJeI1vH+Lb5wSGImVrssADI Nw0z/1eZO1SgJ4nJEvjfqj5YvOe2bbZYmrZvBKRsWJ967oKaQlIUSjLtg0GtVuRj3FAi 5eMQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1739131574; x=1739736374; h=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=AbvyRZwvcVyfJuNvo+Z7lFgPN3iXCkAhS072KjBArKY=; b=ZsSF3gN6d173WWtWJIyO5aIE/amR4t2ChBZfhdMqUVdjdP2A9vJJFWdMLKn8CrajNX bgJbtynFoWq2VgMvLJaJAhnA8HoiVRsibSb7iTgtB93Eky3G8zdFoiJYuF0d3fASyzyg OUIDG9bF4Mmu0Iki5P7bWFnLGkoBiudBgxpqRC1yu564qWFpwhM/xyEIcdFuR9SVzmNd wLoR0J1nZohAzi6/vAhiUJwiczyWY/jLWGVqZ3tqRITLN+mP801waCAA8WRbfqJGJfE9 diW54jDFdP604JF/R5OUj2eva4a81IQRmMJnlCy5RtCcdl2lf/zDsWN5GF6dEpeytV4/ POPw== X-Forwarded-Encrypted: i=1; AJvYcCW64yZWs0bTvRj03QxPZEFv/f7IlXyIs9kqQ1q1J+isGani9Yb0iWQqw/g6oQz730K9RVVKqp4r4aZ8Hn3w@postgresql.org X-Gm-Message-State: AOJu0YwzmD74Chr7DdGTSBdD/tkjuZT0tEdnyBlG5+Q6VGQsyKPULdMs fx6K9PbpNfdqpO3/ZAMarZ+GIlInCY9HTPuKF/crwONFg5j4lctQrrwiAtxJZkx3ohGjKvj6Bmt reO5kxRZ8aHOUIO7nMjBvbymctFBrVSx4KOh2pQ== X-Gm-Gg: ASbGncsPCZkEgWX0tgO5hJ36z5SRDfO0/mdRgSZ+9V4UIbNmwcl1Q70D9xxLXizES8l FCy8U8nHlIhVJeW6Q95EGAyLRah8Ym5GlvlVr86uu5jHgjKInc2YEzcJnTMgdZOFxydqeaVeDZQ == X-Google-Smtp-Source: AGHT+IHacohqlk0PlOQHVccZAxst32LWr2G1SRAPNmgV1eNcMc/V3b8DkyWCcGbWp1ItRd9mymkWvW0xtatSDXniums= X-Received: by 2002:a05:6512:39c3:b0:545:76e:319 with SMTP id 2adb3069b0e04-545076e0d7cmr1280408e87.4.1739131574217; Sun, 09 Feb 2025 12:06:14 -0800 (PST) MIME-Version: 1.0 References: <3861403.1735576764@sss.pgh.pa.us> <1f22794321b745549d54359d343e37b8@oss.nttdata.com> <2c9d6eaf26df17bec13bb03bf1e9bcbb@oss.nttdata.com> <2035079.1739124342@sss.pgh.pa.us> In-Reply-To: <2035079.1739124342@sss.pgh.pa.us> From: Jelte Fennema-Nio Date: Sun, 9 Feb 2025 21:06:02 +0100 X-Gm-Features: AWEUYZmPZVkUf2Hyowok_llFw7Vz61lPw0qtM6gcsUU5RxdFbUpBFcFH14sjZxI Message-ID: Subject: Re: RFC: Allow EXPLAIN to Output Page Fault Information To: Tom Lane Cc: Andres Freund , torikoshia , pgsql-hackers@postgresql.org, rjuju123@gmail.com, Bruce Momjian Content-Type: text/plain; charset="UTF-8" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Sun, 9 Feb 2025 at 19:05, Tom Lane wrote: > > Andres Freund writes: > > I'm somewhat against this patch, as it's fairly fundamentally incompatible > > with AIO. There's no real way to get information in this manner if the IO > > isn't executed synchronously in process context... Hmm, I had not considered how this would interact with your AIO work. I agree that getting this info would be hard/impossible to do efficiently, when IOs are done by background IO processes that interleave IOs from different queries. But I'd expect that AIOs that are done using iouring would be tracked correctly without having to change this code at all (because I assume those are done from the query backend process). One other thought: I think the primary benefit of this feature is being able to see how many read IOs actually hit the disk, as opposed to hitting OS page cache. That benefit disappears when using Direct IO, because then there's no OS page cache. How many years away do you think that widespread general use of AIO+Direct IO is, though? I think that for the N years from now until then, it would be very nice to have this feature to help debug query performance problems. Then once the numbers become too inaccurate/useless at some point, we could simply remove them again. > Even without looking ahead to AIO, there's bgwriter, walwriter, and > checkpointer processes that all take I/O load away from foreground > processes. I don't really believe that this will produce useful > numbers. The bgwriter, walwriter, and checkpointer should only take away *write* IOs. For read IOs the numbers should be very accurate and as explained above read IOs is where I think the primary benefit of this feature is. But even for write IOs I think the numbers would be useful when looking at them with the goal of finding out why a particular query is slow: If the bgwriter or checkpointer do the writes, then the query should be roughly as fast as if no writes to the disk had taken place at all, but if the query process does the writes then those writes are probably blocking further execution of the query and thus slowing it down.