X-Original-To: pgsql-sql-postgresql.org@postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id 2E9AE9FA5DD for ; Thu, 29 Jun 2006 21:51:17 -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 94570-09 for ; Thu, 29 Jun 2006 21:51:13 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from web31809.mail.mud.yahoo.com (web31809.mail.mud.yahoo.com [68.142.207.72]) by postgresql.org (Postfix) with SMTP id 26F329FA382 for ; Thu, 29 Jun 2006 21:51:13 -0300 (ADT) Received: (qmail 45428 invoked by uid 60001); 30 Jun 2006 00:51:11 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=Message-ID:Received:Date:From:Subject:To:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=Y5pqlRXPyQwXw/9dRtAWWW75c0Xs1kK3PVnyXQzTIIKT7anGb8jBm/Vwh8yI7rjD31aH6hKA+zzasrnv8AyKo6KMXOPdKneTUJKbtc8xQ8tyrbpdemxy7j4S985x8qnXBMeSy0HsM61CbPJ5cgQ5IxAVfEganoAUoYtMx0KzyYg= ; Message-ID: <20060630005111.45426.qmail@web31809.mail.mud.yahoo.com> Received: from [24.54.196.198] by web31809.mail.mud.yahoo.com via HTTP; Thu, 29 Jun 2006 17:51:11 PDT Date: Thu, 29 Jun 2006 17:51:11 -0700 (PDT) From: Richard Broersma Jr Subject: Re: SELECT Aggregate To: Phillip Smith , pgsql-sql@postgresql.org In-Reply-To: <004801c69bdd$5b6c4de0$9b0014ac@ITPhil> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200606/326 X-Sequence-Number: 25562 > I've tried Aaron's suggestion of the GROUP BY and I don't know much about > it, but it ran for around 17 hours and still going (it had a dedicated Dual > Xeon 3.0GHz box under RHEL4 running it!) Maybe, this query that you are trying to run is a good candidate for a "Materialize View". http://archives.postgresql.org/pgsql-performance/2004-02/msg00279.php Also before you run your query you might want to see the explain plan is. Perhap it is using a sequencial scan in a place where an index can improve query preformance.