X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 2036C32AEA9 for ; Wed, 20 Oct 2004 03:17:27 +0100 (BST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 93420-09 for ; Wed, 20 Oct 2004 02:17:22 +0000 (GMT) Received: from tht.net (vista.tht.net [216.126.88.2]) by svr1.postgresql.org (Postfix) with ESMTP id E2EAE32AEAC for ; Wed, 20 Oct 2004 03:17:25 +0100 (BST) Received: from [134.22.69.212] (dyn-69-212.tor.dsl.tht.net [134.22.69.212]) by tht.net (Postfix) with ESMTP id 326DD76B52; Tue, 19 Oct 2004 22:13:27 -0400 (EDT) Subject: Re: Insert performance, what should I expect? From: Rod Taylor To: Brock Henry Cc: Postgresql Performance In-Reply-To: <97b3fe2041019185337a8c3d8@mail.gmail.com> References: <97b3fe2041019185337a8c3d8@mail.gmail.com> Content-Type: text/plain Message-Id: <1098238348.747.20.camel@home> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.6 Date: Tue, 19 Oct 2004 22:12:28 -0400 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200410/304 X-Sequence-Number: 8780 > I've done some manual benchmarking running my script 'time script.pl' > I realise my script uses some of the time, bench marking shows that > %50 of the time is spent in dbd:execute. The perl drivers don't currently use database level prepared statements which would give a small boost. But your best bet is to switch to using COPY instead of INSERT. Two ways to do this. 1) Drop DBD::Pg and switch to the Pg driver for Perl instead (non-DBI compliant) which has functions similar to putline() that allow COPY to be used. 2) Have your perl script output a .sql file with the data prepared (COPY statements) which you feed into the database via psql. You can probably achieve a 50% increase in throughput.