Received: from localhost (maia-4.hub.org [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id 22C3C9FBA75 for ; Tue, 6 Mar 2007 11:39:04 -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 85735-01 for ; Tue, 6 Mar 2007 11:38:42 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from floppy.pyrenet.fr (floppy.pyrenet.fr [194.116.145.2]) by postgresql.org (Postfix) with ESMTP id 886C99FB950 for ; Tue, 6 Mar 2007 11:38:42 -0400 (AST) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id DE424308E6; Tue, 6 Mar 2007 16:38:40 +0100 (MET) From: "hatman" X-Newsgroups: pgsql.performance Subject: Re: Insert performance Date: 6 Mar 2007 07:38:25 -0800 Organization: http://groups.google.com Lines: 36 Message-ID: <1173195505.228450.239060@c51g2000cwc.googlegroups.com> 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> Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-Complaints-To: groups-abuse@google.com Cc: "Andreas Kostyrka" , "Richard Huxton" In-Reply-To: <20070306122342.GO22981@andi-lap.la.revver.com> User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.12) Gecko/20060607 Debian/1.7.12-1.2,gzip(gfe),gzip(gfe) X-HTTP-Via: 1.1 proxy-1.heig-vd.ch:8080 (squid/2.5.STABLE4) Complaints-To: groups-abuse@google.com Injection-Info: c51g2000cwc.googlegroups.com; posting-host=193.134.216.146; posting-account=gnwH_QwAAAAQLNv14JlAW4Wgi-SQgnth To: pgsql-performance@postgresql.org X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.051 tagged_above=0 required=5 tests=AWL, BAYES_50 X-Spam-Level: X-Archive-Number: 200703/180 X-Sequence-Number: 23585 Hi Andreas, Thanks for the info about COPY !! On Mar 6, 1:23 pm, andr...@kostyrka.org (Andreas Kostyrka) wrote: > * Richard Huxton [070306 12:22]:> >>2. You can do a C= OPY 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 in= sert 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 agai= nst > 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). Ok, but what about constraints (foreign keys and SERIAL id) using a copy statement ? do we need to handle auto-generated id (SERIAL) manually ? Thanks for your feedback. Regards, Jo=EBl