Casey Duncan <[EMAIL PROTECTED]> writes: > select st_id, min(seed_id) as "initial_seed_id", count(*) as > "seed_count" from seed group by st_id;
> The query plan and table stats are: > QUERY PLAN > ----------------------------------------------------------------------- > HashAggregate (cost=1362694.83..1365164.68 rows=164656 width=16) > -> Seq Scan on seed (cost=0.00..964065.62 rows=53150562 width=16) How many distinct st_id values are there really? The planner's evidently expecting 164656 but I suppose that's wrong? What's in pg_stats for st_id? regards, tom lane ---------------------------(end of broadcast)--------------------------- TIP 9: In versions below 8.0, the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match