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 1mvQbO-0006lZ-4r for pgsql-hackers@arkaria.postgresql.org; Thu, 09 Dec 2021 21:05:18 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mvQbL-0003vw-UL for pgsql-hackers@arkaria.postgresql.org; Thu, 09 Dec 2021 21:05:15 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mvQbL-0003vl-G7 for pgsql-hackers@lists.postgresql.org; Thu, 09 Dec 2021 21:05:15 +0000 Received: from mail-ed1-x52e.google.com ([2a00:1450:4864:20::52e]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1mvQbI-000561-9P for pgsql-hackers@lists.postgresql.org; Thu, 09 Dec 2021 21:05:14 +0000 Received: by mail-ed1-x52e.google.com with SMTP id w1so23516371edc.6 for ; Thu, 09 Dec 2021 13:05:11 -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=emQh6SJENTWNN/yzp7uGY2oJeG/qzGhJR1dQsJ/6Tac=; b=DszI5KRCWSSZ4rCWXe3uWK1FgeYxrY8d+F2Af6+fcgnr7k2t8HyZ9ep4LN76cuK9QL aY4/4ZxFce9+t1567bVWy7P4oOtJQ1CtUMlBeOpPg3MiHYn6qzt/1+Ib7BL8IvCwYqiJ JqIQA2eWNyXUf7bwgRhvwatpXBHwVZwkpPt93X2bzz4P+TAUjEachAyIrMNurabXbazt Xo+/HulGYFSukor25o6A4bFdEIl8pR9IXaVtm9lYGUnp2vSOK458wsZvV4BedsFICNOh naEhaoT7N+jgp8XZtP37IdhxDoMWP2MXfoYBX1yEOIvsySJwlnOiUL8kq/G+VHBF2EjF JUpA== 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=emQh6SJENTWNN/yzp7uGY2oJeG/qzGhJR1dQsJ/6Tac=; b=lHBFfWdLPv5ijumGDERGDDESmFKz7Pd0NpxwRA62cP+cJ9NnIdOT4MUvWwlAO2ESkh lJsJXCSFNSIz2596NeCtJ9SNnwMX52KcT0Lmnhh6U15U98n2SePp6cGDdACTJkYkEnhE mj33sEKBNrJbjm0YypNGijyaVmHb0rblfOJHlKJu6JPo1FLqt79Xu8pEdNKq7vyutmSg FxNLnF843Rlc2USSuuYdJeYTWClZgf6FYYMzLtYNHybNq/7353ELt4noPdS6avshaQCN HpqQjbLCKbbZFaeHL42703PWXGV0EGqEYyU5boAH0n/eTdqUx72hBRQkvArZs1tD1EBD ChTw== X-Gm-Message-State: AOAM5333DnqRw+/UrKXEqzQH3CCYNnuBHpUe/efne5gb7bi0YlbYmbwo +0WtvuoDF/tAMmYruyt2edemgyY8VgLSJ9j37w9Irde5YJU= X-Google-Smtp-Source: ABdhPJw0rixDZ5JfSCW5Lnw60BLrVUvfCaBlclPKi3162sCr9Ycj+H74jn6R0ShGQ0Plroe+qtHZ13qrThAEitaQBNM= X-Received: by 2002:a17:907:6ea8:: with SMTP id sh40mr18533068ejc.53.1639083909586; Thu, 09 Dec 2021 13:05:09 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Peter Geoghegan Date: Thu, 9 Dec 2021 13:04:43 -0800 Message-ID: Subject: Re: do only critical work during single-user vacuum? To: John Naylor Cc: 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 Thu, Dec 9, 2021 at 11:28 AM John Naylor wrote: > Now that we have a concept of a fail-safe vacuum, maybe it would be > beneficial to skip a vacuum in single-user mode if the fail-safe > criteria were not met at the beginning of vacuuming a relation. Obviously the main goal of the failsafe is to not get into this situation in the first place. But it's still very reasonable to ask "what happens when the failsafe even fails at that?". This was something that we considered directly when working on the feature. There is a precheck that takes place before any other work, which ensures that we won't even start off any of the nonessential tasks the failsafe skips (e.g., index vacuuming). The precheck works like any other check -- it checks if relfrozenxid is dangerously old. (We won't even bother trying to launch parallel workers when this precheck triggers, which is another reason to have it that Mashahiko pointed out during development.) Presumably there is no need to specifically check if we're running in single user mode when considering if we need to trigger the failsafe -- which, as you say, we won't do. It shouldn't matter, because anybody running single-user mode just to VACUUM must already be unable to allocate new XIDs outside of single user mode. That condition alone will trigger the failsafe. That said, it would be very easy to add a check for single user mode. It didn't happen because we weren't aware of any specific need for it. Perhaps there is an argument for it. -- Peter Geoghegan