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 1w5TNC-003HiX-1P for pgsql-hackers@arkaria.postgresql.org; Wed, 25 Mar 2026 18:54:34 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1w5TNA-00G31X-2y for pgsql-hackers@arkaria.postgresql.org; Wed, 25 Mar 2026 18:54:33 +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.96) (envelope-from ) id 1w5TNA-00G31O-1S for pgsql-hackers@lists.postgresql.org; Wed, 25 Mar 2026 18:54:33 +0000 Received: from mail-ej1-x62d.google.com ([2a00:1450:4864:20::62d]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1w5TN8-00000001125-46b9 for pgsql-hackers@lists.postgresql.org; Wed, 25 Mar 2026 18:54:32 +0000 Received: by mail-ej1-x62d.google.com with SMTP id a640c23a62f3a-b979d16dd0cso27361566b.1 for ; Wed, 25 Mar 2026 11:54:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1774464869; cv=none; d=google.com; s=arc-20240605; b=YM/xP+AL9sPeDSq/DrHmSEVGXTosP+xm+qjnvDqBWOI4B4+ScQ4lwmZxv/tOPMKQRz WoU/Y7cgav3mXVMzqHmFHcz/6Uk0qb53Pfn4surWc0tByBB+eZVOtjCB7F3rYgPrH9wK FekH3yA7ehQnP2Y7MMFnw3dwbHP++vbHbqETfQ+yCQMh1p2+PZKMEbsCQbIGuBhC7vkK LQGba6dOvIeJBwF8FwmVY4fs3kYYS1J0th82dfN3haZESt0vOphu8tJCOXmV7g17+rJY gWjq0wUjVxBxSaymgUeT1+BLJydiDSOww0GqvFnrf8usujVH/JpJyMgY11JiFcyynbs5 f1nw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=krm3+lZOLPH8Lk+jlILh+7tIIlobX0yZgOgEyHiqPQQ=; fh=GL5zn8HDY0RXc5vZDHnGTUtoQQti5ie2qpMCTFFsWZs=; b=k0qR3moHjOi63/YRpv3rbhahIIiradrFyMZAecoiNm9aojNK+HJCdguiC2Z4HtxPZ4 t2q3sIwK4S+xIX1N+qwFWfYhCFYDl+sR+9UFa6HdhlfTkZ3CYGh/rDKl6AL3voeVIfoz 5rEk/664ZFT5rqtvPI8IUT54Z7ldous/KVClCVLhcUHReki8i4Qc76xg4hL2X5eHabeP nJ+qSgUJHGMKJX9UxTIQhD6m4HnCbuxoysDsKAnXKhNARSEho28rs6zPdIPPK1TtFiII zTPAs3aeDO7ymRnaHnm25srt18bbXHD8tyJtUz+ZCAUbmux1rtDeFEit55rfOHQ7cVrA 1Qrg==; 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=1774464869; x=1775069669; 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=krm3+lZOLPH8Lk+jlILh+7tIIlobX0yZgOgEyHiqPQQ=; b=DJUP1iByoB3dhoQIWJ1u51YPJYtITqXndGFp9BSFL36CinR5fBnbm5Ptc/0uw3wqVk CpSYswK11OUj8DyK7+wS0qY7Fc8UcDnX3Xpdp1/4z7P1ErTR3WJHBErQyNEuG+7s236k Bi2lGKCzcfM81XXtcmOcCMsF6BE5d9qApSE+gsv1xbYOWh4XMkZW7vXpnzrw9VbkFQxg I7KMjwpM6CD9ebrwVjfi3qvsAj58vsejBUaHAXPlIn2j80iyLnauKeRF0h24YDJI7L92 za/3wrstj0JjyxECmyUyUd1S/zF/EgqqT8ff7a2S/fI5V8vckNOVPfGDIZjMaCt4it/N RCqw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774464869; x=1775069669; h=content-transfer-encoding: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=krm3+lZOLPH8Lk+jlILh+7tIIlobX0yZgOgEyHiqPQQ=; b=kNkVYrCLogccTKkWz1/vMNhhZWVHjzl3oLGRsAt3+l098bTR2+CXK/UVxRbEcgVe4R UkuFySBktlKLp4U3B+XxaJG6mX+kdJZkB5qad0hU35mAxYk0Qc5iVAEmMggetWmBZ6K8 xh1zAxD4zKpeBxl9pU3hayKgS2xT5isNuLkhpjHPNqFlK5/9ku5omxllJuT0llQD5f4L 6hHybB7x9B1Z/iVCDOxPXIS5bRZWADPf68dly5K1Lw49HZ05EzQiZSihEYbc8cBUpkJa qxFpW0q4SNCWFRupCy4PFc/pShhU9IWGKDZOrG+jsNrkX/Zch1CuAVTCQiAuZI1ypoZu xXIA== X-Forwarded-Encrypted: i=1; AJvYcCVSamYb6k0fc1FNXcr+KicSAxnNOL2iU8sPEliPeU/cAj2PAO9jbKdc2sjPnM0povX4WaUGTtXwLIBiuL4c@lists.postgresql.org X-Gm-Message-State: AOJu0YyUYUnbptWL/YMLPd7JDpL2qE1ctVT1PUFXKgBEUqamU0uhW6d4 KA6fhweE3wr/rQy0+PxLkTr45sIgAx7mLVxvNu2NJbGghdUwJ9xMe8glUlJpBwrkDFdCbgZ0uEs iZvPoWmN3e3F40MnJE28MoKkcgvtpstU= X-Gm-Gg: ATEYQzzTDenWq6j3MuoH4aGMDorkadxfM60yC40ViycWOmbgyp1UmCbp7ekEE1mP7Eo r/5dgloYIJKgHoYRpZR8AqumARq3r5ll+WjBjl5Hg6slchAshk5/ks9+wpEySrq8JT6tHoWlbhS 2L9SxVWpjjzJv0PdZs4xvj3O8HDfbdAEZROSUwWCW4I6mGXbCPj5rrwNrHzAy3wgEW9Bn1to8FI vjhCdBbMgeiIpAZ+QlzaghTdqieYL8L3tfgiAc6l89gvl3ANAM2wdOJe9WrwYLq/o9BqMNpUs2r 15eHW83RFBzNJmenAI+TM4f/gSiCJ00sxuBp7xSixNwy/pAaJK3wdqc21mlahbBjnsTXi1vFYNR zHVt6nSHS X-Received: by 2002:a17:907:6d12:b0:b9b:1251:742f with SMTP id a640c23a62f3a-b9b12519921mr254951266b.29.1774464869024; Wed, 25 Mar 2026 11:54:29 -0700 (PDT) MIME-Version: 1.0 References: <2be31f17-5405-4de9-8d73-90ebc322f7d8@vondra.me> In-Reply-To: <2be31f17-5405-4de9-8d73-90ebc322f7d8@vondra.me> From: Melanie Plageman Date: Wed, 25 Mar 2026 14:54:16 -0400 X-Gm-Features: AQROBzCfF-wPAngM5JcK46IuJrTzdnPI--CkgX9VUK2rSqXJDh7F1PJOvzP60c8 Message-ID: Subject: Re: eliminate xl_heap_visible to reduce WAL (and eventually set VM on-access) To: Tomas Vondra Cc: Andres Freund , Kirill Reshke , Chao Li , Andrey Borodin , Xuneng Zhou , Robert Haas , PostgreSQL Hackers , Heikki Linnakangas 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 Wed, Mar 25, 2026 at 2:02=E2=80=AFPM Tomas Vondra wrot= e: > > 0002 > > - Don't we usually keep "flags" as the last parameter? It seems a bit > weird that it's added in between relation and snapshot. In an earlier review, Andres said he disliked using flags as the last parameter for index_beginscan() because its current last two parameters are integers (nkeys and norderbys), which could be confusing. Personally, I think you have to look at the function signature before just randomly passing stuff, and so it shouldn't matter -- but I didn't care enough to argue. If you agree with me that they should be last, then it's two against one and I'll change it back :) I can keep the callsite comments naming the flags parameter. > - Do we really want to pass two sets of flags to table_beginscan_common? > I realize it's done to ensure "users" don't use internal flags, but > then maybe it'd be better to do that check in the places calling the > _common? Someone adding a new caller can break this in various ways > anyway, e.g. by setting bits in the internal flags, no? Yes, callers of table_beginscan_common() could pass flags they shouldn't in internal_flags. But I was mostly trying to prevent the case where a user picks a flag that overlaps with an internal flag, conditionally passes it as a user flag, and then when they test for it in their AM-specific code, they aren't actually checking if their own flag is set. Anyway, it's not hard to move: Assert((flags & SO_INTERNAL_FLAGS) =3D=3D 0); into the table_beginscan_common() callers and then pass the internal flags the caller wants to pass + the user specified flags to table_beginscan_common(). And I think that fixes what you are talking about? > If we want to have these checks, should we be more thorough? Should we > check the internal flags only set internal flags? That's easy enough too. Assert((internal_flags & ~SO_INTERNAL_FLAGS) =3D=3D 0); I think does the tr= ick. I think this would largely be the same as having table_beginscan_common() callers validate that the user-passed flags are not internal and then OR them together with the internal flags they want to pass to table_beginscan_common(). I'm trying to think of cases where the two approaches would differ so I can decide which to do. > 0003 > > - Half the "beginscan" calls use a ternary operator directly, half sets > a variable first (and then uses that). Often mixed in the same file. > Shouldn't it be a bit consistent? Indeed. - Melanie