Re: BUG #14042: bug, PostgreSQL not cleanup temp table info after crash. - Mailing list pgsql-bugs

From Tom Lane
Subject Re: BUG #14042: bug, PostgreSQL not cleanup temp table info after crash.
Date
Msg-id 22423.1458828232@sss.pgh.pa.us
Whole thread Raw
In response to BUG #14042: bug, PostgreSQL not cleanup temp table info after crash.  (digoal@126.com)
List pgsql-bugs
digoal@126.com writes:
> When PostgreSQL crashed during database have temp table, database not
> cleanup the temp table's info in pg_class.

This behavior is intentional.

> and there is some bad thing, if no one create the same name temp table after
> restart. this temp table will a zombie in pg_class, and vacuum freeze cann't
> reduce it's age and database's age.

This is not a problem, see the code in autovacuum.c:

                /*
                 * We found an orphan temp table (which was probably left
                 * behind by a crashed backend).  If it's so old as to need
                 * vacuum for wraparound, forcibly drop it.  Otherwise just
                 * log a complaint.
                 */

In practice, such tables will go away the next time some session uses the
temp schema containing them, so their lifespan isn't likely to be nearly
long enough for this code to activate.  But in any case, they won't create
a wraparound hazard.

            regards, tom lane

pgsql-bugs by date:

Previous
From: "Reko Turja"
Date:
Subject: Re: Missing rows with index scan when collation is not "C" (PostgreSQL 9.5);
Next
From: Robert Haas
Date:
Subject: Re: Re: Missing rows with index scan when collation is not "C" (PostgreSQL 9.5)