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 4DBC4D70A9 for ; Mon, 22 Aug 2005 14:46:48 -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 15349-05 for ; Mon, 22 Aug 2005 17:46:46 +0000 (GMT) Received: from mail.mi8.com (d01gw04.mi8.com [63.240.6.44]) by svr1.postgresql.org (Postfix) with ESMTP id 2F32DD70A8 for ; Mon, 22 Aug 2005 14:46:44 -0300 (ADT) Received: from 172.16.1.118 by mail.mi8.com with ESMTP (- Welcome to Mi8 Corporation www.Mi8.com (D4)); Mon, 22 Aug 2005 13:46:35 -0400 X-Server-Uuid: C8FB4D43-1108-484A-A898-3CBCC7906230 Received: from MI8NYCMAIL06.Mi8.com ([172.16.1.174]) by d01smtp03.Mi8.com with Microsoft SMTPSVC(6.0.3790.1830); Mon, 22 Aug 2005 13:46:34 -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 ; Mon, 22 Aug 2005 13:46:33 -0500 User-Agent: Microsoft-Entourage/11.1.0.040913 Date: Mon, 22 Aug 2005 10:46:33 -0700 Subject: Re: MemoryContextSwitchTo during table scan? From: "Luke Lonergan" To: "Tom Lane" , "Jignesh Shah" Cc: pgsql-performance@postgresql.org Message-ID: In-Reply-To: <16259.1124725300@sss.pgh.pa.us> MIME-Version: 1.0 X-OriginalArrivalTime: 22 Aug 2005 17:46:34.0048 (UTC) FILETIME=[6FCF0C00:01C5A741] X-WSS-ID: 6F14D0F12TG9840475-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.575 required=5 tests=[AWL=-0.006, FORGED_RCVD_HELO=0.05, RCVD_NUMERIC_HELO=1.531] X-Spam-Level: * X-Archive-Number: 200508/323 X-Sequence-Number: 14070 Tom, On 8/22/05 8:41 AM, "Tom Lane" wrote: >> MemoryContextSwitchTo and LockBuffer itself takes 15% of the total time of >> the query. I was expecting "read" to be the slowest part (biggest component) >> but it was way down in the 0.4% level. > > You do know that gprof counts only CPU time, and only user-space CPU > time at that? read() isn't going to show up at all. It's fairly likely > that your test case is I/O bound and that worrying about CPU efficiency > for it is a waste of time anyway. He's running DTRACE, a CPU profiler that uses hardware performance registers, not gprof. BTW, if you statically link your app, you get profiling information for system calls with gprof. Jignesh has been analyzing PG for quite a while, there are definite issues with CPU consuming functions in the data path IMO. This result he reported is one of them on Solaris 10, and possibly on other platforms. We are limited to about 130MB/s of I/O throughput for sequential scan on platforms that can do 240MB/s of sequential 8k block I/O. Though I haven't profiled seqscan, I'd look at Jignesh's results carefully because they correlate with our experience. - Luke