Re: The planner hates me.

From: "Jeff Amiel" <JAmiel(at)istreamimaging(dot)com>
To: "Hoover, Jeffrey" <jhoover(at)jcvi(dot)org>, pgsql-general(at)postgresql(dot)org
Subject: Re: The planner hates me.
Date: 2008-09-25 15:42:19
Message-ID: C17A452040EDB84AA7A10AEA334E3E1455D1C5@AD1
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


-----Original Message-----
From: Hoover, Jeffrey [mailto:jhoover(at)jcvi(dot)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?

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Marcus Engene 2008-09-25 15:42:41 regexp_replace() [noindex] thing
Previous Message Tom Lane 2008-09-25 15:38:41 Re: The planner hates me.