Re: [PERFORM] query - laziness of lateral join with function

2015-02-12 Thread Paul Callaghan
On Feb 12, 2015 9:17 PM, "Tom Lane" wrote: > The planner might produce such a result if there's an opportunity > to perform the sorting via an index on "alpha" (ie, the ORDER BY > matches some index). If it has to do an explicit sort it's gonna > do the join first. > > (If you have such an index

Re: [PERFORM] query - laziness of lateral join with function

2015-02-12 Thread David G Johnston
Tom Lane-2 wrote > paulcc < > paulcc.two@ > > writes: >>select count(alpha.id) >>from alpha >>cross join lateral some_function(alpha.id) as some_val >>where alpha.test > >>Here the function is strict, and moreover its argument will never >>be null - hence there should al

Re: [PERFORM] query - laziness of lateral join with function

2015-02-12 Thread Tom Lane
paulcc writes: >select count(alpha.id) >from alpha >cross join lateral some_function(alpha.id) as some_val >where alpha.test >Here the function is strict, and moreover its argument will never >be null - hence there should always be a non-null value returned. >I woul