X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 2503956A37 for ; Wed, 16 Mar 2005 18:31:31 +0000 (GMT) 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 88091-06 for ; Wed, 16 Mar 2005 18:31:28 +0000 (GMT) Received: from stan.aopsys (aopsysadsl.net1.nerim.net [62.212.101.94]) by svr1.postgresql.org (Postfix) with ESMTP id 997E1569D5 for ; Wed, 16 Mar 2005 18:31:22 +0000 (GMT) Received: from [127.0.0.1] (helo=localhost ident=laurent) by stan.aopsys with esmtp (Exim 4.44) id 1DBdIY-0001UE-Mc; Wed, 16 Mar 2005 19:31:14 +0100 To: Rod Taylor Cc: pgsql-performance@postgresql.org Subject: Re: Speeding up select distinct References: <87k6o74gms.fsf@stan.aopsys> <1110996623.1132.244.camel@home> From: Laurent Martelli Organization: AOPSYS Date: Wed, 16 Mar 2005 19:31:14 +0100 In-Reply-To: <1110996623.1132.244.camel@home> (Rod Taylor's message of "Wed, 16 Mar 2005 13:10:23 -0500") Message-ID: <87br9j4f4d.fsf@stan.aopsys> User-Agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/20.7 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.05 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200503/336 X-Sequence-Number: 11041 >>>>> "Rod" == Rod Taylor writes: Rod> On Wed, 2005-03-16 at 18:58 +0100, Laurent Martelli wrote: >> Consider this query: >> >> SELECT distinct owner from pictures; Rod> The performance has nothing to do with the number of rows Rod> returned, but rather the complexity of calculations and amount Rod> of data to sift through in order to find it. Yes, but I thought that an index might be able to know what distinct values there are and help optime that query very much. -- Laurent Martelli laurent@aopsys.com Java Aspect Components http://www.aopsys.com/ http://jac.objectweb.org