From: | Alban Hertroys <dalroi(at)solfertje(dot)student(dot)utwente(dot)nl> |
---|---|
To: | Vick Khera <vivek(at)khera(dot)org> |
Cc: | pgsql-general <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Speeding up index scans by truncating timestamp? |
Date: | 2011-02-15 20:01:55 |
Message-ID: | 8D17F03F-2470-4682-99D7-ECC9BC901D9D@solfertje.student.utwente.nl |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On 15 Feb 2011, at 16:20, Vick Khera wrote:
> 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.
> 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.
I suppose it would help to cast the column to date, both in the index creation and in the queries. I don't have time right now to verify that the storage space of a date is actually less than a timestamp, but I expect it would be (although, dates in PG have an awful lot of range!).
Alban Hertroys
--
If you can't see the forest for the trees,
cut the trees and you'll see there is no forest.
!DSPAM:737,4d5adbbf11734598963003!
From | Date | Subject | |
---|---|---|---|
Next Message | Vick Khera | 2011-02-15 21:20:40 | Re: finding bogus UTF-8 |
Previous Message | Derrick Rice | 2011-02-15 19:34:41 | Re: Speeding up index scans by truncating timestamp? |