On Thu, Sep 25, 2008 at 9:38 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> The problem you've got here is that the planner has got absolutely no
> visibility into the behavior of get_dates(). In particular it doesn't
> realize that the values being generated are close to the end of the
> range of dates that are in the table, and thus the date1 >= dates.date
> condition is far more selective than the date2 < dates.date condition.
> If you look closely at the rowcount estimates you'll see that those are
> actually being estimated the same, to within roundoff error. So looking
> at two indexes instead of one doesn't look like a win to it.
Couldn't they make a simple immutable function and index on that?