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 8559D56960 for ; Wed, 16 Mar 2005 18:30:10 +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 97732-02 for ; Wed, 16 Mar 2005 18:30:04 +0000 (GMT) Received: from stan.aopsys (aopsysadsl.net1.nerim.net [62.212.101.94]) by svr1.postgresql.org (Postfix) with ESMTP id E04945692E for ; Wed, 16 Mar 2005 18:30:01 +0000 (GMT) Received: from [127.0.0.1] (helo=localhost ident=laurent) by stan.aopsys with esmtp (Exim 4.44) id 1DBdHG-0001U1-JQ; Wed, 16 Mar 2005 19:29:54 +0100 To: PFC Cc: pgsql-performance@postgresql.org Subject: Re: Speeding up select distinct References: <87k6o74gms.fsf@stan.aopsys> From: Laurent Martelli Organization: AOPSYS Date: Wed, 16 Mar 2005 19:29:54 +0100 In-Reply-To: (lists@boutiquenumerique.com's message of "Wed, 16 Mar 2005 19:07:21 +0100") Message-ID: <87fyyv4f6l.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=FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200503/335 X-Sequence-Number: 11040 Wow, what a fast response !!! >>>>> "PFC" == PFC writes: PFC> Try : PFC> SELECT owner from pictures group by owner; That's a slight improvement, but there's still a seq scan on pictures: HashAggregate (cost=114.38..114.38 rows=21 width=4) (actual time=7.585..7.605 rows=21 loops=1) -> Seq Scan on pictures (cost=0.00..103.70 rows=4270 width=4) (actual time=0.015..3.272 rows=4270 loops=1) Total runtime: 7.719 ms -- Laurent Martelli laurent@aopsys.com Java Aspect Components http://www.aopsys.com/ http://jac.objectweb.org