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

From Jeff Amiel
Subject Re: The planner hates me.
Date
Msg-id C17A452040EDB84AA7A10AEA334E3E1455D1C5@AD1
Whole thread Raw
In response to The planner hates me.  ("Jeff Amiel" <JAmiel@istreamimaging.com>)
List pgsql-general
-----Original Message-----
From: Hoover, Jeffrey [mailto:jhoover@jcvi.org]

change t.date2< dates.date to t.date2+0<dates.date, this will prevent
the query from trying to use the index on date2 because the where clause
now references an expression and not the column itself:

explain analyze
select sum(amount),  dates.date as date
from transaction t
join (select get_dates as date from get_dates('09/17/08','09/24/08'))
dates
  on (t.state='I' or t.date1 >=  dates.date) and t.date2+0<dates.date
group by dates.date



Yup...that did the trick.....whodathunkit?

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: The planner hates me.
Next
From: Marcus Engene
Date:
Subject: regexp_replace() [noindex] thing