Received: from localhost (maia-4.hub.org [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id F3CE09FB25F for ; Tue, 6 Mar 2007 08:29:17 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-new, port 10024) with ESMTP id 22991-10 for ; Tue, 6 Mar 2007 08:29:09 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from mail.metronet.co.uk (mail.metronet.co.uk [213.162.97.75]) by postgresql.org (Postfix) with ESMTP id 5329C9FB788 for ; Tue, 6 Mar 2007 08:29:09 -0400 (AST) Received: from server3.office.archonet.com (84-51-143-99.archon037.adsl.metronet.co.uk [84.51.143.99]) by smtp.metronet.co.uk (MetroNet Mail) with ESMTP id B6A1E76400; Tue, 6 Mar 2007 12:24:58 +0000 (GMT) Received: from [192.168.1.36] (dell36.office.archonet.com [192.168.1.36]) by server3.office.archonet.com (Postfix) with ESMTP id 8E55D27403D; Tue, 6 Mar 2007 12:24:58 +0000 (GMT) Message-ID: <45ED5D9A.2010702@archonet.com> Date: Tue, 06 Mar 2007 12:24:58 +0000 From: Richard Huxton User-Agent: IceDove 1.5.0.9 (X11/20061220) MIME-Version: 1.0 To: Andreas Kostyrka Cc: =?ISO-8859-1?Q?jo=EBl_Winteregg?= , pgsql-performance@postgresql.org Subject: Re: Insert performance References: <1172596221.393824.41130@j27g2000cwj.googlegroups.com> <45ED1996.7050008@archonet.com> <1173167607.4917.8.camel@hatman> <45ED217D.30404@archonet.com> <1173172748.4917.23.camel@hatman> <45ED37D1.3000503@archonet.com> <20070306122342.GO22981@andi-lap.la.revver.com> In-Reply-To: <20070306122342.GO22981@andi-lap.la.revver.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.211 tagged_above=0 required=5 tests=AWL, BAYES_50, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200703/125 X-Sequence-Number: 23530 Andreas Kostyrka wrote: > * Richard Huxton [070306 12:22]: >>>> 2. You can do a COPY from libpq - is it really not possible? >>>> >>> Not really but i have been testing it and inserts are flying (about >>> 100000 inserts/sec) !! >> What's the problem with the COPY? Could you COPY into one table then insert from that to your target table? > Well, there are some issues. First your client needs to support it. > E.g. psycopg2 supports only some specific CSV formatting in it's > methods. (plus I had sometimes random psycopg2 crashes, but guarding against > these is cheap compared to the speedup from COPY versus INSERT) > Plus you need to be sure that your data will apply cleanly (which in > my app was not the case), or you need to code a fallback that > localizes the row that doesn't work. > > And the worst thing is, that it ignores RULES on the tables, which > sucks if you use them ;) (e.g. table partitioning). Ah, but two things deal with these issues: 1. Joel is using libpq 2. COPY into a holding table, tidy data and INSERT ... SELECT -- Richard Huxton Archonet Ltd