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 B6B1F56440 for ; Thu, 17 Mar 2005 02:29:34 +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 08622-10 for ; Thu, 17 Mar 2005 02:29:24 +0000 (GMT) Received: from stark.xeocode.com (stark.xeocode.com [216.58.44.227]) by svr1.postgresql.org (Postfix) with ESMTP id 8200752A62 for ; Thu, 17 Mar 2005 02:29:23 +0000 (GMT) Received: from localhost ([127.0.0.1] helo=stark.xeocode.com) by stark.xeocode.com with smtp (Exim 3.36 #1 (Debian)) id 1DBkl7-0002Qy-00; Wed, 16 Mar 2005 21:29:13 -0500 To: Laurent Martelli Cc: PFC , pgsql-performance@postgresql.org Subject: Re: Speeding up select distinct References: <87k6o74gms.fsf@stan.aopsys> <87fyyv4f6l.fsf@stan.aopsys> In-Reply-To: <87fyyv4f6l.fsf@stan.aopsys> From: Greg Stark Organization: The Emacs Conspiracy; member since 1992 Date: 16 Mar 2005 21:29:13 -0500 Message-ID: <87ekefj98m.fsf@stark.xeocode.com> Lines: 16 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 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.018 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200503/345 X-Sequence-Number: 11050 Laurent Martelli writes: > PFC> SELECT owner from pictures group by owner; > > That's a slight improvement, but there's still a seq scan on pictures: It should be a sequential scan. An index will be slower. > 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 That's the best plan for this query. -- greg