Re: Speeding up index scans by truncating timestamp?

From: Vick Khera <vivek(at)khera(dot)org>
To: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Speeding up index scans by truncating timestamp?
Date: 2011-02-15 15:20:12
Message-ID: AANLkTimyPEqpzZxiyAAkxvFRTwDQcAW=QM4m4yJD9WXk@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, Feb 15, 2011 at 10:00 AM, Derrick Rice <derrick(dot)rice(at)gmail(dot)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.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Geoffrey Myers 2011-02-15 16:09:50 Re: finding bogus UTF-8
Previous Message Michael Glaesemann 2011-02-15 15:16:37 Re: Speeding up index scans by truncating timestamp?