Re: More aggressive vacuuming of temporary tables

2020-10-28 Thread Andres Freund
Hi, On 2020-10-14 13:31:03 -0700, Andres Freund wrote: > I was thinking about this a bit more, and I think the answer might be to > use Min(latestCompletedXid, MyProc->xid). That would, as far as I can > tell, never miss something vacuumable in a temporary table, doesn't > require to know whether

Re: More aggressive vacuuming of temporary tables

2020-10-16 Thread Peter Geoghegan
On Wed, Sep 9, 2020 at 11:02 AM Andres Freund wrote: > Obviously lookup in such a more complicated structure isn't free. Nor is > building it. So we'd need some heuristics about when to do so. It'd > probably be OK to occasionally look at the age of the oldest in-progress > statement, to infer the

Re: More aggressive vacuuming of temporary tables

2020-10-14 Thread Andres Freund
Hi, On 2020-09-08 18:13:58 -0400, Tom Lane wrote: > Andres Freund writes: > > On 2020-09-08 15:24:54 -0400, Tom Lane wrote: > >> Andres Freund writes: > >>> But now I do wonder why we need to know whether the command is top level > >>> or not? Why isn't the correct thing to instead look at what

Re: More aggressive vacuuming of temporary tables

2020-09-09 Thread Andres Freund
Hi, On 2020-09-09 10:14:04 -0400, Stephen Frost wrote: > > I've been toying with a patch that introduces more smarts about when a > > row is removable, by looking more closely whether a specific row > > versions are visible (e.g. in the common case of one old snapshot and > > lots of newer rows).

Re: More aggressive vacuuming of temporary tables

2020-09-09 Thread Stephen Frost
Greetings, * Andres Freund (and...@anarazel.de) wrote: > On 2020-08-28 11:46:49 -0400, Tom Lane wrote: > > 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

Re: More aggressive vacuuming of temporary tables

2020-09-08 Thread Tom Lane
Andres Freund writes: > On 2020-09-08 15:24:54 -0400, Tom Lane wrote: >> Andres Freund writes: >>> But now I do wonder why we need to know whether the command is top level >>> or not? Why isn't the correct thing to instead look at what the current >>> backend's xmin is? Seems like you could just

Re: More aggressive vacuuming of temporary tables

2020-09-08 Thread Andres Freund
Hi, On 2020-09-08 15:24:54 -0400, Tom Lane wrote: > Andres Freund writes: > > But now I do wonder why we need to know whether the command is top level > > or not? Why isn't the correct thing to instead look at what the current > > backend's xmin is? Seems like you could just replace > > *olde

Re: More aggressive vacuuming of temporary tables

2020-09-08 Thread Tom Lane
Andres Freund writes: > But now I do wonder why we need to know whether the command is top level > or not? Why isn't the correct thing to instead look at what the current > backend's xmin is? Seems like you could just replace > *oldestXmin = XidFromFullTransactionId(ReadNextFullTransactionId()

Re: More aggressive vacuuming of temporary tables

2020-09-08 Thread Andres Freund
Hi, On 2020-08-28 11:46:49 -0400, Tom Lane wrote: > 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 tu

Re: More aggressive vacuuming of temporary tables

2020-08-29 Thread Tom Lane
Michael Paquier writes: > I got to wonder lately if we should not have a static state like what > we do for MyXactFlags to track down if a utility query is a top-level > one or not as most of the time we just want to check the flag as > passed down by standard_ProcessUtility(). I have faced this

Re: More aggressive vacuuming of temporary tables

2020-08-28 Thread Michael Paquier
On Fri, Aug 28, 2020 at 11:46:49AM -0400, Tom Lane wrote: > 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

More aggressive vacuuming of temporary tables

2020-08-28 Thread Tom Lane
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