> On Thu, Sep 25, 2008 at 9:38 AM, Tom Lane <email@example.com> wrote:
>> The problem you've got here is that the planner has got absolutely no
>> visibility into the behavior of get_dates().
> Couldn't they make a simple immutable function and index on that?
Maybe, but I can't think of a different index definition that would work
The Right Way (tm) to do this would be something like
create temp table dates as select * from get_dates(...);
... original select, but join against temp table ...
which would leave the planner armed with some stats about the range
of dates of interest. Unfortunately, this isn't going to help Jeff
today, because scalargtjoinsel/scalarltjoinsel are just stubs :-(.
It's not an area of the planner than anyone's ever got round to working
regards, tom lane