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 1l4vnT-0007fm-88 for pgsql-hackers@arkaria.postgresql.org; Thu, 28 Jan 2021 01:08:31 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1l4vnQ-0006a4-Fn for pgsql-hackers@arkaria.postgresql.org; Thu, 28 Jan 2021 01:08:28 +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 1l4vnQ-0006Zx-4G for pgsql-hackers@lists.postgresql.org; Thu, 28 Jan 2021 01:08:28 +0000 Received: from mail-io1-xd2c.google.com ([2607:f8b0:4864:20::d2c]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1l4vnI-0004uf-Iv for pgsql-hackers@postgresql.org; Thu, 28 Jan 2021 01:08:27 +0000 Received: by mail-io1-xd2c.google.com with SMTP id y19so3930279iov.2 for ; Wed, 27 Jan 2021 17:08:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telsasoft-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=/gFsJDH+7NJSSJHNVCWJlVR85MgKeyqcgctUXh8Iysg=; b=dhcktjMi5vfHXx0evarnQxfn6DMonZ0n+oOCiAVIKrUVtChqVVrD1dhxbyc4n91aeR Dqf1dk2E/Av4ZwMznRfw8mTlD/lMcKI6zd/HIe4tb466FxiYADRyh/YakIpNpYXy4H7X W0GGlScitnC1Gss8zS7wl8Gz8SyWx60OZ4ltVkCiil3Hd6hlT4oCKkqDN5/LKo9qCkhG Vfzk4U9AEBz7Wcr1+GZjWW/gJpABXh4V9EWWDjcb65JIYo/DzFV0BD2WO3HGDQCIVSH7 xre6rLhsARVEH0Rn3daZXrFDryojTTxhMicOmtXSrPzcdJv1Ncm2DhtZAEflRlAr5LnQ 9LoQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=/gFsJDH+7NJSSJHNVCWJlVR85MgKeyqcgctUXh8Iysg=; b=VL6jnSSli999/4RKOPWqZDF/9H+NK1i//Jf5+iaTcHpKJzV4a4yZL7eqr0E/FFZASk hmNaDWmc2y/rDvhREp9q6bQllfFNvBjMuwZMrUX4WemjrMj3EKo32X5Wyv7KuEj7bLyh PkyuMeITC5zVsrysls808KO4wGwc0usJFk1lG7wVhQaU+k0U6jLd90UExkwILmvEKmA0 LGih5DvOU7b7K74nKdqV1qi0OF1PCQOyhQS5uOhKJs8h+0wgnSa8LSeA1u+iZOoKeEdO BeqhiBW85Xy7x+oDlbUgre9l6p7mmkDSlnXl/yXITvCwVCF2a/7cYgUhboymuFSeQG6J 3C1A== X-Gm-Message-State: AOAM530F3nA+ZbguBSwYhBW6vgtv54Ucy9wKQ9EwYmwODumTN2/uCqrY wKm3w7Rs5l9u4fFag3IYDW0Z7w== X-Google-Smtp-Source: ABdhPJyJ03MHmBzBAhwSfD8msvDU3DtZnirkfeAGiYx7NL+iKeT/klk1hGHUW735Z/oy+Wkd73orfQ== X-Received: by 2002:a6b:5915:: with SMTP id n21mr9498585iob.20.1611796098022; Wed, 27 Jan 2021 17:08:18 -0800 (PST) Received: from pryzbyj.telsasoft (charmander.telsasoft.com. [50.244.222.1]) by smtp.gmail.com with ESMTPSA id u6sm1863723ill.87.2021.01.27.17.08.16 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 27 Jan 2021 17:08:17 -0800 (PST) Received: by pryzbyj.telsasoft (Postfix, from userid 1000) id 168528008D1; Wed, 27 Jan 2021 19:08:16 -0600 (CST) Date: Wed, 27 Jan 2021 19:08:15 -0600 From: Justin Pryzby To: "Bossart, Nathan" Cc: Vik Fearing , pgsql-hackers@postgresql.org, Michael Paquier , k.jamison@fujitsu.com Subject: Re: Add MAIN_RELATION_CLEANUP and SECONDARY_RELATION_CLEANUP options to VACUUM Message-ID: <20210128010815.GA7450@telsasoft.com> References: <657e9792-29b2-9dda-0ea3-73d8ba28b2ac@2ndquadrant.com> <38EFD769-F653-4D30-9DD6-1A335F4F9232@amazon.com> <20210127190640.GT30745@telsasoft.com> <930F06F8-3425-48A2-9A2E-11404BAA2341@amazon.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <930F06F8-3425-48A2-9A2E-11404BAA2341@amazon.com> User-Agent: Mutt/1.9.4 (2018-02-28) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Wed, Jan 27, 2021 at 11:16:26PM +0000, Bossart, Nathan wrote: > On 1/27/21, 11:07 AM, "Justin Pryzby" wrote: > > This just came up for me: > > > > I have a daily maintenance script which pro-actively vacuums tables: freezing > > historic partitions, vacuuming current tables if the table's relfrozenxid is > > old, and to encourage indexonly scan. > > > > I'm checking the greatest(age(toast,main)) and vacuum the table (and implicitly > > its toast) whenever either is getting old. > > > > But it'd be more ideal if I could independently vacuum the main table if it's > > old, but not the toast table. > > Thanks for chiming in. > > It looks like we were leaning towards only adding the > TOAST_TABLE_CLEANUP option, which is already implemented internally > with VACOPT_SKIPTOAST. It's already possible to vacuum a TOAST table > directly, so we can probably do without the MAIN_RELATION_CLEANUP > option. > > I've attached a new patch that only adds TOAST_TABLE_CLEANUP. Thanks, I wrote my message after running into the issue and remembered this thread. I didn't necessarily mean to send another patch :) My only comment is on the name: TOAST_TABLE_CLEANUP. "Cleanup" suggests that the (main or only) purpose is to "clean" dead tuples to avoid bloat. But in my use case, the main purpose is to avoid XID wraparound (or its warnings). Okay, my second only comment is that this: | This option cannot be disabled when the FULL option is | used. Should it instead be ignored if FULL is also specified ? Currently only PARALLEL and DISABLE_PAGE_SKIPPING cause an error when used with FULL. That's documented for PARALLEL, but I think it should also be documented for DISABLE_PAGE_SKIPPING (which is however an advanced option). -- Justin