X-Original-To: pgsql-patches-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 9DEB652800 for ; Sun, 7 Aug 2005 02:22:22 -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 78644-03 for ; Sun, 7 Aug 2005 05:22:12 +0000 (GMT) Received: from mail.Mi8.com (d01gw01.mi8.com [63.240.6.47]) by svr1.postgresql.org (Postfix) with ESMTP id 47B0A52903 for ; Sun, 7 Aug 2005 02:22:11 -0300 (ADT) Received: from 172.16.1.112 by mail.Mi8.com with ESMTP (- Welcome to Mi8 Corporation www.Mi8.com (D1)); Sun, 07 Aug 2005 01:21:59 -0400 X-Server-Uuid: 241911D6-425B-44B9-A073-E3FE0F8FC774 Received: from MI8NYCMAIL06.Mi8.com ([172.16.1.175]) by D01SMTP02.Mi8.com with Microsoft SMTPSVC(6.0.3790.211); Sun, 7 Aug 2005 01:21:05 -0400 Received: from 24.5.173.15 ([24.5.173.15]) by MI8NYCMAIL06.Mi8.com ( [172.16.1.219]) via Exchange Front-End Server mi8owa.mi8.com ( [172.16.1.106]) with Microsoft Exchange Server HTTP-DAV ; Sun, 7 Aug 2005 01:21:04 -0500 User-Agent: Microsoft-Entourage/11.1.0.040913 Date: Sat, 06 Aug 2005 22:21:03 -0700 Subject: Re: COPY FROM performance improvements From: "Luke Lonergan" To: "Tom Lane" Cc: "Alon Goldshuv" , pgsql-patches@postgresql.org Message-ID: In-Reply-To: <29007.1123387696@sss.pgh.pa.us> MIME-Version: 1.0 X-OriginalArrivalTime: 07 Aug 2005 05:21:05.0321 (UTC) FILETIME=[CF36B190:01C59B0F] X-WSS-ID: 6EEB45CB2B414402914-01-01 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=1.592 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO, RCVD_NUMERIC_HELO X-Spam-Level: * X-Archive-Number: 200508/51 X-Sequence-Number: 16998 Tom, On 8/6/05 9:08 PM, "Tom Lane" wrote: > "Luke Lonergan" writes: >>> I had some difficulty in generating test cases that weren't largely >>> I/O-bound, but AFAICT the patch as applied is about the same speed >>> as what you submitted. > >> You achieve the important objective of knocking the parsing stage down a >> lot, but your parsing code is actually about 20% slower than Alon's. > > I would like to see the exact test case you are using to make this > claim; the tests I did suggested my code is the same speed or faster. I showed mine - you show yours :-) Apparently our e-mail crossed. > As best I can tell, my version of CopyReadAttributes is significantly > quicker than Alon's, approximately balancing out the fact that my > version of CopyReadLine is slower. I did the latter first, and would > now be tempted to rewrite it in the same style as CopyReadAttributes, > ie one pass of memory-to-memory copy using pointers rather than buffer > indexes. See previous timings - looks like Alon's parsing is substantially faster. However, I'd like him to confirm by running with the "shunt" placed at different stages, in this case between parse and attribute conversion (not attribute parse). > BTW, late today I figured out a way to get fairly reproducible > non-I/O-bound numbers about COPY FROM: use a trigger that suppresses > the actual inserts, thus: > > create table foo ... > create function noway() returns trigger as > 'begin return null; end' language plpgsql; > create trigger noway before insert on foo > for each row execute procedure noway(); > then repeat: > copy foo from '/tmp/foo.data'; Cool! That's a better way than hacking code and inserting shunts. Alon will likely hit this tomorrow. - Luke