From: Peter Darley <pdarley@kinesis-cem.com>
To: Pgsql-General <pgsql-general@postgresql.org>
Subject: Temp Tables
Date: Thu, 7 Mar 2002 09:00:21 -0800
Message-ID: <NNEAICKPNOGDBHNCEDCPAEKDCFAA.pdarley@kinesis-cem.com> (raw)
Friends,
I'm hoping someone can give me some advice on a problem I'm having.
I have a system that produces 3060 reports each night. Each report uses a
temp table to limit the data set to the appropriate records, then joins that
temp table to other tables to produce its output. I'm a bit concerned that
this gets slower as the process goes on and the database gets more inserts
into those tables, etc. It looks like there are several ways I could handle
this, and I'm hoping someone can tell me which one is faster, or give me
some advice for testing which one is faster without actually running all the
options (which could easily take 50 hours, which I can't spare the db server
for).
1) I could reuse the same temp table and delete from it at the beginning of
every report.
2) I could drop the temp table and rebuild it at the beginning of every
report.
3) I could not drop the temp table, and create a new one for every report,
leaving cleanup to PostgreSQL when I disconnect from the db.
4) I could not drop the temp table, and for every report disconnect from
the db forcing cleanup of it, reconnect and recreate the table
5) I could create a real (non temp) table and reuse it for every report.
If anyone has some insight to the overhead of using temp tables that they
can pass on to me I would be very grateful.
Thanks,
Peter Darley
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: pdarley@kinesis-cem.com
Subject: Re: Temp Tables
In-Reply-To: <NNEAICKPNOGDBHNCEDCPAEKDCFAA.pdarley@kinesis-cem.com>
References: <NNEAICKPNOGDBHNCEDCPAEKDCFAA.pdarley@kinesis-cem.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox