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 3900E9FA5FC for ; Fri, 30 Jun 2006 01:48:25 -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 31710-07 for ; Fri, 30 Jun 2006 01:48:17 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from web31805.mail.mud.yahoo.com (web31805.mail.mud.yahoo.com [68.142.207.68]) by postgresql.org (Postfix) with SMTP id 16C3F9FA0EC for ; Fri, 30 Jun 2006 01:48:16 -0300 (ADT) Received: (qmail 60286 invoked by uid 60001); 30 Jun 2006 04:48:15 -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=veDF2CF0TkY7xx6T2ztHDguHc2AI8uXAhkdn0h4P8xbiut+tqndsmpaVzXOFXbgYk0CX0TB/i9zwiHz5hoVmsjnxiyY3cVHRbYADGAVxLnFuykV1YeBsanM8AWwEzOvoIyklDWpIaeaQbM9UiYtVuNAHAu2rEIxctQ+ycAOTB/8= ; Message-ID: <20060630044815.60284.qmail@web31805.mail.mud.yahoo.com> Received: from [24.54.196.198] by web31805.mail.mud.yahoo.com via HTTP; Thu, 29 Jun 2006 21:48:15 PDT Date: Thu, 29 Jun 2006 21:48:15 -0700 (PDT) From: Richard Broersma Jr Subject: Re: SELECT Aggregate To: Phillip Smith , pgsql-sql@postgresql.org In-Reply-To: <006a01c69bf0$97a028f0$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/328 X-Sequence-Number: 25564 > Well whatdyaknow?? Being a Postgres newbie I hadn't even played with indexes > yet. They're awesome!! > Using Richard's suggestion of the Sub-Select in the COLUMN list, combined > with adding some indexes, I can now return this in under 5 seconds! Also, another way to improve preformance will be to analyze the affected tables. Analyze will ensure that the query planner has accurate statics by which it will use in picking fastest possible query. If you ever plan on updating or deleting records. You will also need to vacuum the table. And an additional measure of maintance would be to re-index the database. All of this is listing in the postgresql manual. If you really want to ensure the best possible speeds, it will be an important step to take. Regards, Richard Broersma Jr.