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 1vxS3I-00ElMY-1s for pgsql-hackers@arkaria.postgresql.org; Tue, 03 Mar 2026 15:52:52 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vxS3F-007fpM-37 for pgsql-hackers@arkaria.postgresql.org; Tue, 03 Mar 2026 15:52:50 +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 1vxS3F-007fpD-20 for pgsql-hackers@lists.postgresql.org; Tue, 03 Mar 2026 15:52:50 +0000 Received: from mail-ed1-x529.google.com ([2a00:1450:4864:20::529]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1vxS3D-00000000HFP-3i3C for pgsql-hackers@lists.postgresql.org; Tue, 03 Mar 2026 15:52:49 +0000 Received: by mail-ed1-x529.google.com with SMTP id 4fb4d7f45d1cf-65f812e0d93so9096157a12.2 for ; Tue, 03 Mar 2026 07:52:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1772553165; cv=none; d=google.com; s=arc-20240605; b=KGCdernTgqWBGnrlajAPY03kI6H413BwU/RtBUBCVLQzIeIwjOotdZQJYzJOEUDSax 5lqn5o87wlYfo9dAaYxNVokH+wwIMrM4MjJcwDeaeJM6yFAj/iMvg7oFOkV0PNyALm5e L/86dmqG7qdeBam1lOT/HNGmKj+A7GVUJa70cqVdpe5puikyxCyb5VmPLw9pmvgh+gQI ohySyfUgHwnHwd3pWcqO/JejhVtqZ6OLffnqLKjinJTsxZqPe9G0ZxxASUZWrg0RYTz2 DE705jP+nP7IK86IQo+/f4kb+rd0S9h0j5aO9bZTcJI324+u3mWKN0FwDkt+tp+MI3eQ wvVQ== 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=p2I4eeSLhoHbrmWF18GHw4pV/UJcEc4eaM42zuwrRUQ=; fh=kXAxK9hEDEk/OTvSfWVjsaXhwo/u59B/1GM1B4HsolY=; b=XN8a3jUYuXaY4vqZTNuMiDxkyTK1OHiLB0RQcqbihVUawEHuI8x2hc+RWAT0lZRSJ2 IuSQHu5yZ//cKNycwQvZclXAkHkKu3zh/JB4HpHWwMtjJIfrz0ezmRVmVaxtsgCMvigp Vm68yNIve+IhDO9S3rxscNNd69RHeEnXSFBPlYvaVJbBerabf/w7QIBJIhn1wyFTGiaP Jn71cnYyUkNIuDxMU0VtpkC8s942CI0phqeSTFm1c2YT26vOGxRoJOppZQMGqlP6+Qwd bf5BWfs9Hf4bPtMFp3uzAPlJYetasKbW7R1wBVf0GvtZD/MpH912Mh77jFUMGSBvC9rG NXFQ==; 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=20230601; t=1772553165; x=1773157965; 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=p2I4eeSLhoHbrmWF18GHw4pV/UJcEc4eaM42zuwrRUQ=; b=Dqc1oH0AUvNnYXm65ujnf1FXqcvSb7mlMi6WhRB/gNU79YWobuUMD+MeZX8Wjh8IuE aIPsULfxm2+UwOVYal8Dbp7hUpMethZJKhVOPDAupdvApF8DOzxur+/93KwZRVZEMTOf I+mLLUD62cb2cDt2hy0LHS0s9FZiMvNab2r04ASbpAtwsxiTGMSIhoqgxSyI5QqIe1OT QS0hRwZE5lws6Jk5mwFgaDz+ilVkAUWD3uRoY/B16Q62ULRc8g+G5Pb7R4JxpusxY4g+ aRuPdzQWEv5GAVgoHQ7jvWvmtfYpEWSKcrj22VuY7dpXE/hqAaBusPAFGRxOA6najeWc e2mA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1772553165; x=1773157965; 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=p2I4eeSLhoHbrmWF18GHw4pV/UJcEc4eaM42zuwrRUQ=; b=UvVWb/yOM1Siofl5azxNI0XrG40P9hrw0JpreUYu2H2O4ZFX408AD4LKz759iqXpbn zKTfyu/8T0EIGPa9CvwqDK4lD9llvstyaXrzN6hgvIe6PXMsiUF2HPeI9jWRHq5ggVlO FaiFBUgr+jzPJdLbACL7Mu3wpXDj59Qsm++Yij9IxVSmdtVEKcz9zg93r80o76ykKYvB i3o5GzGYzuquQJV0i5uFFGPpo6lFOH3qHtXUxo8+Q93TaVnzvFjp8Wo2QdK4wruRtsDU /82Q+T/JCaVeENt+ZAxWI+663AvAoY9fBuZa0EOxYfEW5DjafDQzWQEwBtMSBGX7UE9Q vgYA== X-Forwarded-Encrypted: i=1; AJvYcCVkfB6KfgEwWfHqA+4pqiDUPnJkHG/9ySaydOKnWZUXKS96N6AJs+O+CaMD43CGZ/keuJqU8H0ilSCIL+gD@lists.postgresql.org X-Gm-Message-State: AOJu0YxhpG8aOL+3MMtjtduxLnJWbh5r/gSSNNzrOCsegZrDmp77jRWm Gq2on4ueNU8EF+VZ9w+BXJ/BTNYjob9WSWIN+04ahO666/s7F1a0NL2yI3fTQk+9M9kSj9n7d1B 8lLBlcPO8vtb6/gf4YqQtdL692Bfd3ZU= X-Gm-Gg: ATEYQzyTiGhe3lstuJUsrdg2qtD/vhCX3WtD7fKeTqxav4HYdPBlhxkCLzBpeLqE58F HgpiX6rV4BUTbW/uU6lPIMNyTTBn7f0BZZoi7dloVtmjXFkjYhKqPjTUNvQ9rOg79KOcDiS+wsf 6YwhGBSN8F7FUk7JauDrcZGNJnrwssT7esP3bo0ELfGSqYjpUAUeNprc0exsaL4rBJQ3jiz3mGT 9GeTMjNr0ecgoXSHID6xz3la3n9QcscOdl5d4bUtfIjMmpQ1wsFnORigjxaZDVljdOmGrrPuNkD iXJPHRFscadQebvyVBqJwka2mEihrrQSwBzHTx5ih9mBembrHgtxs/2nuFE//Dr2U47dxPbqUO0 yF1S/2m4R X-Received: by 2002:a05:6402:40c2:b0:660:a4fc:49fc with SMTP id 4fb4d7f45d1cf-660a4fc4b80mr1318977a12.23.1772553165229; Tue, 03 Mar 2026 07:52:45 -0800 (PST) MIME-Version: 1.0 References: <6BC5DBAB-6084-4BB8-8450-52E9648AB021@gmail.com> <7F5BCD7A-764D-4D8D-8E27-6F2CAAEA1CEE@gmail.com> <4379FDA3-9446-4E2C-9C15-32EFE8D4F31B@yandex-team.ru> <7ib3sa55sapwjlaz4sijbiq7iezna27kjvvvar4dpgkmadml6t@gfpkkwmdnepx> In-Reply-To: From: Melanie Plageman Date: Tue, 3 Mar 2026 10:52:34 -0500 X-Gm-Features: AaiRm53P-eE3sTaZ8N58B974iYPZpGCzZZDHGGyjVOvYF94AkpEcQPYbHVSe058 Message-ID: Subject: Re: eliminate xl_heap_visible to reduce WAL (and eventually set VM on-access) To: Chao Li Cc: Andres Freund , Andrey Borodin , Kirill Reshke , 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 Tue, Mar 3, 2026 at 2:33=E2=80=AFAM Chao Li wro= te: > > 2 - 0003 - Does it make sense to also do the same renaming in PruneFreeze= Result? I could do that. Later commits remove them, so I thought it didn't make sense. If only this commit goes in though, it would make sense. > - * Calculate what the snapshot conflict horizon should be= for a record > - * freezing tuples. We can use the visibility_cutoff_xid = as our cutoff > - * for conflicts when the whole page is eligible to becom= e all-frozen > - * in the VM once we're done with it. Otherwise, we gener= ate a > - * conservative cutoff by stepping back from OldestXmin. > - */ > - if (prstate->set_all_frozen) > - prstate->frz_conflict_horizon =3D prstate->visibi= lity_cutoff_xid; > - else > - { > - /* Avoids false conflicts when hot_standby_feedba= ck in use */ > - prstate->frz_conflict_horizon =3D prstate->cutoff= s->OldestXmin; > - TransactionIdRetreat(prstate->frz_conflict_horizo= n); > - } > + Assert(TransactionIdPrecedesOrEquals(prstate->pagefrz.Fre= ezePageConflictXid, > + = prstate->cutoffs->OldestXmin)); > ``` > > At this point of Assert, can prstate->pagefrz.FreezePageConflictXid be In= validTransactionId? My understanding is no, in that case, would it make sen= se to also Assert(prstate->pagefrz.FreezePageConflictXid !=3D InvalidTransa= ctionId)? I think it is possible if we are doing some kind of freezing to a multixact that we reach here and FreezePageConflictXid is InvalidTransactionId. > Otherwise, if prstate->pagefrz.FreezePageConflictXid is still possibly be= InvalidTransactionId, then the Assert should be changed to something like: > > Assert(prstate->pagefrz.FreezePageConflictXid =3D=3D InvalidTransactionId= || > TransactionIdPrecedesOrEquals(prstate->pagefrz.FreezePageConflictXid, p= rstate->cutoffs->OldestXmin) This is covered by TransactionIdPrecedesOrEquals because InvalidTransactionId is 0. We assume that in many places throughout the code. > I will continue with 0005 tomorrow. Thanks for the review! I noticed a serious bug in v35-0017: I pass hscan->modifies_base_rel to heap_page_prune_opt() as rel_read_only, which is the opposite of what I want to do -- it should be !hscan->modifies_base_rel. I'm going to wait to fix it though and post a new v36 once I've batched up more fixups. - Melanie