Re: BUG #6483: Rows being evaluated, although being outside the LIMIT / OFFSET boundaries - Mailing list pgsql-bugs

From Tom Lane
Subject Re: BUG #6483: Rows being evaluated, although being outside the LIMIT / OFFSET boundaries
Date
Msg-id 14925.1330013895@sss.pgh.pa.us
Whole thread Raw
In response to Re: BUG #6483: Rows being evaluated, although being outside the LIMIT / OFFSET boundaries  (Marti Raudsepp <marti@juffo.org>)
List pgsql-bugs
Marti Raudsepp <marti@juffo.org> writes:
> AFAICT, the model in the documentation suggests that the SELECT fields
> are evaluated for all matching rows in indeterminate order, before
> ORDER BY is applied and before the result set is sliced by
> OFFSET/LIMIT.

That is in fact the case if you have a query plan that involves a Sort
node followed by Limit.  We have some optimizations that avoid the need
for an explicit sort, but it would be pretty hard to write a
specification for exactly when unretrieved rows will not be evaluated.

            regards, tom lane

pgsql-bugs by date:

Previous
From: Kouber Saparev
Date:
Subject: Re: BUG #6483: Rows being evaluated, although being outside the LIMIT / OFFSET boundaries
Next
From: Tom Lane
Date:
Subject: Re: BUG #6485: Primary index key not updated uniformly