From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | pgsql-hackers(at)lists(dot)postgresql(dot)org |
Subject: | More aggressive vacuuming of temporary tables |
Date: | 2020-08-28 15:46:49 |
Message-ID: | 3490536.1598629609@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
It strikes me that when we are vacuuming a temporary table (which
necessarily will be one of our own session), we don't really need
to care what the global xmin horizon is. If we're not inside a
user transaction block, then there are no tuples in the table that
could be in-doubt anymore. Neither are there any snapshots in our
session that could see any dead tuples. Nor do we give a fig what
other sessions might think of those tuples. So we could just set
the xmin cutoff as aggressively as possible, which is to say
equal to the nextXid counter. While vacuuming a temp table is
perhaps not something people do very often, I think when they do
do it they would like us to clean out all the dead tuples not just
some.
Hence I propose 0001 attached. 80% of it is just API additions to allow
passing down the isTopLevel flag so that we can do the right thing in
the CLUSTER case; the important change is in vacuum_set_xid_limits.
(For ease of review, I didn't reindent the existing code in
vacuum_set_xid_limits, but that would be something to do before commit.)
The reason I got interested in this is that yesterday while fooling
with bug #16595, I was annoyed about our poor code test coverage in
access/gin/. The 0002 patch attached brings coverage for ginvacuum.c
up from 59% to 93%; but as things stand, a long delay has to be inserted
between the DELETE and VACUUM steps, else the VACUUM won't remove the
dead tuples because of concurrent transactions, and we get no coverage
improvement. Since the table in question is a temp table, that seems
pretty silly.
Thoughts? Am I missing something important here?
regards, tom lane
Attachment | Content-Type | Size |
---|---|---|
0001-vacuum-temp-tables-aggressively.patch | text/x-diff | 8.0 KB |
0002-gin-vacuum-coverage.patch | text/x-diff | 1.4 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2020-08-28 15:56:26 | Re: Deprecating postfix and factorial operators in PostgreSQL 13 |
Previous Message | Robert Haas | 2020-08-28 15:33:14 | Re: Hybrid Hash/Nested Loop joins and caching results from subplans |