X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 4AEACD92CC for ; Fri, 23 Sep 2005 12:31:31 -0300 (ADT) 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 00171-01 for ; Fri, 23 Sep 2005 15:31:21 +0000 (GMT) Received: from vms044pub.verizon.net (vms044pub.verizon.net [206.46.252.44]) by svr1.postgresql.org (Postfix) with ESMTP id 2E0B0D9298 for ; Fri, 23 Sep 2005 12:31:19 -0300 (ADT) Received: from osgiliath.mathom.us ([70.108.61.78]) by vms044.mailsrvcs.net (Sun Java System Messaging Server 6.2 HotFix 0.04 (built Dec 24 2004)) with ESMTPA id <0INA000TT0G68MC0@vms044.mailsrvcs.net> for pgsql-performance@postgresql.org; Fri, 23 Sep 2005 10:31:19 -0500 (CDT) Received: from localhost (localhost [127.0.0.1]) by osgiliath.mathom.us (Postfix) with ESMTP id A396C637C2A for ; Fri, 23 Sep 2005 11:31:18 -0400 (EDT) Received: from osgiliath.mathom.us ([127.0.0.1]) by localhost (osgiliath [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 16449-02-8 for ; Fri, 23 Sep 2005 11:31:18 -0400 (EDT) Received: by osgiliath.mathom.us (Postfix, from userid 1000) id 85AC3637C28; Fri, 23 Sep 2005 11:31:18 -0400 (EDT) Date: Fri, 23 Sep 2005 11:31:18 -0400 From: Michael Stone Subject: Re: How to determine cause of performance problem? In-reply-to: <1127483365.3524.36.camel@Panoramix> To: pgsql-performance@postgresql.org Mail-Followup-To: pgsql-performance@postgresql.org Message-id: <20050923153118.GB14918@mathom.us> MIME-version: 1.0 Content-type: text/plain; charset=us-ascii; format=flowed Content-disposition: inline X-Pgp-Fingerprint: 53 FF 38 00 E7 DD 0A 9C 84 52 84 C5 EE DF 7C 88 X-Virus-Scanned: by amavisd-new-20030616-p10 (Debian) at mathom.us References: <1127458167.2475.105.camel@Panoramix> <20050923095517.GW14918@mathom.us> <1127470875.3524.17.camel@Panoramix> <20050923110500.GX14918@mathom.us> <1127483365.3524.36.camel@Panoramix> User-Agent: Mutt/1.5.10i X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.004 required=5 tests=[AWL=0.004] X-Spam-Level: X-Archive-Number: 200509/300 X-Sequence-Number: 14608 On Fri, Sep 23, 2005 at 03:49:25PM +0200, Joost Kraaijeveld wrote: >On Fri, 2005-09-23 at 07:05 -0400, Michael Stone wrote: >> Ok, that's great, but you didn't respond to the suggestion of using COPY >> INTO instead of INSERT. >Part of the code I left out are some data conversions (e.g. from >path-to-file to blob, from text to date (not castable because of the >homebrew original format)). I don't believe that I can do these in a SQL >statement, can I (my knowledge of SQL as a langage is not that good)? . >However I will investigate if I can do the conversion in two steps and >check if it is faster. I'm not sure what you're trying to say. You're currently putting rows into the table by calling "INSERT INTO" for each row. The sample code you send could be rewritten to use "COPY INTO" instead. For bulk inserts like you're doing, the copy approach will be a lot faster. Instead of inserting one row, waiting for a reply, and inserting the next row, you just cram data down a pipe to the server. See: http://www.postgresql.org/docs/8.0/interactive/sql-copy.html http://www.faqs.org/docs/ppbook/x5504.htm Mike Stone