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 1mph9H-00086p-Fz for pgsql-hackers@arkaria.postgresql.org; Wed, 24 Nov 2021 01:32:36 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mph9F-0000n5-V3 for pgsql-hackers@arkaria.postgresql.org; Wed, 24 Nov 2021 01:32:33 +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 1mph9F-0000mv-0B for pgsql-hackers@lists.postgresql.org; Wed, 24 Nov 2021 01:32:33 +0000 Received: from out5-smtp.messagingengine.com ([66.111.4.29]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mph9B-0000LN-Hd for pgsql-hackers@lists.postgresql.org; Wed, 24 Nov 2021 01:32:32 +0000 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id AD5805C0106; Tue, 23 Nov 2021 20:32:27 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute3.internal (MEProxy); Tue, 23 Nov 2021 20:32:27 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=anarazel.de; h= date:from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; s=fm3; bh=KJ8Srch9imCH/5trUUQ9miiNa46 XgjjZ/CiZYCUYHdI=; b=wexdNmPl5vZeyvHfZOlf/heY2JU/9fuWaSJA0YiOZpj nQMmYUCd69eMwr+lGQYjCs5LaIhpJW+0fi1z1LPruIb+eR1sDefhUaXGvuTGBVc5 OUhnR0MKC36GUrK3tWhaPGXUFeuv6H9cDI+IErbNBtwGLGk3gdvYp7Nq4KxJaSQf 1Fm++M8ZGL1A/Ko28TMJrsYzT/+4Gbgkx2FOgvlFCK0qHmpeT09t+LxGKKbo4PH1 ZNFeYl6Ruuh8++9z9CYFYpdh3vfuuz4V7OObRFmDzT9yTu2PWNQjdzkikse8RoeF Gg8mxlvCGsxVUeVMEjsWe/LjzMDzxHGANpvq8gu9IoQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=KJ8Src h9imCH/5trUUQ9miiNa46XgjjZ/CiZYCUYHdI=; b=KH5iT5IS/b7HfCNGRSMt0s a8yONELrD7khrXuLPcLpc58icFsFmwXrnrYuu/ctiH/pOsQ/UjJW/do/Muw19s/R OcENoZxCnhNsvLMiAh5CB9Bc885jx79JufbEdZIHicLlUdcx/9NP/iXNni0JEidT k9e/r7dhYozes5Sg19No5mNx4QWuqXwbGFDCpToGs7d35YjGQGAU6AKsRzRD8W7Y RBGnI+/Kl/4sgZ4s00VM0Yexeu3oZFqWb0iP+LPmgevckjfkiDPnN1hVZJeQmJYt uLb9R/YOD4WhSLm3HDVgB6P/hx/YDtkUMOZ/Eq8j4g3InehVl1vTuXra9n53YHyg == X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvuddrgeejgdefiecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpeffhffvuffkfhggtggujgesthdtredttddtvdenucfhrhhomheptehnughrvghs ucfhrhgvuhhnugcuoegrnhgurhgvshesrghnrghrrgiivghlrdguvgeqnecuggftrfgrth htvghrnhepudekhfekleeugeevteehleffffejgeelueduleeffeeutdelffeujeffhfeu ffdunecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheprg hnughrvghssegrnhgrrhgriigvlhdruggv X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 23 Nov 2021 20:32:27 -0500 (EST) Date: Tue, 23 Nov 2021 17:32:25 -0800 From: Andres Freund To: Peter Geoghegan Cc: PostgreSQL Hackers , Masahiko Sawada Subject: Re: Removing more vacuumlazy.c special cases, relfrozenxid optimizations Message-ID: <20211124013225.d67t32hkcbbbsjjc@alap3.anarazel.de> References: <20211122192956.jji6kvzbh5rippla@alap3.anarazel.de> <20211123054902.b5motbm32ftn6xgu@alap3.anarazel.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi, On 2021-11-23 17:01:20 -0800, Peter Geoghegan wrote: > > On reason for my doubt is the following: > > > > We can set all-visible on a page without a FPW image (well, as long as hint > > bits aren't logged). There's a significant difference between needing to WAL > > log FPIs for every heap page or not, and it's not that rare for data to live > > shorter than autovacuum_freeze_max_age or that limit never being reached. > > This sounds like an objection to one specific heuristic, and not an > objection to the general idea. I understood you to propose that we do not have separate frozen and all-visible states. Which I think will be problematic, because of scenarios like the above. > The only essential part is "opportunistic freezing during vacuum, when the > cost is clearly very low, and the benefit is probably high". And so it now > seems you were making a far more limited statement than I first believed. I'm on board with freezing when we already dirty out the page, and when doing so doesn't cause an additional FPI. And I don't think I've argued against that in the past. > These all-visible (but not all-frozen) heap pages could be considered > "tenured", since they have survived at least one full VACUUM cycle > without being unset. So why not also freeze them based on the > assumption that they'll probably stay that way forever? Because it's a potentially massive increase in write volume? E.g. if you have a insert-only workload, and you discard old data by dropping old partitions, this will often add yet another rewrite, despite your data likely never getting old enough to need to be frozen. Given that we often immediately need to start another vacuum just when one finished, because the vacuum took long enough to reach thresholds of vacuuming again, I don't think the (auto-)vacuum count is a good proxy. Maybe you meant this as a more limited concept, i.e. only doing so when the percentage of all-visible but not all-frozen pages is small? We could perhaps do better with if we had information about the system-wide rate of xid throughput and how often / how long past vacuums of a table took. Greetings, Andres Freund