X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 113149DCC2D for ; Wed, 22 Mar 2006 12:07:27 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 82327-08 for ; Wed, 22 Mar 2006 12:07:25 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from peufeu.com (boutiquenumerique.com [82.67.9.10]) by postgresql.org (Postfix) with ESMTP id 96FA79DC83C for ; Wed, 22 Mar 2006 12:07:24 -0400 (AST) Received: (qmail 10513 invoked from network); 22 Mar 2006 17:07:54 +0100 Received: from boutiquenumerique.com (HELO apollo13) (82.67.9.10) by boutiquenumerique.com with SMTP; 22 Mar 2006 17:07:54 +0100 To: ashah , pgsql Subject: Re: Massive Inserts Strategies References: <200603221032.10207.ashah@opuspro.com> Message-ID: Date: Wed, 22 Mar 2006 17:07:52 +0100 From: PFC Content-Type: text/plain; format=flowed; delsp=yes; charset=utf-8 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit In-Reply-To: <200603221032.10207.ashah@opuspro.com> User-Agent: Opera M2/8.51 (Linux, build 1462) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.111 required=5 tests=[AWL=0.111] X-Spam-Score: 0.111 X-Spam-Level: X-Archive-Number: 200603/458 X-Sequence-Number: 17895 For both cases, you could COPY your file into a temporary table and do a big JOIN with your existing table, one for inserting new rows, and one for updating existing rows. Doing a large bulk query is a lot more efficient than doing a lot of selects. Vacuum afterwards, and you'll be fine.