Heikki Linnakangas <[EMAIL PROTECTED]> writes: > Gregory Stark wrote: >> You mean like this? >> >> postgres=# explain select distinct x from i limit 5; >> QUERY PLAN >> ------------------------------------------------------------------- >> Limit (cost=54.50..54.51 rows=1 width=304) >> -> HashAggregate (cost=54.50..54.51 rows=1 width=304) >> -> Seq Scan on i (cost=0.00..52.00 rows=1000 width=304) >> (3 rows)
> Does that know to stop scanning as soon as it has seen 5 distinct values? In principle, if there are no aggregate functions, then nodeAgg could return a row immediately upon making any new entry into the hash table. Whether it's worth the code uglification is debatable ... I think it would require a third major pathway through nodeAgg. regards, tom lane -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers