Re: Timestamp indexes (why ">" or "between" does not use index?) - Mailing list pgsql-general

From Michael Glaesemann
Subject Re: Timestamp indexes (why ">" or "between" does not use index?)
Date
Msg-id AFCE3873-698E-48D2-A721-0EC219A2E2D2@seespotcode.net
Whole thread Raw
In response to Timestamp indexes (why ">" or "between" does not use index?)  ("Phoenix Kiula" <phoenix.kiula@gmail.com>)
Responses Re: Timestamp indexes (why ">" or "between" does not use index?)
List pgsql-general
On Feb 16, 2008, at 9:42 , Phoenix Kiula wrote:

> 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?
>


The planner will choose a seq scan if it thinks that it will be
faster than using an index: if based on its statistics it thinks a
large portion of rows will match the criteria, a seq scan may well be
faster than an index scan.

Have you analyzed recently? Showing us the EXPLAIN ANALYZE for your
query would be helpful. Have you tried running the EXPLAIN ANALYZE
with seq scans disabled?

Michael Glaesemann
grzm seespotcode net



pgsql-general by date:

Previous
From: "Phoenix Kiula"
Date:
Subject: Re: Timestamp indexes (why ">" or "between" does not use index?)
Next
From: Tom Lane
Date:
Subject: Re: Timestamp indexes (why ">" or "between" does not use index?)