Received: from localhost (unknown [200.46.204.187]) by postgresql.org (Postfix) with ESMTP id 3A9FC2E006A for ; Tue, 22 Jan 2008 16:34:23 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.187]) (amavisd-maia, port 10024) with ESMTP id 55926-01 for ; Tue, 22 Jan 2008 16:34:14 -0400 (AST) Received: from wa-out-1112.google.com (wa-out-1112.google.com [209.85.146.179]) by postgresql.org (Postfix) with ESMTP id A3D792E0171 for ; Tue, 22 Jan 2008 16:34:16 -0400 (AST) Received: by wa-out-1112.google.com with SMTP id m38so4854321waf.5 for ; Tue, 22 Jan 2008 12:34:15 -0800 (PST) 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=f8SQMw6yeReKNqx76NRIwxmBFPp8b4VHW7NqZ6NGl+Y=; b=gPai+u6SZCwoAfwPU6y4fw8a+e27jTXB6YR0618hOPi32TGFmD7Kmw9ADVCHwHUnxkrfpCgXOocmTwlU6EABLlE2wBkNyicQq8KnaDDnabt+E/RqVizWpwH2XHQcxG7u6bJVVS0KWSjJU7Kz09a1UyQ+Ugh98tFp0gknFVkCBiA= 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=g0Q/sggdZG94F54gngUILIJ3H2S6d4mkpgPa5eu4saxhHYYk45KzJy6WFGZuZrxRKTih/H/j71glg1JbPQ8WdmwiBZXa8PF7H/PDsiVKJFInFMpUdl5fN4WC0Wv6ruOJqhVijuWGeF9IDDtO8x0wDPiDblKFx/7Yzi0cuMroATs= Received: by 10.114.121.1 with SMTP id t1mr5829242wac.67.1201034055499; Tue, 22 Jan 2008 12:34:15 -0800 (PST) Received: by 10.114.133.5 with HTTP; Tue, 22 Jan 2008 12:34:15 -0800 (PST) Message-ID: Date: Tue, 22 Jan 2008 14:34:15 -0600 From: "Scott Marlowe" To: "Luiz K. Matsumura" Subject: Re: Optimizing queries that use temporary tables Cc: pgsql-performance@postgresql.org In-Reply-To: <479644C1.4070703@planit.com.br> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <479644C1.4070703@planit.com.br> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200801/183 X-Sequence-Number: 28422 On Jan 22, 2008 1:32 PM, Luiz K. Matsumura wrote: > 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 ? Yes > If yes... > - This indexes will be destroyed together (automatic?) the temp table > when the connection is closed ? Yes > - When I insert a lot of new rows, need to run analyze on this temporary > table ? Yes