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 1nLnkM-0007Da-ES for pgsql-hackers@arkaria.postgresql.org; Sun, 20 Feb 2022 15:03:34 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nLnkK-0004am-LE for pgsql-hackers@arkaria.postgresql.org; Sun, 20 Feb 2022 15:03:32 +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 1nLnkK-0004YG-9q for pgsql-hackers@lists.postgresql.org; Sun, 20 Feb 2022 15:03:32 +0000 Received: from mail-lf1-x133.google.com ([2a00:1450:4864:20::133]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1nLnkI-0004lE-DU for pgsql-hackers@lists.postgresql.org; Sun, 20 Feb 2022 15:03:31 +0000 Received: by mail-lf1-x133.google.com with SMTP id d23so14047321lfv.13 for ; Sun, 20 Feb 2022 07:03:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=vK6NkDBvMIboFc9ZzagiDjnaLiY2N/kISubtKV2Kr+s=; b=UYbwBhr1biN/ZP/DJVmbfIjycEUtIH0JoeS9A8f/9M4jG7VtnrculM+Et/qQ4rtpw8 0B7MF4glh0IGG4dWWs3OVRGe9WF0mG9W1Res3/weFl+kXKd+qokNmlBZ3D+41jvuCbIV 98T/CwRlLMF1sQRdO+E1WShcBRfcQ75RG8xf5Q1W/6+fbgpXsnX6ACDQGp0ocrVjk2dx 5XDov8PIdo52kgsZ/q7Ql4l1zeaI0PdSZdR00Z33fQwVlZEXl9v54TUCId8vgta/H+uc wFc4enXb8tGt45hUUIvBI+doP8uTJcFKaMJ8+cXBTApGX+fdLMirRPhiLnRkoIE+XpgG crRw== 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=vK6NkDBvMIboFc9ZzagiDjnaLiY2N/kISubtKV2Kr+s=; b=rYJDlnuSsnp4HEU6Gi+bVrEkQGNMSj6sjAZzmP2xavHw31GJ60SH0wDQ21WSR1VRyA vVePB7w12QzcuCTdi1fiHrNoPJXwkCb5z0fF1Gcn24KhAXBMR13OojXAO+dMwFWyFzHZ REpiS3r81upvx2we4FtZH9zNXCk0Lckvg2UlvYVev6S8peEQrJAbhOIdeJbxUcIQ7h8/ C27UbMLI0AsET9EH0vNWrbtj9VjCit32tI/vz3Q4k5FJ7YgA4U0L5de26jOSSnPS+9eE 3R19Exae0E4ewuTOK0sRrnfQt4gw6JRLwRvfTOLpLWBuC/LwZWmGTxP1DoNWTbYRmYh8 eeYA== X-Gm-Message-State: AOAM532tJQdygcCvdPsoIhVrwK522Oifr4pipZrANjn1ZZ0SeZ/qhOU5 s9d4ww6d9m5dEBlN2sM3fQqWq+kQUZDESWgzdxfh141G X-Google-Smtp-Source: ABdhPJwu3FRIZLeISAbayI6QKVHVzSZXasrMUX/2R8XsgObOiQD0I8xVMNlcVO0HJkFIllgV/r1WBo6/7uH/irtlDL4= X-Received: by 2002:ac2:4243:0:b0:443:153f:73c7 with SMTP id m3-20020ac24243000000b00443153f73c7mr11238359lfl.624.1645369409074; Sun, 20 Feb 2022 07:03:29 -0800 (PST) MIME-Version: 1.0 References: <20220218221117.ijozsjwaxa6fy5u6@alap3.anarazel.de> <20220220015416.gxnocs4we56ghmj3@alap3.anarazel.de> In-Reply-To: <20220220015416.gxnocs4we56ghmj3@alap3.anarazel.de> From: Robert Haas Date: Sun, 20 Feb 2022 10:03:17 -0500 Message-ID: Subject: Re: Removing more vacuumlazy.c special cases, relfrozenxid optimizations To: Andres Freund Cc: Peter Geoghegan , 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 8:54 PM Andres Freund wrote: > > Leaving behind disconnected/orphaned heap-only tuples is pretty much > > pointless anyway, since they'll never be accessible by index scans. > > Even after a REINDEX, since there is no root item from the heap page > > to go in the index. (A dump and restore might work better, though.) > > 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. Yeah, I agree. I don't have time to respond to all of these emails thoroughly right now, but I think it's really important that pg_surgery do the exact surgery the user requested, and not any other work. I don't think that page defragmentation should EVER be REQUIRED as a condition of other work. If other code is relying on that, I'd say it's busted. I'm a little more uncertain about the case where we kill the root tuple of a HOT chain, because I can see that this might leave the page a state where sequential scans see the tuple at the end of the chain and index scans don't. I'm not sure whether that should be the responsibility of pg_surgery itself to avoid, or whether that's your problem as a user of it -- although I lean mildly toward the latter view, at the moment. But in any case surely the pruning code can't just decide to go into an infinite loop if that happens. Code that manipulates the states of data pages needs to be as robust against arbitrary on-disk states as we can reasonably make it, because pages get garbled on disk all the time. -- Robert Haas EDB: http://www.enterprisedb.com