Received: from localhost (maia-1.hub.org [200.46.204.191]) by postgresql.org (Postfix) with ESMTP id 4A4A09FA1A7 for ; Mon, 11 Dec 2006 12:56:39 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.191]) (amavisd-new, port 10024) with ESMTP id 81908-08 for ; Mon, 11 Dec 2006 12:56:31 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from 137086.vserver.de (vs137086.vserver.de [62.75.137.86]) by postgresql.org (Postfix) with ESMTP id EA6A89F9312 for ; Mon, 11 Dec 2006 12:56:29 -0400 (AST) Received: from a-kretschmer.de (p54B3ACE7.dip0.t-ipconnect.de [84.179.172.231]) (authenticated bits=0) by 137086.vserver.de (8.12.8/8.12.8) with ESMTP id kBBGuJ7I023592 for ; Mon, 11 Dec 2006 17:56:20 +0100 Received: from kretschmer by a-kretschmer.de with local (Exim 4.61) (envelope-from ) id 1GtoT6-0003HB-10 for pgsql-performance@postgresql.org; Mon, 11 Dec 2006 17:57:32 +0100 Date: Mon, 11 Dec 2006 17:57:32 +0100 From: Andreas Kretschmer To: pgsql-performance@postgresql.org Subject: Re: really quick multiple inserts can use COPY? Message-ID: <20061211165731.GA11970@KanotixBox> References: Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-OS: Debian/GNU Linux - weil ich es mir Wert bin! X-GPG-Fingerprint: EE16 3C01 7B9C 10F7 2C8B 3B86 4DB3 D9EE 7F45 84DA X-Message-Flag: "Windows" is not the answer. "Windows" is the question and the answer is "no"! X-Lugdd: Gerd Kube X-Info: My name is root. Just root. And I am licensed to kill -9 User-Agent: mutt-ng 1.5.9i (Linux) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200612/243 X-Sequence-Number: 22299 Jens Schipkowski schrieb: > Hello! > > In our JAVA application we do multiple inserts to a table by data from a > Hash Map. Due to poor database access implemention - done by another > company (we got the job to enhance the software) - we cannot use prepared > statements. (We are not allowed to change code at database access!) > First, we tried to fire one INSERT statement per record to insert. This > costs 3 ms per row which is to slow because normally we insert 10.000 > records which results in 30.000 ms just for inserts. Can you change this from INSERT-Statements to COPY? Copy is *much* faster than INSERT. If no, do you using all INSERTs in one transaction? I believe, a 'BEGIN' and a 'COMMIT' around all INSERTs may increase the speed. Andreas -- Really, I'm not out to destroy Microsoft. That will just be a completely unintentional side effect. (Linus Torvalds) "If I was god, I would recompile penguin with --enable-fly." (unknow) Kaufbach, Saxony, Germany, Europe. N 51.05082°, E 13.56889°