X-Original-To: pgsql-performance-postgresql.org@postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id 4EA939FA5BE for ; Thu, 15 Jun 2006 16:26:50 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 40704-04 for ; Thu, 15 Jun 2006 16:26:42 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from exchange.g2switchworks.com (mail.g2switchworks.com [63.87.162.25]) by postgresql.org (Postfix) with ESMTP id 254C09FA13E for ; Thu, 15 Jun 2006 16:26:41 -0300 (ADT) Received: from 10.10.1.37 ([10.10.1.37]) by exchange.g2switchworks.com ([10.10.1.2]) with Microsoft Exchange Server HTTP-DAV ; Thu, 15 Jun 2006 19:26:39 +0000 Received: from state.g2switchworks.com by mail.g2switchworks.com; 15 Jun 2006 14:26:39 -0500 Subject: Re: Optimizer internals From: Scott Marlowe To: pgsql-performance@lusis.org Cc: Mark Lewis , PGSQL Performance In-Reply-To: References: <1150396425.31200.66.camel@archimedes> <1150398064.31200.76.camel@archimedes> Content-Type: text/plain Content-Transfer-Encoding: 7bit Message-Id: <1150399599.26538.90.camel@state.g2switchworks.com> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.6 (1.4.6-2) Date: Thu, 15 Jun 2006 14:26:39 -0500 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200606/325 X-Sequence-Number: 19682 On Thu, 2006-06-15 at 14:21, John Vincent wrote: > On 6/15/06, Mark Lewis wrote: > Unfortunately SUM is in the same boat as COUNT; in order for > it to > return a meaningful result it must inspect visibility > information for > all of the rows. > > -- Mark > > We'll this is interesting news to say the least. We went with > PostgreSQL for our warehouse because we needed the advanced features > that MySQL didn't have at the time (views/sprocs). > > It sounds like we almost need another fact table for the places that > we do SUM (which is not a problem just an additional map. If I'm > interpreting this all correctly, we can't force PG to bypass a > sequence scan even if we know our data is stable because of the MVCC > aspect. In our case, as with most warehouses (except those that do > rolling loads during the day), we only write data to it for about 5 > hours at night in batch. > > Any suggestions? FYI the original question wasn't meant as a poke at > comparing PG to MySQL to DB2. I'm not making an yvalue judgements > either way. I'm just trying to understand how we can use it the best > way possible. > > If anyone from the bizgres team is watching, have they done any work > in this area? This might help: http://jonathangardner.net/PostgreSQL/materialized_views/matviews.html Since you're doing a data warehouse, I would think materialized views would be a natural addition anyway.