Marti Raudsepp <marti(at)juffo(dot)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