Rajesh Kumar Mallah <> writes:
> Tom Lane wrote:
>> Odd. Apparently the planner is picking a better plan in the function
>> context than in the subselect context --- which is strange since it
>> ought to have less information.
> [ verbose plan snipped ]
Well, that sure seems to be the same plan. Curious that the runtime
wasn't about the same. Perhaps the slow execution of the first query
was a caching effect? If you alternate trying the query both ways,
does the speed difference persist?
regards, tom lane