Skip site navigation (1) Skip section navigation (2)

Re: Using temp tables with web apps (No State)

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Danny Aldham <danny(at)lennon(dot)postino(dot)com>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: Using temp tables with web apps (No State)
Date: 2001-11-30 15:07:17
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-novice
Danny Aldham <danny(at)lennon(dot)postino(dot)com> writes:
> I am wondering if anyone has a decent method of cleaning up
> these temporary tables after use. 
> I am considering creating a table called Temp_Tables, and inserting the
> name of the temp_tables into it, and having a cron job read Temp_Tables
> for a list of temp_tables to drop. Any other suggestions are appreciated.

Are you able to choose the table names freely?  If so, consider encoding
the needed info right into the table name:


(I'm imagining the current timestamp and PID as the variable components
here, but you could alter that to suit your needs.)  Then a scan of
pg_class tells the cron job what to do.  This avoids the overhead of an
extra table insert/delete, and more importantly avoids any possibility of
the Temp_Tables table getting out of sync with reality.

			regards, tom lane

In response to

pgsql-novice by date

Next:From: Ewald GeschwindeDate: 2001-11-30 16:40:36
Subject: what's this debug mean?
Previous:From: Brett W. McCoyDate: 2001-11-30 15:04:44
Subject: Re: Logging

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group