Re: Temporary tables prevent autovacuum, leading to XID wraparound

Robert Haas <robertmhaas@gmail.com>

From: Robert Haas <robertmhaas@gmail.com>
To: Michael Paquier <michael.paquier@gmail.com>
Cc: "Tsunakawa, Takayuki" <tsunakawa.takay@jp.fujitsu.com>, "pgsql-hackers@postgresql.org" <pgsql-hackers@postgresql.org>
Date: 2018-02-07T16:22:42Z
Lists: pgsql-hackers
On Tue, Feb 6, 2018 at 6:03 PM, Michael Paquier
<michael.paquier@gmail.com> wrote:
> I am not sure that we would like to give up that easily the property
> that we have now to clean up past temporary files only at postmaster
> startup and only when not in recovery.  If you implement that, there is
> a risk that the backend you are starting is eating the connection slot
> and by consequence its temporary schema and its set of temporary tables
> on which one may want to look into after a crash.

You can't actually do that from SQL, because as soon as you try to
access your pg_temp schema, it'll be cleared out.  All this changes
does is move that forward from time-of-first-access to session start.
That's a significant change that needs discussion, but I don't think
it has the effect you are supposing.

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


Commits

  1. Clarify comment about assignment and reset of temp namespace ID in MyProc

  2. Make autovacuum more aggressive to remove orphaned temp tables

  3. Don't count background workers against a user's connection limit.