Re: Optimizing DISTINCT with LIMIT

From: tmp <skrald(at)amossen(dot)dk>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Optimizing DISTINCT with LIMIT
Date: 2008-12-04 19:34:44
Message-ID: gh9bcj$2o2q$1@news.hub.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message David Fetter 2008-12-04 19:45:05 Re: [patch] pg_upgrade script for 8.3->8.4
Previous Message Joshua D. Drake 2008-12-04 19:17:25 Re: Simple postgresql.conf wizard