Re: Temporary tables versus wraparound... again - Mailing list pgsql-hackers

From Greg Stark
Subject Re: Temporary tables versus wraparound... again
Date
Msg-id CAM-w4HNVGP-D8w7y-o79GTNupdtbHpyYNNNan4sURDvGS3axSw@mail.gmail.com
Whole thread Raw
In response to Re: Temporary tables versus wraparound... again  (Andres Freund <andres@anarazel.de>)
Responses Re: Temporary tables versus wraparound... again  (Andres Freund <andres@anarazel.de>)
List pgsql-hackers
So.... I talked about this patch with Ronan Dunklau and he had a good
question.... Why are we maintaining relfrozenxid and relminmxid in
pg_class for temporary tables at all? Autovacuum can't use them and
other sessions won't care about them. The only session that might care
about them is the one attached to the temp schema.

So we could replace relfrozenxid and relminmxid for temp tables with a
local hash table that can be updated on every truncate easily and
efficiently.

If a temp table actually wraps around the only session that runs into
problems is the one attached to that temp schema. It can throw local
session errors and doesn't need to interfere with the rest of the
cluster in any way. It could even start running vacuums though I'm not
convinced that's a great solution.

At least I think so. I'm pretty sure about relfrozenxid but as always
I don't really know how relminmxid works. I think we only need to
worry about multixacts for subtransactions, all of which are in the
same transaction  -- does that even work that way?

But this is really attractive since it means no catalog updates just
for temp tables on every transaction and no wraparound cluster
problems even if you have on-commit-preserve-rows tables. It really
shouldn't be possible for a regular user to cause the whole cluster to
run into problems just by creating a temp table and keeping a
connection around a while.



pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: Removing unneeded self joins
Next
From: Andres Freund
Date:
Subject: Re: [PATCH] Use indexes on the subscriber when REPLICA IDENTITY is full on the publisher