Re: stale temporary tables - Mailing list pgsql-general

From Bruce Momjian
Subject Re: stale temporary tables
Date
Msg-id 200210041755.g94HtSv27833@candle.pha.pa.us
Whole thread Raw
In response to stale temporary tables  ("thimoty@thimoty.it" <thimoty@thimoty.it>)
Responses Re: stale temporary tables  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
thimoty@thimoty.it wrote:
> Hello all,
>  i don't know if there is a quicker way, but i ended up in having
> 40,000 or so
> stale temp tables from a Java application which is using postgres as
> backend.
>
> what i did is the following:
> 1) run postmaster with -o -O
> 2) type \dS and put the result to a file (list of all the temp tables,
> all still there!)
> 3) create a sql file to drop the tables like this
> cut -f1 -d\| staletables.txt | grep pg_temp | sed '/pg_temp.[0-9]*.[0-9]
> */s//DROP TABLE "&";/' > droptables.sql
> 4) from pgsql run \i droptables.sql
>
> isn't there any switch or command in VACUUM that does it?

Lost temp tables should never happen, but they sometimes do because of
backend crashes.  I have worked on a patch to auto-delete them, but it
was rejected and we can't come up with a good way to do it.  I think
this is fixed in 7.3.

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

pgsql-general by date:

Previous
From: "Martin D. Weinberg"
Date:
Subject: multi-column btree index for real values
Next
From: Tom Lane
Date:
Subject: Re: Error after updating postgresql