Received: from localhost (maia-1.hub.org [200.46.204.191]) by postgresql.org (Postfix) with ESMTP id 158609FBE0B for ; Tue, 17 Jul 2007 17:59:03 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.191]) (amavisd-maia, port 10024) with ESMTP id 48340-09 for ; Tue, 17 Jul 2007 17:59:00 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from vms048pub.verizon.net (vms048pub.verizon.net [206.46.252.48]) by postgresql.org (Postfix) with ESMTP id 3BE019FBDF7 for ; Tue, 17 Jul 2007 17:59:00 -0300 (ADT) Received: from osgiliath.mathom.us ([72.66.0.221]) by vms048.mailsrvcs.net (Sun Java System Messaging Server 6.2-6.01 (built Apr 3 2006)) with ESMTPA id <0JLC00GPFCXQYOLE@vms048.mailsrvcs.net> for pgsql-performance@postgresql.org; Tue, 17 Jul 2007 15:58:39 -0500 (CDT) Received: from localhost (localhost [127.0.0.1]) by osgiliath.mathom.us (Postfix) with ESMTP id 2FB3D7155B; Tue, 17 Jul 2007 16:58:37 -0400 (EDT) Received: from osgiliath.mathom.us ([127.0.0.1]) by localhost (osgiliath.home.mathom.us [127.0.0.1]) (amavisd-new, port 10024) with LMTP id UqyPQN0RbmiE; Tue, 17 Jul 2007 16:58:35 -0400 (EDT) Received: by osgiliath.mathom.us (Postfix, from userid 1000) id 8D7D51F80E; Tue, 17 Jul 2007 16:58:35 -0400 (EDT) Date: Tue, 17 Jul 2007 16:58:35 -0400 From: Michael Stone Subject: Re: insert vs select into performance In-reply-to: <469D2B8E.7050208@ifi.uio.no> To: Thomas Finneid Cc: pgsql-performance@postgresql.org Mail-followup-to: Thomas Finneid , pgsql-performance@postgresql.org Message-id: <20070717205832.GB12481@mathom.us> MIME-version: 1.0 Content-type: text/plain; charset=us-ascii; format=flowed Content-disposition: inline X-Virus-Scanned: Debian amavisd-new at mathom.us X-Pgp-Fingerprint: 53 FF 38 00 E7 DD 0A 9C 84 52 84 C5 EE DF 7C 88 References: <469D1AD3.9030004@ifi.uio.no> <0D6011B2-D09F-45E8-A5D7-5F84ADD1DC2B@seespotcode.net> <469D2B8E.7050208@ifi.uio.no> User-Agent: Mutt/1.5.13 (2006-08-11) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200707/196 X-Sequence-Number: 25880 On Tue, Jul 17, 2007 at 10:50:22PM +0200, Thomas Finneid wrote: >I havent done this test in a stored function yet, nor have I tried it >with a C client so far, so there is the chance that it is java/jdbc that >makes the insert so slow. I'll get to that test soon if there is any >chance my theory makes sence. What you're seeing is perfectly normal. Switch to COPY for fast inserts. (When you use inserts you need to wait for a round-trip for each row, instead of sending data to the server as fast as possible.) Mike Stone