Re: inconsistent/weird index usage

From: Hannu Krosing <hannu(at)tm(dot)ee>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Josh Berkus <josh(at)agliodbs(dot)com>, Dustin Sallings <dustin(at)spy(dot)net>, pgsql-performance(at)postgresql(dot)org
Subject: Re: inconsistent/weird index usage
Date: 2004-10-02 23:20:41
Message-ID: 1096759241.5508.2.camel@fuji.krosing.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

On R, 2004-10-01 at 19:34, Tom Lane wrote:
> Josh Berkus <josh(at)agliodbs(dot)com> writes:
> >> Most of the problem here comes from the fact that "current_date - 7"
> >> isn't reducible to a constant and so the planner is making bad guesses
> >> about how much of each table will be scanned.
>
> > I thought this was fixed in 7.4. No?
>
> No. It's not fixed as of CVS tip either, although there was some talk
> of doing something in time for 8.0.

That's weird - my 7.4.2 databases did not consider (now()-'15
min'::interval) to be a constant whereas 7.4.5 does (i.e. it does use
index scan on index on datetime column)

Is this somehow different for date types ?

--------------
Hannu

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Tom Lane 2004-10-02 23:21:16 Re: Query planner problem
Previous Message Josh Berkus 2004-10-02 22:50:58 Re: Caching of Queries