Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nLcx0-0004fP-44 for pgsql-hackers@arkaria.postgresql.org; Sun, 20 Feb 2022 03:31:54 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nLcwy-0000Xa-7a for pgsql-hackers@arkaria.postgresql.org; Sun, 20 Feb 2022 03:31:52 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nLcwx-0000XR-UX for pgsql-hackers@lists.postgresql.org; Sun, 20 Feb 2022 03:31:51 +0000 Received: from mail-ed1-x534.google.com ([2a00:1450:4864:20::534]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1nLcwv-0007xt-Ch for pgsql-hackers@lists.postgresql.org; Sun, 20 Feb 2022 03:31:51 +0000 Received: by mail-ed1-x534.google.com with SMTP id m3so16511418eda.10 for ; Sat, 19 Feb 2022 19:31:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bowt-ie.20210112.gappssmtp.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=/TLvWxx5eLsgtsYMvme41Re8BMVW/8nthxeOfbarxcA=; b=KIvpnMyK0H4dGXfnBm5B6mb3LQtVLFRCQbH4GhJKZb0bJZXhu3S3f4wlowmllkwGqz ScQ6blX4h325dp/n/IIJis5M3wI2ScffLcGbi6QotXVkzSujQDUIIDRG5oR7b9NIv++i WDE03f+gCKHc6Vz9gCvWZthPRTz14tD1k62aofq0hZyaT8uciW8H/HtLnaHTIjkMX9BT kGjExUcXaehTOav/kF6aXe28IrJ/JG0MLx+38eCjbC+hj1yE+0ru7xcXfKiMATezRG4f 5+9zE8dd0FIcQdrVS8IVOnFgHErdCLASAMh6NWL0K+QU6d3zIKeUsk2ImGmH4bWA5W76 z3VQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=/TLvWxx5eLsgtsYMvme41Re8BMVW/8nthxeOfbarxcA=; b=7ueXYZlE7tXHf83tIQzu+itRSO2btpMdx1igD+hzg/1ZDtCVFAy49RBaNUVJOI4yQ9 k+vM1AEpZjkBS22Vi3KnyhoxJCDMUj9JbxFA2Oh/xSoJ9wzrwtSKLFK/Cu5rYy2OJ2FC 9NuMaugxZuFqctCyAPqX5tla9zE5fML7q4kRHMYnEhLGKXfhLqDmOtMKZsNWvg+ycoDU v6Ch2x8mNkKEnqYalFoKthB5zJFEoIMquD/P/zg1Q4fGqkOjV3VnbletrwJxSbB4wqYD ekXEMhKfUaaicunTXtyzmhLyB1QGbTX8/m4y79BRun1YIvLk1ujDZlsvhypHBqf+d9Za qXRw== X-Gm-Message-State: AOAM530PU3ZdrC3qzRWefrZ4S3DGcvICYRqAb/dRJbi3psjTLOWEXQMx 37p1X1rDNSEHzJ1X5EK4ewRIFuvs9gS3p+xwZ8e2oA== X-Google-Smtp-Source: ABdhPJy10x5eRICZ20Zyi08hJywd+kU1zgR3Wjt2i/XH4eRtdmczkWRl03C9uOmturKQIV+tnwNcpTqkrabBFLsAoTo= X-Received: by 2002:a50:9d06:0:b0:410:befc:dda7 with SMTP id v6-20020a509d06000000b00410befcdda7mr15212603ede.443.1645327907451; Sat, 19 Feb 2022 19:31:47 -0800 (PST) MIME-Version: 1.0 References: <20220218221117.ijozsjwaxa6fy5u6@alap3.anarazel.de> <20220220015416.gxnocs4we56ghmj3@alap3.anarazel.de> In-Reply-To: From: Peter Geoghegan Date: Sat, 19 Feb 2022 19:31:21 -0800 Message-ID: Subject: Re: Removing more vacuumlazy.c special cases, relfrozenxid optimizations To: Andres Freund Cc: Robert Haas , Masahiko Sawada , PostgreSQL Hackers Content-Type: text/plain; charset="UTF-8" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Sat, Feb 19, 2022 at 6:16 PM Peter Geoghegan wrote: > > Given that heap_surgery's raison d'etre is correcting corruption etc, I think > > it makes sense for it to do as minimal work as possible. Iterating through a > > HOT chain would be a problem if you e.g. tried to repair a page with HOT > > corruption. > > I guess that's also true. There is at least a legitimate argument to > be made for not leaving behind any orphaned heap-only tuples. The > interface is a TID, and so the user may already believe that they're > killing the heap-only, not just the root item (since ctid suggests > that the TID of a heap-only tuple is the TID of the root item, which > is kind of misleading). Actually, I would say that heap_surgery's raison d'etre is making weird errors related to corruption of this or that TID go away, so that the user can cut their losses. That's how it's advertised. Let's assume that we don't want to make VACUUM/pruning just treat orphaned heap-only tuples as DEAD, regardless of their true HTSV-wise status -- let's say that we want to err in the direction of doing nothing at all with the page. Now we have to have a weird error in VACUUM instead (not great, but better than just spinning between lazy_scan_prune and heap_prune_page). And we've just created natural demand for heap_surgery to deal with the problem by deleting whole HOT chains (not just root items). If we allow VACUUM to treat orphaned heap-only tuples as DEAD right away, then we might as well do the same thing in heap_surgery, since there is little chance that the user will get to the heap-only tuples before VACUUM does (not something to rely on, at any rate). Either way, I think we probably end up needing to teach heap_surgery to kill entire HOT chains as a group, given a TID. -- Peter Geoghegan