Eugene <emelamud(at)yahoo(dot)com> 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