Re: The planner hates me.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Scott Marlowe" <scott(dot)marlowe(at)gmail(dot)com>
Cc: "Jeff Amiel" <JAmiel(at)istreamimaging(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: The planner hates me.
Date: 2008-09-25 16:41:52
Message-ID: 8406.1222360912@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

"Scott Marlowe" <scott(dot)marlowe(at)gmail(dot)com> writes:
> On Thu, Sep 25, 2008 at 9:38 AM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Marcus Engene 2008-09-25 16:59:37 Re: regexp_replace() [noindex] thing
Previous Message Tom Lane 2008-09-25 16:35:00 Re: regexp_replace() [noindex] thing