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 786B2D6EBC for ; Thu, 24 Nov 2005 04:18:48 -0400 (AST) 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 73364-07 for ; Thu, 24 Nov 2005 08:18:47 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.mi8.com (d01gw04.mi8.com [63.240.6.44]) by svr1.postgresql.org (Postfix) with ESMTP id 2E5E3DAD64 for ; Thu, 24 Nov 2005 04:18:43 -0400 (AST) Received: from 172.16.1.112 by mail.mi8.com with ESMTP (- Welcome to Mi8 Corporation www.Mi8.com (D4)); Thu, 24 Nov 2005 03:18:38 -0500 X-Server-Uuid: C8FB4D43-1108-484A-A898-3CBCC7906230 Received: from MI8NYCMAIL06.Mi8.com ([172.16.1.175]) by D01SMTP02.Mi8.com with Microsoft SMTPSVC(6.0.3790.211); Thu, 24 Nov 2005 03:17:08 -0500 Received: from 208.54.15.129 ([208.54.15.129]) 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 ; Thu, 24 Nov 2005 03:17:07 -0500 User-Agent: Microsoft-Entourage/11.2.1.051004 Date: Thu, 24 Nov 2005 00:17:06 -0800 Subject: Re: Hardware/OS recommendations for large databases ( From: "Luke Lonergan" To: "Mark Kirkwood" cc: stange@rentec.com, "Greg Stark" , "Dave Cramer" , "Joshua Marsh" , pgsql-performance@postgresql.org Message-ID: Thread-Topic: [PERFORM] Hardware/OS recommendations for large databases ( Thread-Index: AcXvIxdwfLDwWrP8Q669kHxJ85F1twBrF12i In-Reply-To: <4382A840.3030401@paradise.net.nz> MIME-Version: 1.0 X-OriginalArrivalTime: 24 Nov 2005 08:17:08.0129 (UTC) FILETIME=[762A0910:01C5F0CF] X-WSS-ID: 6F9BA8D72UO3042572-06-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, score=2.396 required=5 tests=[AWL=-0.093, RCVD_IN_SORBS_WEB=1.236, RCVD_NUMERIC_HELO=1.253] X-Spam-Score: 2.396 X-Spam-Level: ** X-Archive-Number: 200511/482 X-Sequence-Number: 15739 Mark, See the results below and analysis - the pure HeapScan gets 94.1% of the max available read bandwidth (cool!). Nothing wrong with heapscan in the presence of large readahead, which is good news. That says it's something else in the path. As you probably know there is a page lock taken, a copy of the tuple from the page, lock removed, count incremented for every iteration of the agg node on a count(*). Is the same true of a count(1)? I recall that the profile is full of memcpy and memory context calls. It would be nice to put some tracers into the executor and see where the time is going. I'm also curious about the impact of the new 8.1 virtual tuples in reducing the executor overhead. In this case my bet's on the agg node itself, what do you think? - Luke On 11/21/05 9:10 PM, "Mark Kirkwood" wrote: > Luke Lonergan wrote: > >> So that leaves the question - why not more than 64% of the I/O scan rate? >> And why is it a flat 64% as the I/O subsystem increases in speed from >> 333-400MB/s? >> > > It might be interesting to see what effect reducing the cpu consumption > entailed by the count aggregation has - by (say) writing a little bit > of code to heap scan the desired relation (sample attached). OK - here are results for a slightly smaller (still bigger than RAM) lineitem on the same machine, using the same xfs filesystem that achieved 407MB/s: ============================================================================ 12.9GB of DBT-3 data from the lineitem table ============================================================================ llonergan=# select relpages from pg_class where relname='lineitem'; relpages ---------- 1579270 (1 row) 1579270*8192/1000000 12937 Million Bytes or 12.9GB llonergan=# \timing Timing is on. llonergan=# select count(1) from lineitem; count ---------- 59986052 (1 row) Time: 197870.105 ms llonergan=# select count(1) from lineitem; count ---------- 59986052 (1 row) Time: 49912.164 ms llonergan=# select count(1) from lineitem; count ---------- 59986052 (1 row) Time: 49218.739 ms llonergan=# select fastcount('lineitem'); fastcount ----------- 59986052 (1 row) Time: 33752.778 ms llonergan=# select fastcount('lineitem'); fastcount ----------- 59986052 (1 row) Time: 34543.646 ms llonergan=# select fastcount('lineitem'); fastcount ----------- 59986052 (1 row) Time: 34528.053 ms ============================================================================ Analysis: ============================================================================ Bandwidth Percent of max dd Read 407MB/s 100% Count(1) 263MB/s 64.6% HeapScan 383MB/s 94.1% Wow - looks like the HeapScan gets almost all of the available bandwidth! - Luke