Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id C5B5E475EE4 for ; Tue, 14 Jan 2003 13:17:37 -0500 (EST) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by postgresql.org (Postfix) with ESMTP id 3AA5147655A for ; Tue, 14 Jan 2003 13:15:55 -0500 (EST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.6/8.12.6) with ESMTP id h0EIFs5u017343; Tue, 14 Jan 2003 13:15:54 -0500 (EST) To: captainx0r@yahoo.com Cc: pgsql-performance@postgresql.org Subject: Re: Sun vs. Mac In-reply-to: <20030114175004.15074.qmail@web21101.mail.yahoo.com> References: <20030114175004.15074.qmail@web21101.mail.yahoo.com> Comments: In-reply-to CaptainX0r message dated "Tue, 14 Jan 2003 09:50:04 -0800" Date: Tue, 14 Jan 2003 13:15:54 -0500 Message-ID: <17342.1042568154@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200301/98 X-Sequence-Number: 745 CaptainX0r writes: > Well, I've got the Sun box now, but I don't really have acces to > the G3. FWIW, top shows postgres slowly taking up all the CPU - > over the course of a minute or so it gradually ramps up to > around 90%. Once the query is complete, however, top shows the > CPU ramping down slowly, ~1-2% per second over the next 2 > minutes which I find very strange. I believe top's percent-of-CPU numbers for individual processes are time averages over a minute or so, so the ramping effect is unsurprising. > This doesn't really tell me much, except I'm guessing that PG is > CPU bound? Yup, that seems pretty clear. Next step is to find out what the heck it's doing. My instinct would be to use gprof. Recompile with profiling enabled --- if you're using gcc, this should work cd postgres-distribution/src/backend make clean make PROFILE=-pg all make install-bin -- may need to stop postmaster before install Next run some sample queries (put them all into one session). After quitting the session, find gmon.out in the $PGDATA/base/nnn/ subdirectory corresponding to your database, and feed it to gprof. The results should show where the code hotspot is. regards, tom lane