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.94.2) (envelope-from ) id 1tnrAP-002qff-5Z for pgsql-hackers@arkaria.postgresql.org; Fri, 28 Feb 2025 03:36:02 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1tnrAO-00Cdi4-JZ for pgsql-hackers@arkaria.postgresql.org; Fri, 28 Feb 2025 03:35:59 +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.94.2) (envelope-from ) id 1tnrAO-00CdgA-7S for pgsql-hackers@lists.postgresql.org; Fri, 28 Feb 2025 03:35:58 +0000 Received: from mail-il1-x136.google.com ([2607:f8b0:4864:20::136]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1tnrAJ-0006EO-0Y for pgsql-hackers@postgresql.org; Fri, 28 Feb 2025 03:35:58 +0000 Received: by mail-il1-x136.google.com with SMTP id e9e14a558f8ab-3cfc79a8a95so5453065ab.2 for ; Thu, 27 Feb 2025 19:35:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1740713754; x=1741318554; darn=postgresql.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=KOajI3MNRz18zyoCRW1y/pphlpqQfVNJ/wr+vvD3jmg=; b=Buaf4yjaN7lQ97gOpvGQzJhz3M3JiojQLGbnA/uzeryM1DbT4BKZUkqPLg53ICh7No KBa6K1x+EPLslav6qAhH9ZpMoOVOztFhCReaqax2WOcaXG6g8jWzriGysBJSeyN28Ob/ r8mbGyi0IUsGPNufa0a4IMgAZJiwlqvYNxyzhiPeaHrk5n+65cFwX1Ishnoo+dMGpAJw vwrD3Jvbez1fTNrmDJ95qMvmCsbBBH5pvjs6qMyzbLhsXeAgKz2EvxFiSC5ElCf13ov3 3tmpu6jm9e/IaJv3Gchi6pUzQo0TjE6NakEdzU3d/7izugAQhvTYpbzT4h/3fFFl+QnP I+2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1740713754; x=1741318554; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=KOajI3MNRz18zyoCRW1y/pphlpqQfVNJ/wr+vvD3jmg=; b=ZD6cYmPvXIxWc79q6PPZNB5rfl9cKW9jFxKNLN0w/gX3+kiCZmpntOr+sg6ti4xdmE EIEo10PNs/XteZ6h7RSwLF7vBjL64/CLhVdE/sScfhMQdhYnairarSMFjlAcYsCPyOYg w/taXNUBgsw2NYWWkWkz3uju1JmZkS9hIZadOduouDP57SAMnGmRJh0iTC4D/7lPcJHk 1xV+esMtwdvoeUsFI9hjqHHBSMaEL6yOEr4IL+53MCbnRljLOQRb40OHzNbmB7ZDy8DN SEr8NqwoEQJF+LR0So4mHeMsjQpq7zHfNs9cE+Imuo94nuYZNXRvhwZt1NVZ74QhMGmK gglg== X-Forwarded-Encrypted: i=1; AJvYcCWbf1BN6jWse1TNkECt1knHeuTv1qtHKN8nssmiWaFNxGRzYoAPVkZdtZDWYyALe8GPZIqdBNxmL2hXUdpC@postgresql.org X-Gm-Message-State: AOJu0YyGziNrNlIlGqXxsuEZIMm8BU783x8oqY3yBEzYSbkrFT3VPPhV /49OPAd6O8N3hyXaCC0tMcZiRHoYAyTaYCZpXXN4aBN2AERZP916tzdN1w== X-Gm-Gg: ASbGnctWfbnCiYFV/BNmrjRAzB6HiVdBckNkENB++V7BAAoGg4y+OQUCU6vJFA8r8ID kaiF0fQHpix/R9+8JrOIuR+B36uZiW6hOKqjsF6VM9WHLLP6UVsHS6b3xne4swSrh4hBB0QPJ+c Nu1OhWfAVGWqcqZXK2623ABzqj44f03RcPJAuh+Yt3SWSw9dudTPETIr+pND8SHvri79qOI8EpC mXAInaXLmzueQHw+t7ZpRZTRP1KHaA5dzjzUOjbF78LltUIg7TR6bL6vLi14BHgGTsnCtHxvOpx OnwivhktDsKiIjNqUh0bMUkzjdMmbgp1BLRmzk0TKOl8k7tdfcHLiEDAFnp8cIWdEyoiqolm1H+ 4sgNtVEFys5zM8utZ X-Google-Smtp-Source: AGHT+IFE4rT5bdjRt6sZybAJWbDSnKGaGTFdEcG1nDbOr2aRYPaLPeumDK69qfAQ2sJZnaHtycM29A== X-Received: by 2002:a05:6e02:1848:b0:3a7:87f2:b010 with SMTP id e9e14a558f8ab-3d3e6e2108fmr17011125ab.5.1740713754305; Thu, 27 Feb 2025 19:35:54 -0800 (PST) Received: from nathan (162-195-168-172.lightspeed.stlsmo.sbcglobal.net. [162.195.168.172]) by smtp.gmail.com with ESMTPSA id 8926c6da1cb9f-4f061f797b0sm678282173.122.2025.02.27.19.35.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Feb 2025 19:35:53 -0800 (PST) Date: Thu, 27 Feb 2025 21:35:51 -0600 From: Nathan Bossart To: Robert Haas Cc: Laurenz Albe , Gurjeet Singh , Postgres Hackers , Will Storey Subject: Re: Disabling vacuum truncate for autovacuum Message-ID: References: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="WPB+5+kPQlKEwC0K" Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --WPB+5+kPQlKEwC0K Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Tue, Feb 18, 2025 at 01:56:09PM -0600, Nathan Bossart wrote: > On Mon, Jan 27, 2025 at 03:38:39PM -0500, Robert Haas wrote: >> Also, how sure are we that turning this off globally is a solid idea? >> Off-hand, it doesn't sound that bad: there are probably situations in >> which autovacuum never truncates anything anyway just because the tail >> blocks of the relations always contain at least 1 tuple. But we should >> be careful not to add a setting that is far more likely to get people >> into trouble than to get them out of it. It would be good to hear what >> other people think about the risk vs. reward tradeoff in this case. > > My first reaction is that a global setting is probably fine most of the > time. I'm sure it's possible to get into bad situations if you try hard > enough, but that's not a unique characteristic. There are probably many > situations where the truncation is wasted effort because we'll just end up > extending the relation shortly afterwards, anyway. In any case, it's > already possible to achieve $SUBJECT with a trivial script that sets > storage parameters on all tables, so IMHO it would be silly to withhold a > global setting that does the same thing just on principle. I spent some time on this one today. A couple of notes: * Since the reloption is a Boolean, there isn't a good way to tell whether it is actually set for the table or if it just inherited the default value. This is important to know because we want the reloption to override the GUC. I considered a bunch of different ways to handle this, but everything felt like a cowboy hack. The cleanest cowboy hack I could come up with is an optional offset field in relopt_parse_elt that points to a variable that stores whether the option was explicitly set. * I didn't see a good GUC category for vacuum_truncate. I suppose we could create a new one, but for now I've just stashed it into the autovacuum one. Bikeshedding welcome. Thoughts? -- nathan --WPB+5+kPQlKEwC0K Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="v2-0001-Add-vacuum_truncate-GUC.patch"