Re: Can simplify 'limit 1' with slow function? - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Can simplify 'limit 1' with slow function?
Date
Msg-id 26306.1404338572@sss.pgh.pa.us
Whole thread Raw
In response to Re: Can simplify 'limit 1' with slow function?  (Martijn van Oosterhout <kleptog@svana.org>)
List pgsql-hackers
Martijn van Oosterhout <kleptog@svana.org> 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



pgsql-hackers by date:

Previous
From: Andreas Karlsson
Date:
Subject: Re: New functions in sslinfo module
Next
From: Peter Geoghegan
Date:
Subject: Re: Doing better at HINTing an appropriate column within errorMissingColumn()