Martijn van Oosterhout <> writes:
> On Wed, Jul 02, 2014 at 04:17:13PM -0400, Tom Lane wrote:
>> It's not so much the limit as that the sort has to happen before the
>> limit, and yes, evaluation of the targetlist happens before the sort.

> I guess I assumed the column c was indexable, and it that case I
> beleive the slowfunction() would indeed only be called once.

There are cases where we can avoid an explicit sort step by relying on
some earlier phase of the processing pipeline to generate the rows in the
right order to begin with.  Evidently this wasn't one of them though :-(.

                        regards, tom lane

Sent via pgsql-hackers mailing list (
To make changes to your subscription:

Reply via email to