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.96) (envelope-from ) id 1w5tqT-003jnK-0g for pgsql-hackers@arkaria.postgresql.org; Thu, 26 Mar 2026 23:10:33 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1w5tqR-006H45-2L for pgsql-hackers@arkaria.postgresql.org; Thu, 26 Mar 2026 23:10:32 +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.96) (envelope-from ) id 1w5tqR-006H3w-1I for pgsql-hackers@lists.postgresql.org; Thu, 26 Mar 2026 23:10:31 +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.98.2) (envelope-from ) id 1w5tqP-00000001NBM-0QQb for pgsql-hackers@lists.postgresql.org; Thu, 26 Mar 2026 23:10:31 +0000 Received: by mail-wr1-x42e.google.com with SMTP id ffacd0b85a97d-439b7c2788dso902794f8f.1 for ; Thu, 26 Mar 2026 16:10:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1774566628; cv=none; d=google.com; s=arc-20240605; b=CmQXJL7+oHmdkPOQRDxP2TDPdJVWuddZvyHvm6+qkla9pIk3ODv3C2Kxl+NYhupjDT G1zEeF3Qs3qHaYBq1Wy2jAYUv+jJOa1iIDAnxANcJ0rQtvCYXCPV1jkyfUTFl8O0pky7 EmqWvdl6gNMJ3gaPSuXsJ5FIyOSznHAsaraqPFqpOociEdE/+EHPXSFknLA6v4nO58Og 9j0X0Bi/KmiY4Mq9bnDE2cziP8C1BJ5ejJB9eW+7vJqI6T4Dm+8sM0fgtZ6hgj8mcOC6 62aCmtQy7x0YL3TIRS72bBqnuvTTHwnH5ldIQI5IPzrVY2iuC5vOHy/cds9ZRc8yqhvD dcHA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:dkim-signature; bh=QT3UttscQGRA4OZiJt6TdgFma6Mn5Z4laqZp06o6RCc=; fh=gyn7XjIizAyshLPN6vYAg0Kr6IMVg8XxEBOj98ZzjSA=; b=EtKpaq7SozHMAO2Xm5aPUxlDTU4EXKSjgGMMf8+GzA3m+YHGf/BR6/U8d8Fepb8bZH GNOlFnYJbxHKzP9T7mBCM+cz1wXEGwQCMkJXX+RdfyL9qIr49KaOT7fzhTnHGdBvjwAS fl5Jze42Kd3WXilhmMYA0kO6Z8avGwYheu4d5E1/97JUivnmmxnuROVfCI1c/oaFHE6u VBQwreGqBIaC4ciLunBbfu8OX3/6X/F62zn9pz+U96GcFwYTbSS7UCb+qmWJBHT2DUFJ XG4ePvw07D5XmKVgmis9IyboVMXHtXHyPnv2Ib1aDuboK3FWUyLOm8icGlcqnjoWCY6R fRtg==; darn=lists.postgresql.org ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1774566628; x=1775171428; darn=lists.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=QT3UttscQGRA4OZiJt6TdgFma6Mn5Z4laqZp06o6RCc=; b=sisKR+wblwZBL7A/M9HWCcs9po8n+zWKkddBbUYLYN0KZUhNn4psqANqJNgqj3Y9/6 9jMmtcXw6CVWyIp2NObX4f0Tdb5BweVwuo2UcLFQFVMb+dS2gFaPO/25iZofqVUy8Y+l SzhlkxyIN4YIwN2ub2T4nZ9TUlaP5qnRv5XUXjT3aEip4i5SBMb+EahlMdZIeiExCkFl OKbtb1GmvTka2E7GOZrC4xxk4S4C4XpquBqpuge8bWPGXG/LMo/GBeP7re0tYsABnbXh St+yp5Xd16YDaLKBMX5+P86yh60iTtN953r7yZ4wLxyylYGpat00nprJL5mT5xf09OxG ZA2A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774566628; x=1775171428; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=QT3UttscQGRA4OZiJt6TdgFma6Mn5Z4laqZp06o6RCc=; b=BoN6IQk28q6dMm6lU/CjvCnsR1rnacHbHaIg9Nb3SHCC+Pun9MFJ5pkJz8ffmZtTMO RYyFF84cR+/HjbI1FGHSw+APYy03R5U1i27PeshBmwRIUerSA2rDMAT6M49ODveoeiXU S/ycbis3NJ7Pwn9imuns73xPsafJ0utb0ftwXs46ARS2j2M2ssBIt0VITJwlChCBEd0u shuNyvNcWecDVOopzBRLF39xMUWWWgBCLJ9Ia67fs0iHy0YMl/NQkMm3vB+3Y3DbcIus EEO5w48cvJXuSkjr9lidwiKvWQmGB0aSdNi6C/mId8VqLsBEEea2eF1qwmtuAOqwvcjD xtEg== X-Forwarded-Encrypted: i=1; AJvYcCV9UuBAJVb138ljnXMyY9S+K3VKQ2nj+yXWeZEqrrgaNk6YU4G6mmUDsLh9/w3WzjFcO1MVVFZfDKf+Q1+r@lists.postgresql.org X-Gm-Message-State: AOJu0YwuQDCp/CjOwvfSqy77ZDvxBhexwPTzXq1gSyih/oT28PRKgtNE F3O5W8+kP9aPkE+xol6Jc/hPWFs7zbApGzjzVBI/FJF2m/f161pzPaBwdIER8tKxW6TsU6ukum1 xZYzdwyaDa5hS3bCu3EKIC+jvaryWRJU= X-Gm-Gg: ATEYQzxJ46a69SpMftR7yeRjt3vd/Vi41p5bqyA3BsKVhbuOQM1CHNVxKfHEUPEG26I b6Xw7pcoWR0smTdQynLWqD9z0VrZ3WpTdWqz/qNBXa1/kCIYavtWonn9Mu6X5Zzc9KBzrsQvKVb IpajVzmXwWIJAmML+j7gxerK5wKNb2DRAQlf2/8rJ4Fcmgn4aITfdoOqAOJAErKrDXkfO8jKltF jSVDvrVfrXFxPtN/HrkpJQ+u+7r44u1ifPQLMUKa8fjy9NNodxJysWrc4rkqQNp9QLev636+PRH mTtLlce7/YSMk82fou8u+MHepxN+o3c0FNqMXZ3RCG1hnjs5Je0vptjGVVbTzDDCtBG+oQHQ8Q= = X-Received: by 2002:a5d:5d85:0:b0:439:c20e:5ec7 with SMTP id ffacd0b85a97d-43b9ea622abmr271838f8f.38.1774566628289; Thu, 26 Mar 2026 16:10:28 -0700 (PDT) MIME-Version: 1.0 References: <2be31f17-5405-4de9-8d73-90ebc322f7d8@vondra.me> In-Reply-To: From: David Rowley Date: Fri, 27 Mar 2026 12:10:15 +1300 X-Gm-Features: AQROBzAfHgeruqR0oyVcuwRm4_eSwZZnSc9gTQ6V-ONcY9f6MI-d9D7bKo0vSEU Message-ID: Subject: Re: eliminate xl_heap_visible to reduce WAL (and eventually set VM on-access) To: Melanie Plageman Cc: Tomas Vondra , Andres Freund , Kirill Reshke , Chao Li , Andrey Borodin , Xuneng Zhou , Robert Haas , PostgreSQL Hackers , Heikki Linnakangas Content-Type: text/plain; charset="UTF-8" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Thu, 26 Mar 2026 at 12:14, Melanie Plageman wrote: > Attached v46 addresses your feedback and has a bit of assorted cleanup in it. (I've not had a chance to process this thread, so apologies if I missed discussion on certain things I'm going to say) I was looking at v46-0001. With: +++ b/src/include/nodes/plannodes.h @@ -112,6 +112,12 @@ typedef struct PlannedStmt */ Bitmapset *unprunableRelids; + /* + * RT indexes of relations modified by the query through + * UPDATE/DELETE/INSERT/MERGE or targeted by SELECT FOR UPDATE/SHARE. + */ + Bitmapset *modifiedRelids; + This doesn't really mention anything about leaf partitions not being mentioned for INSERT queries. You did mention it in standard_planner() here: + * modification. Conversely, leaf partitions whose result relations are + * created at the time of insert are not included here. I think if someone is going to use this field, they're going to look at where the field is defined to find out what it is, not where it gets populated. I'm also wondering about having this combined field. If you were to have a Bitmapset field that mirrors "List *resultRelations;", then have another: /* a list of PlanRowMark's */ List *rowMarks; + /* Relids which have rowMarks */ + Bitmapset *rowMarkRelids; I think they're more likely to be useful for other purposes, and I think the only pain that it causes you is that you have to call bms_is_member() twice in ScanRelIsReadOnly(). Then, as a follow-up, maybe we could consider removing PlannedStmt.resultRelations. (The deprecated) ExecRelationIsTargetRelation() could use the new Bitmapset, which would be more efficient. OverExplain does do: if (es->format != EXPLAIN_FORMAT_TEXT || plannedstmt->resultRelations != NIL) overexplain_intlist("Result RTIs", plannedstmt->resultRelations, es); but maybe Robert is ok with those coming out in ascending numerical order rather than list order. overexplain_bitmapset() would do that. In [1], I didn't see any code actually using the field. Just a couple of projects that have duplicated the copyObject() code. I did quickly look over the remaining patches. I wondered if you might want to add a new ScanOption SO_NONE = 0, or SO_EMPTY_FLAGS. It might make the places where you're passing zero directly easier to read? David [1] https://codesearch.debian.net/search?q=resultRelations&literal=1