Received: from localhost (unknown [200.46.204.183]) by developer.postgresql.org (Postfix) with ESMTP id 073AE2E0035 for ; Tue, 8 Apr 2008 16:28:15 -0300 (ADT) Received: from developer.postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 25853-08 for ; Tue, 8 Apr 2008 16:28:11 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.5 Received: from yw-out-2324.google.com (yw-out-2324.google.com [74.125.46.28]) by developer.postgresql.org (Postfix) with ESMTP id DA3A12E0033 for ; Tue, 8 Apr 2008 16:28:10 -0300 (ADT) Received: by yw-out-2324.google.com with SMTP id 2so386619ywt.73 for ; Tue, 08 Apr 2008 12:28:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; bh=g7dhPcC5J5dWSEF05nh4dMazdjB9z/E07wDnzOZsPeI=; b=AeQTbCLmFcFmYqx4JqoIVTCYp8aQeEFKxooxbnV0HyiYxVkT779x6NjDqEsZWEnfxH37IEzUV3jqWoT12Ey2dFm0sDJCP+5vn+fzwMQWh7WN3zAMjKUgBW6JLFY1VnSJpgmivsYkzeSd8WYNlwefWi6Da6edKRi8Er/sFHKq3FE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=doh/NEEfT9mp2r2IfBnFqlqkWaiWEIsavRg3UNDfrjbO+Ff9CEqEaFZiWUA7WCp06+x92Q/7IXTQhroYGpK1RxlUyM59EfYJtr4UGg8osf6YJ+h8l0Ws+YV7w+weudBLQ9lL6arN8WoruMPrS9Y3hRk8auEOA0P3Ix7/Tt/+cYM= Received: by 10.114.181.6 with SMTP id d6mr8075212waf.50.1207682883058; Tue, 08 Apr 2008 12:28:03 -0700 (PDT) Received: by 10.114.181.19 with HTTP; Tue, 8 Apr 2008 12:28:03 -0700 (PDT) Message-ID: Date: Tue, 8 Apr 2008 15:28:03 -0400 From: "samantha mahindrakar" To: "Alvaro Herrera" Subject: Re: Performance with temporary table Cc: pgsql-performance@postgresql.org In-Reply-To: <20080408161745.GB9062@alvh.no-ip.org> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <20080408161745.GB9062@alvh.no-ip.org> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests=none X-Spam-Level: X-Archive-Number: 200804/94 X-Sequence-Number: 29587 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 performanc= e? Thanks Samantha On 4/8/08, Alvaro Herrera wrote: > samantha mahindrakar escribi=F3: > > > 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.co= m/ > The PostgreSQL Company - Command Prompt, Inc. >