pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Justin Pryzby <pryzby@telsasoft.com>
To: Bossart, Nathan <bossartn@amazon.com>
Cc: Vik Fearing <vik.fearing@2ndquadrant.com>
Cc: pgsql-hackers@postgresql.org
Cc: Michael Paquier <michael@paquier.xyz>
Cc: k.jamison@fujitsu.com
Subject: Re: Add MAIN_RELATION_CLEANUP and SECONDARY_RELATION_CLEANUP options to VACUUM
Date: Wed, 27 Jan 2021 19:08:15 -0600
Message-ID: <20210128010815.GA7450@telsasoft.com> (raw)
In-Reply-To: <930F06F8-3425-48A2-9A2E-11404BAA2341@amazon.com>
References: <BA8951E9-1524-48C5-94AF-73B1F0D7857F@amazon.com>
	<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>

On Wed, Jan 27, 2021 at 11:16:26PM +0000, Bossart, Nathan wrote:
> On 1/27/21, 11:07 AM, "Justin Pryzby" <pryzby@telsasoft.com> 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 <literal>FULL</literal> 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





view thread (29+ messages)  latest in thread

Message-ID: <20210128010815.GA7450@telsasoft.com>
Permalink:  ../20210128010815.GA7450@telsasoft.com/
Also on:    postgresql.org/message-id/20210128010815.GA7450@telsasoft.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-hackers@postgresql.org
  Cc: pryzby@telsasoft.com, bossartn@amazon.com, vik.fearing@2ndquadrant.com, michael@paquier.xyz, k.jamison@fujitsu.com
  Subject: Re: Add MAIN_RELATION_CLEANUP and SECONDARY_RELATION_CLEANUP options to VACUUM
  In-Reply-To: <20210128010815.GA7450@telsasoft.com>
  References: <BA8951E9-1524-48C5-94AF-73B1F0D7857F@amazon.com> <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> <20210128010815.GA7450@telsasoft.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox