-----Original Message----- From: Hoover, Jeffrey [mailto:[EMAIL PROTECTED]
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? -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general