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 6BA9BD1B1A0 for ; Sat, 10 Jul 2004 00:10:02 -0300 (ADT) 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 27573-03 for ; Sat, 10 Jul 2004 03:10:07 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id ED1DBD1B23F for ; Sat, 10 Jul 2004 00:09:59 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.11/8.12.11) with ESMTP id i6A3A4K7002133; Fri, 9 Jul 2004 23:10:04 -0400 (EDT) To: Eugene Cc: pgsql-performance@postgresql.org Subject: Re: Forcing HashAggregation prior to index scan? In-reply-to: <20040705231434.81471.qmail@web50708.mail.yahoo.com> References: <20040705231434.81471.qmail@web50708.mail.yahoo.com> Comments: In-reply-to Eugene message dated "Mon, 05 Jul 2004 16:14:34 -0700" Date: Fri, 09 Jul 2004 23:10:04 -0400 Message-ID: <2132.1089429004@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200407/56 X-Sequence-Number: 7447 Eugene writes: > Can I force HashAggregation before index scan? No. But look into why the planner's rows estimate is so bad here: > -> Index Scan using refseq_sequence_key2 on refseq_sequence s (cost=0.00..1516.06 rows=389 > width=24) (actual time=0.352..491.107 rows=27391 loops=1) > Index Cond: ((species)::text = 'Homo sapiens'::text) Have you ANALYZEd this table recently? If so, maybe you need a larger statistics target for the species column. The estimated row count shouldn't be off by a factor of seventy... regards, tom lane