From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Set cutoff xmin more aggressively when vacuuming a temporary tab
Date: Tue, 01 Sep 2020 22:40:55 +0000
Message-ID: <E1kDExT-0002G8-LP@gemulon.postgresql.org> (raw)
Set cutoff xmin more aggressively when vacuuming a temporary table.
Since other sessions aren't allowed to look into a temporary table
of our own session, we do not need to worry about the global xmin
horizon when setting the vacuum XID cutoff. Indeed, if we're not
inside a transaction block, we may set oldestXmin to be the next
XID, because there cannot be any in-doubt tuples in a temp table,
nor any tuples that are dead but still visible to some snapshot of
our transaction. (VACUUM, of course, is never inside a transaction
block; but we need to test that because CLUSTER shares the same code.)
This approach allows us to always clean out a temp table completely
during VACUUM, independently of concurrent activity. Aside from
being useful in its own right, that simplifies building reproducible
test cases.
Discussion: https://postgr.es/m/3490536.1598629609@sss.pgh.pa.us
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/a7212be8b9e0885ee769e8c55f99ef742cda487b
Modified Files
--------------
src/backend/access/heap/vacuumlazy.c | 1 +
src/backend/commands/cluster.c | 28 ++++++++------
src/backend/commands/vacuum.c | 73 ++++++++++++++++++++++++------------
src/include/commands/cluster.h | 3 +-
src/include/commands/vacuum.h | 1 +
5 files changed, 70 insertions(+), 36 deletions(-)
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-committers@postgresql.org
Cc: tgl@sss.pgh.pa.us
Subject: Re: pgsql: Set cutoff xmin more aggressively when vacuuming a temporary tab
In-Reply-To: <E1kDExT-0002G8-LP@gemulon.postgresql.org>
References: <E1kDExT-0002G8-LP@gemulon.postgresql.org>
* 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