Temporary tables

From: "SHELTON,MICHAEL (Non-HP-Boise,ex1)" <michael_shelton(at)non(dot)hp(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: Temporary tables
Date: 2002-01-10 23:02:33
Message-ID: FB60DFB2C0E24449AC0C21F743B935410150F91F@xboi02.boi.hp.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Hello,

I am attempting to optimize a number of queries that are dependant on a
first query (big join) that is expensive to run. Instead of having the join
be executed for each subsequent query I would like to put the results of the
first join into a temp table. I found syntax for creating a temp table in
the idocs (SELECT <foo> INTO <tmp_table> FROM <table>) and this works fine.
My problem is that the table isn't very "temporary". Is there a way to have
the table drop automagically when I'm done with it. I'm accessing it
through PHP 4.0 via apache on a 7.1.3 db. I would really like it to drop
when I close the connection.

A 2nd question is what about concurrency? Is there a way to hide this temp
table from other concurrent connections to the db (I thought I remember
reading an earlier post about this) so that you don't get name conflicts
with the temp table?

Thanks,

Mike Shelton

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message SHELTON,MICHAEL (Non-HP-Boise,ex1) 2002-01-10 23:06:35 Recall: Temporary tables
Previous Message steve boyle 2002-01-10 22:53:35 Re: Result sets from functions