Re: Performance with temporary table

From: "samantha mahindrakar" <sam(dot)mahindrakar(at)gmail(dot)com>
To: "Alvaro Herrera" <alvherre(at)commandprompt(dot)com>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: Performance with temporary table
Date: 2008-04-08 19:28:03
Message-ID: f0c828c40804081228x6e1edf2l881fe0725f1a5504@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Well instead of creating a temp table everytime i just created a
permanant table and insert the data into it everytime and truncate it.
I created indexes on this permanent table too. This did improve the
performance to some extent.

Does using permanant tables also bloat the catalog or hinder the performance?

Thanks
Samantha

On 4/8/08, Alvaro Herrera <alvherre(at)commandprompt(dot)com> wrote:
> samantha mahindrakar escribió:
>
> > So the program necessarily creates a temporary table evrytime it has
> > to correct a record. However this table is dropeed after each record
> > is corrected.
>
> Perhaps it would be better to truncate the temp table instead.
>
> > Iam not sure if i can use a cursor to replicate the functionality of
> > the temp table. Is the performance bad because of the creation and
> > deletion of the temp table?
>
> Yes -- if you create/drop thousands of temp tables (or create/drop the
> same temp table thousands of time), the resulting catalog bloat is
> likely to hinder performance. Perhaps autovacuum should be at work here
> (and if not you can solve the issue with manual vacuums to the system
> catalogs), but even then it is at best unnecessary.
>
> --
> Alvaro Herrera http://www.CommandPrompt.com/
> The PostgreSQL Company - Command Prompt, Inc.
>

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Alvaro Herrera 2008-04-08 19:43:10 Re: Performance with temporary table
Previous Message Oleg Bartunov 2008-04-08 17:38:56 Re: Re: what worked: performance improvements for geo-spatial searching on FreeBSD