Re: Optimizing DISTINCT with LIMIT - Mailing list pgsql-hackers

From tmp
Subject Re: Optimizing DISTINCT with LIMIT
Date
Msg-id gh9bcj$2o2q$1@news.hub.org
Whole thread Raw
In response to Re: Optimizing DISTINCT with LIMIT  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Optimizing DISTINCT with LIMIT  (Gregory Stark <stark@enterprisedb.com>)
List pgsql-hackers
> 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.

Regarding whether it's worth the effort: In each of my three past jobs 
(all using postgresql) I have met several queries that would fetch a 
small subset of a large - even huge - input. I think that types of 
queries are relatively common out there, but if they are executed for 
e.g. a web-client it is simply a no-go with the current late LIMIT 
evaluation.

Also, it is my impression that many people use LIMIT to minimize the 
evaluation time of sub queries from which the outer query only needs a 
small subset of the sub query output.


pgsql-hackers by date:

Previous
From: "Joshua D. Drake"
Date:
Subject: Re: Simple postgresql.conf wizard
Next
From: David Fetter
Date:
Subject: Re: [patch] pg_upgrade script for 8.3->8.4