Re: Temporary tables prevent autovacuum, leading to XID wraparound
Robert Haas <robertmhaas@gmail.com>
From: Robert Haas <robertmhaas@gmail.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: "Tsunakawa, Takayuki" <tsunakawa.takay@jp.fujitsu.com>, "pgsql-hackers@postgresql.org" <pgsql-hackers@postgresql.org>
Date: 2018-03-08T19:15:08Z
Lists: pgsql-hackers
On Thu, Mar 8, 2018 at 1:09 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote: > We already have autovacuum taking care of that, and as I stated, asking > backends to do it is provably insufficient. The right path is to make > autovacuum cover the cases it's missing today. Well, your counter-proposal of teaching autovacuum to recognize the case where the backend and the orphaned schema are in different databases is also provably insufficient. We have to make more than one change here to really fix this, and the two changes that Tsunakawa-san proposed, taken together, are sufficient; either one by itself is not. Doing only #2 out of his proposals, as you proposed, is better than doing nothing, but it's not a complete fix. >> I don't >> really share your concern about performance; one extra syscache lookup >> at backend startup isn't going to break the bank. > > If it were just that, I wouldn't be worried either. But it's not. > Once the pg_namespace row exists, which it will in an installation > that's been in use for for any length of time, you're going to have > to actively search for entries in that schema. I'm not sure how > expensive a performDeletion() scan that finds nothing to do really > is, but for sure it's more than the syscache lookup you expended to > find the pg_namespace row. True, but that's a rare scenario. Still, I'm not sure we're too far apart on the underlying issue here; we both would prefer, for one reason or another, if autovacuum could just take care of this. But I think that Tsunakawa-san is correct to guess that your proposal might have some race conditions that need to be solved somehow. -- Robert Haas EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company
Commits
-
Clarify comment about assignment and reset of temp namespace ID in MyProc
- 9fc9933695af 11.0 landed
- 1339fcc89617 12.0 landed
-
Make autovacuum more aggressive to remove orphaned temp tables
- 943576bddcb5 11.0 landed
- 246a6c8f7b23 12.0 landed
-
Don't count background workers against a user's connection limit.
- 13752743bf70 9.6.2 cited