Re: The planner hates me. - Mailing list pgsql-general

From Tom Lane
Subject Re: The planner hates me.
Date
Msg-id 8406.1222360912@sss.pgh.pa.us
Whole thread Raw
In response to Re: The planner hates me.  ("Scott Marlowe" <scott.marlowe@gmail.com>)
List pgsql-general
"Scott Marlowe" <scott.marlowe@gmail.com> writes:
> 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().

> 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
better.

The Right Way (tm) to do this would be something like

    create temp table dates as select * from get_dates(...);
    analyze 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
on.

            regards, tom lane

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: regexp_replace() [noindex] thing
Next
From: Marcus Engene
Date:
Subject: Re: regexp_replace() [noindex] thing