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 720939DC9F9 for ; Thu, 29 Dec 2005 12:19:33 -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 52709-01 for ; Thu, 29 Dec 2005 12:19:31 -0400 (AST) X-Greylist: delayed 06:31:10.216454 by SQLgrey- Received: from mail.androme.com (mail.androme.com [62.58.96.145]) by postgresql.org (Postfix) with ESMTP id 0F0069DC86F for ; Thu, 29 Dec 2005 12:19:30 -0400 (AST) Received: from [192.168.10.56] ([192.168.10.56]) by mail.androme.com (8.12.10/8.12.10) with ESMTP id jBTGJRw5005653; Thu, 29 Dec 2005 17:19:28 +0100 Message-ID: <43B40C8F.6010100@andromeiberica.com> Date: Thu, 29 Dec 2005 17:19:27 +0100 From: Arnau Reply-To: arnaulist@andromeiberica.com User-Agent: Mozilla Thunderbird 1.0.6 (Windows/20050716) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Teemu Torma CC: pgsql-performance@postgresql.org Subject: Re: How import big amounts of data? References: <43B3B0EA.6070406@andromeiberica.com> <200512291541.05739.teemu@torma.org> In-Reply-To: <200512291541.05739.teemu@torma.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.12 required=5 tests=[AWL=0.120] X-Spam-Score: 0.12 X-Spam-Level: X-Archive-Number: 200512/648 X-Sequence-Number: 16469 > > I am doing twice as big imports daily, and found the follwing method > most efficient (other than using copy): > > - Use plpgsql function to do the actual insert (or update/insert if > needed). > > - Inside a transaction, execute SELECT statements with maximum possible > number of insert function calls in one go. This minimizes the number > of round trips between the client and the server. Thanks Teemu! could you paste an example of one of those functions? ;-) An example of those SELECTS also would be great, I'm not sure I have completly understood what you mean. -- Arnau