Re: Temporary tables versus wraparound... again

From: Greg Stark <stark(at)mit(dot)edu>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: Justin Pryzby <pryzby(at)telsasoft(dot)com>, Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Noah Misch <noah(at)leadboat(dot)com>, Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Temporary tables versus wraparound... again
Date: 2023-04-12 20:22:41
Message-ID: CAM-w4HO=YtiM8+_qTMSCmoBB8Cjit9K7noVZD6BPLiViQuUygg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, 5 Apr 2023 at 13:42, Andres Freund <andres(at)anarazel(dot)de> wrote:
>
> ISTM that the problem here really is that you're relying on RecentXmin, rather
> than computing something more accurate. Why not use
> GetOldestNonRemovableTransactionId(rel) - It's a bit more expensive, but I
> don't think it'll matter compared to the cost of truncating the relation.

I'm trying to wrap my head around GetOldestNonRemovableTransactionId()
and whether it's the right thing here. This comment is not helping me:

/*
* Return the oldest XID for which deleted tuples must be preserved in the
* passed table.
*
* If rel is not NULL the horizon may be considerably more recent than
* otherwise (i.e. fewer tuples will be removable). In the NULL case a horizon
* that is correct (but not optimal) for all relations will be returned.
*
* This is used by VACUUM to decide which deleted tuples must be preserved in
* the passed in table.
*/

Am I crazy or is the parenthetical comment there exactly backwards? If
the horizon is *more recent* then fewer tuples are *non*-removable.
I.e. *more* tuples are removable, no?

--
greg

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2023-04-12 20:23:05 Re: [PATCH] Add `verify-system` sslmode to use system CA pool for server cert
Previous Message Daniel Gustafsson 2023-04-12 19:57:27 Re: [PATCH] Add `verify-system` sslmode to use system CA pool for server cert