X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 34BEA9DCBAF for ; Mon, 28 Nov 2005 12:27:15 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 65197-05 for ; Mon, 28 Nov 2005 12:27:12 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.mi8.com (d01gw04.mi8.com [63.240.6.44]) by postgresql.org (Postfix) with ESMTP id F26739DCB0B for ; Mon, 28 Nov 2005 12:27:11 -0400 (AST) Received: from 172.16.1.110 by mail.mi8.com with ESMTP (- Welcome to Mi8 Corporation www.Mi8.com (D4)); Mon, 28 Nov 2005 11:26:54 -0500 X-Server-Uuid: C8FB4D43-1108-484A-A898-3CBCC7906230 Received: from MI8NYCMAIL06.Mi8.com ([172.16.1.160]) by D01SMTP01.Mi8.com with Microsoft SMTPSVC(6.0.3790.211); Mon, 28 Nov 2005 11:26:21 -0500 Received: from 69.181.100.71 ([69.181.100.71]) 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 ; Mon, 28 Nov 2005 16:26:21 +0000 User-Agent: Microsoft-Entourage/11.2.1.051004 Date: Mon, 28 Nov 2005 08:26:21 -0800 Subject: Re: Hardware/OS recommendations for large databases ( From: "Luke Lonergan" To: pgsql-performance@postgresql.org cc: "eng@intranet.greenplum.com" Message-ID: Thread-Topic: [PERFORM] Hardware/OS recommendations for large databases ( Thread-Index: AcXvIxdwfLDwWrP8Q669kHxJ85F1twBrF12iABLTyBIAx2zelg== In-Reply-To: MIME-Version: 1.0 X-OriginalArrivalTime: 28 Nov 2005 16:26:21.0905 (UTC) FILETIME=[7807CC10:01C5F438] X-WSS-ID: 6F95F0402UO7731728-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, score=1.253 required=5 tests=[AWL=0.000, RCVD_NUMERIC_HELO=1.253] X-Spam-Score: 1.253 X-Spam-Level: * X-Archive-Number: 200511/537 X-Sequence-Number: 15794 The MPP test I ran was with the release version 2.0 of MPP which is based on Postgres 8.0, the upcoming 2.1 release is based on 8.1, and 8.1 is far faster at seq scan + agg. 12,937MB were counted in 4.5 seconds, or 2890MB/s from I/O cache. That's 722MB/s per host, and 360MB/s per Postgres instance, up from 267 previously with 8.0.3. I'm going to apply Tom's pre-8.2 seq scan locking optimization and see how much better we can get! - Luke ========================================================== Bizgres MPP CVS tip (2.1 pre), 8 data segments, 1 per CPU ========================================================== llonergan=# \timing Timing is on. llonergan=# explain select count(1) from lineitem; QUERY PLAN -------------------------------------------------------------------------- Aggregate (cost=0.01..0.01 rows=1 width=0) -> Gather Motion (cost=0.01..0.01 rows=1 width=0) -> Aggregate (cost=0.01..0.01 rows=1 width=0) -> Seq Scan on lineitem (cost=0.00..0.00 rows=1 width=0) (4 rows) Time: 1.464 ms llonergan=# select count(1) from lineitem; count ---------- 59986052 (1 row) Time: 4478.563 ms llonergan=# select count(1) from lineitem; count ---------- 59986052 (1 row) Time: 4550.917 ms llonergan=# select count(1) from lineitem; count ---------- 59986052 (1 row) Time: 4482.261 ms On 11/24/05 9:16 AM, "Luke Lonergan" wrote: > The same 12.9GB distributed across 4 machines using Bizgres MPP fits into > I/O cache. The interesting result is that the query "select count(1)" is > limited in speed to 280 MB/s per CPU when run on the lineitem table. So > when I run it spread over 4 machines, one CPU per machine I get this: > > ====================================================== > Bizgres MPP, 4 data segments, 1 per 2 CPUs > ====================================================== > llonergan=# explain select count(1) from lineitem; > QUERY PLAN > ---------------------------------------------------------------------------- > ---------- > Aggregate (cost=582452.00..582452.00 rows=1 width=0) > -> Gather Motion (cost=582452.00..582452.00 rows=1 width=0) > -> Aggregate (cost=582452.00..582452.00 rows=1 width=0) > -> Seq Scan on lineitem (cost=0.00..544945.00 rows=15002800 > width=0) > (4 rows) > > llonergan=# \timing > Timing is on. > llonergan=# select count(1) from lineitem; > count > ---------- > 59986052 > (1 row) > > Time: 12191.435 ms > llonergan=# select count(1) from lineitem; > count > ---------- > 59986052 > (1 row) > > Time: 11986.109 ms > llonergan=# select count(1) from lineitem; > count > ---------- > 59986052 > (1 row) > > Time: 11448.941 ms > ====================================================== > > That's 12,937 MB in 11.45 seconds, or 1,130 MB/s. When you divide out the > number of Postgres instances (4), that's 283MB/s per Postgres instance. > > To verify that this has nothing to do with MPP, I ran it in a special > internal mode on one instance and got the same result. > > So - we should be able to double this rate by running one segment per CPU, > or two per host: > > ====================================================== > Bizgres MPP, 8 data segments, 1 per CPU > ====================================================== > llonergan=# select count(1) from lineitem; > count > ---------- > 59986052 > (1 row) > > Time: 6484.594 ms > llonergan=# select count(1) from lineitem; > count > ---------- > 59986052 > (1 row) > > Time: 6156.729 ms > llonergan=# select count(1) from lineitem; > count > ---------- > 59986052 > (1 row) > > Time: 6063.416 ms > ====================================================== > That's 12,937 MB in 11.45 seconds, or 2,134 MB/s. When you divide out the > number of Postgres instances (8), that's 267MB/s per Postgres instance. > > So, if you want to "select count(1)", using more CPUs is a good idea! For > most complex queries, having lots of CPUs + MPP is a good combo. > > Here is an example of a sorting plan - this should probably be done with a > hash aggregation, but using 8 CPUs makes it go 8x faster: > > ====================================================== > Bizgres MPP, 8 data segments, 1 per CPU > ====================================================== > llonergan=# \timing > Timing is on. > llonergan=# explain select l_orderkey from lineitem order by l_shipdate, > l_extendedprice limit 10; > QUERY PLAN > ---------------------------------------------------------------------------- > ----- > Limit (cost=0.01..0.02 rows=1 width=24) > -> Gather Motion (cost=0.01..0.02 rows=1 width=24) > Merge Key: l_shipdate, l_extendedprice > -> Limit (cost=0.01..0.02 rows=1 width=24) > -> Sort (cost=0.01..0.02 rows=1 width=24) > Sort Key: l_shipdate, l_extendedprice > -> Seq Scan on lineitem (cost=0.00..0.00 rows=1 > width=24) > (7 rows) > > Time: 0.592 ms > llonergan=# select l_orderkey from lineitem order by l_shipdate, > l_extendedprice limit 10; > l_orderkey > ------------ > 51829667 > 26601603 > 16579717 > 40046023 > 41707078 > 22880928 > 35584422 > 31272229 > 49914018 > 42309990 > (10 rows) > > Time: 93469.443 ms > > ====================================================== > > So that's 60M rows and 12.9GB sorted in 93.5 seconds. > > - Luke > >