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 BCE7FD6FEC for ; Mon, 22 Aug 2005 19:37:25 -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 70495-07 for ; Mon, 22 Aug 2005 22:37:24 +0000 (GMT) Received: from hotmail.com (bay101-f22.bay101.hotmail.com [64.4.56.32]) by svr1.postgresql.org (Postfix) with ESMTP id 7E912D6D78 for ; Mon, 22 Aug 2005 19:37:22 -0300 (ADT) Received: from mail pickup service by hotmail.com with Microsoft SMTPSVC; Mon, 22 Aug 2005 15:37:21 -0700 Message-ID: Received: from 64.4.56.205 by by101fd.bay101.hotmail.msn.com with HTTP; Mon, 22 Aug 2005 22:37:21 GMT X-Originating-IP: [64.4.56.205] X-Originating-Email: [jigneshk@hotmail.com] X-Sender: jigneshk@hotmail.com In-Reply-To: <16259.1124725300@sss.pgh.pa.us> From: "Jignesh Shah" To: tgl@sss.pgh.pa.us Cc: pgsql-performance@postgresql.org Subject: Re: MemoryContextSwitchTo during table scan? Date: Mon, 22 Aug 2005 18:37:21 -0400 Mime-Version: 1.0 Content-Type: text/plain; format=flowed X-OriginalArrivalTime: 22 Aug 2005 22:37:21.0434 (UTC) FILETIME=[0F42DFA0:01C5A76A] X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=2.228 required=5 tests=[AWL=0.478, DNS_FROM_RFC_ABUSE=0.374, DNS_FROM_RFC_POST=1.376, MSGID_FROM_MTA_HEADER=0] X-Spam-Level: ** X-Archive-Number: 200508/329 X-Sequence-Number: 14076 Hi Tom, Like I mentioned I am using DTrace on Solaris 10 x64 and not gprof. DTrace is not based on sampling but actual entry/exit point. Ofcourse my 10 second profile is just a sample that I can assure you is representative of the query since it is a very simple query that does simple table scan. (I am taken profiles at different times of the queries all giving similar outputs) In case of DTrace I am actually measuring "wall clock" for leaf functions. For more information on DTrace please refer to: http://docs.sun.com/app/docs/doc/817-6223/6mlkidlf1?a=view Regards, Jignesh ----Original Message Follows---- From: Tom Lane To: "Jignesh Shah" CC: pgsql-performance@postgresql.org Subject: Re: [PERFORM] MemoryContextSwitchTo during table scan? Date: Mon, 22 Aug 2005 11:41:40 -0400 "Jignesh Shah" writes: > Running a script (available on my blog) I find the following top 5 functions > where it spends most time during a 10 second run of the script It's pretty risky to draw conclusions from only 10 seconds' worth of gprof data --- that's only 1000 samples total at the common sampling rate of 100/sec. If there's one function eating 90% of the runtime, you'll find out, but you don't have enough data to believe that you know what is happening with resolution of a percent or so. I generally try to accumulate several minutes worth of CPU time in a gprof run. > 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. regards, tom lane