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 02F86DA206; Wed, 5 Oct 2005 20:55:59 -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 59628-10; Wed, 5 Oct 2005 23:55:54 +0000 (GMT) Received: from mail.mi8.com (d01gw02.mi8.com [63.240.6.46]) by svr1.postgresql.org (Postfix) with ESMTP id D6138DA207; Wed, 5 Oct 2005 20:55:54 -0300 (ADT) Received: from 172.16.1.118 by mail.mi8.com with ESMTP (- Welcome to Mi8 Corporation www.Mi8.com (D2)); Wed, 05 Oct 2005 19:55:53 -0400 X-Server-Uuid: 7829E76E-BB9E-4995-8473-3C0929DF7DD1 Received: from MI8NYCMAIL06.Mi8.com ([172.16.1.175]) by d01smtp03.Mi8.com with Microsoft SMTPSVC(6.0.3790.1830); Wed, 5 Oct 2005 19:55:53 -0400 Received: from 67.103.45.218 ([67.103.45.218]) by MI8NYCMAIL06.Mi8.com ( [172.16.1.219]) via Exchange Front-End Server mi8owa.mi8.com ( [172.16.1.104]) with Microsoft Exchange Server HTTP-DAV ; Wed, 5 Oct 2005 19:55:53 -0500 User-Agent: Microsoft-Entourage/11.2.0.050811 Date: Wed, 05 Oct 2005 16:55:51 -0700 Subject: Re: [HACKERS] A Better External Sort? From: "Luke Lonergan" To: "Michael Stone" Cc: pgsql-hackers@postgresql.org, pgsql-performance@postgresql.org Message-ID: Thread-Topic: [HACKERS] [PERFORM] A Better External Sort? Thread-Index: AcXKCFCOjxWPyjX7EdqbagANk63kWA== In-Reply-To: <20051005153349.GZ2241@mathom.us> MIME-Version: 1.0 X-OriginalArrivalTime: 05 Oct 2005 23:55:53.0721 (UTC) FILETIME=[522DCE90:01C5CA08] X-WSS-ID: 6F5AB7834P81223849-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.573 required=5 tests=[AWL=-0.008, FORGED_RCVD_HELO=0.05, RCVD_NUMERIC_HELO=1.531] X-Spam-Level: * X-Archive-Number: 200510/118 X-Sequence-Number: 14886 Michael, On 10/5/05 8:33 AM, "Michael Stone" wrote: > real 0m8.889s > user 0m0.877s > sys 0m8.010s > > it's not in disk wait state (in fact the whole read was cached) but it's > only getting 1MB/s. You've proven my point completely. This process is bottlenecked in the CPU. The only way to improve it would be to optimize the system (libc) functions like "fread" where it is spending most of it's time. In COPY, we found lots of libc functions like strlen() being called ridiculous numbers of times, in one case it was called on every timestamp/date attribute to get the length of TZ, which is constant. That one function call was in the system category, and was responsible for several percent of the time. By the way, system routines like fgetc/getc/strlen/atoi etc, don't appear in gprof profiles of dynamic linked objects, nor by default in oprofile results. If the bottleneck is in I/O, you will see the time spent in disk wait, not in system. - Luke