Re: Speeding up index scans by truncating timestamp? - Mailing list pgsql-general

From Vick Khera
Subject Re: Speeding up index scans by truncating timestamp?
Date
Msg-id AANLkTimyPEqpzZxiyAAkxvFRTwDQcAW=QM4m4yJD9WXk@mail.gmail.com
Whole thread Raw
In response to Re: Speeding up index scans by truncating timestamp?  (Derrick Rice <derrick.rice@gmail.com>)
Responses Re: Speeding up index scans by truncating timestamp?
Re: Speeding up index scans by truncating timestamp?
List pgsql-general
On Tue, Feb 15, 2011 at 10:00 AM, Derrick Rice <derrick.rice@gmail.com> wrote:
> Is the query optimizer capable of using the relationship between an index on
> date_trunc(foo) and a query with "where foo < bar and foo > baz" ?  At this
> point the question is to satisfy my own curiosity.

No. The query has to use the same function as the index does.

I also don't think that the storage space will be any less.  A
timestamp is always stored in the same amount of space. All you're
doing is zeroing out the higher resolution bits of time.

pgsql-general by date:

Previous
From: Michael Glaesemann
Date:
Subject: Re: Speeding up index scans by truncating timestamp?
Next
From: Geoffrey Myers
Date:
Subject: Re: finding bogus UTF-8