Re: Timestamp indexes (why ">" or "between" does not use index?)

From: "Phoenix Kiula" <phoenix(dot)kiula(at)gmail(dot)com>
To: "PG-General Mailing List" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Timestamp indexes (why ">" or "between" does not use index?)
Date: 2008-02-16 15:07:16
Message-ID: e373d31e0802160707g261f5494g7040a9b6120b128b@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

IN the second SQL, I meant this:

> WHERE modify_date > '2008-01-01'

On 16/02/2008, Phoenix Kiula <phoenix(dot)kiula(at)gmail(dot)com> wrote:
> I have a table with an index on a field called "modify_date".
>
> This works well if I have SQL which ends in
>
> WHERE modify_date = '2008-01-01'
>
> But if I try this condition:
>
> WHERE modify_date = '2008-01-01'
>
> THis index is not used. The EXPLAIN tells me it needs to do a seq
> scan. Why is this? How can I make a date/time field index which uses
> both equality criteria and the greater than/lesser than/between
> criteria?
>
> Thanks.
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Michael Glaesemann 2008-02-16 15:11:41 Re: Timestamp indexes (why ">" or "between" does not use index?)
Previous Message Michael Glaesemann 2008-02-16 15:06:09 Re: Strict-typing benefits/costs