Received: from localhost (unknown [200.46.204.184]) by postgresql.org (Postfix) with ESMTP id AA9932E2EAF for ; Tue, 22 Jan 2008 15:42:38 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.184]) (amavisd-maia, port 10024) with ESMTP id 30049-04-7 for ; Tue, 22 Jan 2008 15:42:31 -0400 (AST) Received: from andromeda1.neonex.com.br (dns3.neonex.com.br [201.28.22.10]) by postgresql.org (Postfix) with ESMTP id 431B82E3337 for ; Tue, 22 Jan 2008 15:32:24 -0400 (AST) Received: from [200.206.25.4] (helo=[127.0.0.1]) by andromeda1.neonex.com.br with esmtpa (Exim 4.63) (envelope-from ) id 1JHOr6-00058C-2v for pgsql-performance@postgresql.org; Tue, 22 Jan 2008 17:32:20 -0200 Message-ID: <479644C1.4070703@planit.com.br> Date: Tue, 22 Jan 2008 17:32:17 -0200 From: "Luiz K. Matsumura" Organization: Plan IT Tecnologia =?ISO-8859-1?Q?Inform=E1tica_Ltda=2E?= User-Agent: Thunderbird 2.0.0.9 (Windows/20071031) MIME-Version: 1.0 To: pgsql-performance@postgresql.org Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-Antivirus: avast! (VPS 080122-1, 01/22/2008), Outbound message X-Antivirus-Status: Clean X-SA-Exim-Connect-IP: 200.206.25.4 X-SA-Exim-Rcpt-To: pgsql-performance@postgresql.org Subject: Optimizing queries that use temporary tables X-SA-Exim-Version: 4.2.1 (built Tue, 09 Jan 2007 17:23:22 +0000) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200801/180 X-Sequence-Number: 28419 Hello, I'm developing some routines that will use temporary tables and need advice on how to not lose performance. I will insert data in a temporary table and use this data to generate new sets that will update or add to the same temporary table. I have some questions that I'm concerned about: - I can create indexes on this temp table to optimize queries ? If yes... - This indexes will be destroyed together (automatic?) the temp table when the connection is closed ? - When I insert a lot of new rows, need to run analyze on this temporary table ? Thanks in Advance. -- Luiz K. Matsumura Plan IT Tecnologia Informática Ltda.