pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Paquier <michael@paquier.xyz>
To: Andres Freund <andres@anarazel.de>
Cc: Thierry Husson <thusson@informiciel.com>
Cc: Robert Haas <robertmhaas@gmail.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-hackers@lists.postgresql.org
Subject: Re: Temp table handling after anti-wraparound shutdown (Was: BUG #15840)
Date: Sat, 8 Jun 2019 08:59:37 +0900
Message-ID: <20190607235937.GA1590@paquier.xyz> (raw)
In-Reply-To: <20190607225843.z73jqqyy6hhc6qnp@alap3.anarazel.de>
References: <15840-06c9565bfd8099f6@postgresql.org>
	<20190607190231.6psb6w3bvlod7lvk@alap3.anarazel.de>
	<20190607145911.Horde.MKizKAnShw4nKEYGDUC2M-T@webmail.iciel.com>
	<20190607201002.cado5goe3rcup43n@alap3.anarazel.de>
	<20190607164027.Horde._egTUMJMTDBA4f31sPYgl_J@webmail.iciel.com>
	<20190607225843.z73jqqyy6hhc6qnp@alap3.anarazel.de>

On Fri, Jun 07, 2019 at 03:58:43PM -0700, Andres Freund wrote:
> Do we need to move the orphan temp cleanup code into database vacuums or
> such?

When entering into the vacuum() code path for an autovacuum, only one
relation at a time is processed, and we have prior that extra
processing related to toast relations when selecting the relations to
work on, or potentially delete orphaned temp tables.  For a manual
vacuum, we finish by deciding which relation to process in
get_all_vacuum_rels(), so the localized processing is a bit different
than what's done in do_autovacuum() when scanning pg_class for
relations. 

Technically, I think that it would work to give up on the gathering of
the orphaned OIDs in a gathering and let them be gathered in the list
of items to vacuum, and then put the deletion logic down to
vacuum_rel().  However, there is a take: for autovacuum we gather the
orphaned entries and the other relations to process, then drop all the
orphaned OIDs, and finally vacuum/analyze the entries collected.  So
if you put the deletion logic down into vacuum_rel() then we won't be
able to drop orphaned tables before working on a database, which would
be bad if we know about an orphaned set, but autovacuum works for a
long time on other legit entries first.
--
Michael

Attachments:

  signature.asc (application/pgp-signature, 832B) download

view thread (10+ messages)  latest in thread

Message-ID: <20190607235937.GA1590@paquier.xyz>
Permalink:  ../20190607235937.GA1590@paquier.xyz/
Also on:    postgresql.org/message-id/20190607235937.GA1590@paquier.xyz

 · 

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-bugs@postgresql.org
  Cc: michael@paquier.xyz, andres@anarazel.de, thusson@informiciel.com, robertmhaas@gmail.com, tgl@sss.pgh.pa.us, pgsql-hackers@lists.postgresql.org
  Subject: Re: Temp table handling after anti-wraparound shutdown (Was: BUG #15840)
  In-Reply-To: <20190607235937.GA1590@paquier.xyz>
  References: <15840-06c9565bfd8099f6@postgresql.org> <20190607190231.6psb6w3bvlod7lvk@alap3.anarazel.de> <20190607145911.Horde.MKizKAnShw4nKEYGDUC2M-T@webmail.iciel.com> <20190607201002.cado5goe3rcup43n@alap3.anarazel.de> <20190607164027.Horde._egTUMJMTDBA4f31sPYgl_J@webmail.iciel.com> <20190607225843.z73jqqyy6hhc6qnp@alap3.anarazel.de> <20190607235937.GA1590@paquier.xyz>

* 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