Re: date - range - Mailing list pgsql-performance

From Michael Fuhr
Subject Re: date - range
Date
Msg-id 20050401232401.GA8389@winnie.fuhr.org
Whole thread Raw
In response to date - range  ("H.J. Sanders" <hjs@rmax.nl>)
List pgsql-performance
On Fri, Apr 01, 2005 at 12:05:44PM +0200, H.J. Sanders wrote:
>
> people can subscribe to a service for 1 or more days (upto a max. of 365).
>
> So in the database is stored: first_date and last_date
>
> To select which people are subscribed for a certain date (e.g. today) we use
> a select like
>
> select   ....... where first_date <= today and last_date >= today
>
> Whatever index we create system always does a sequential scan (which I can
> understand).

Could you show the table and index definitions and the EXPLAIN
ANALYZE output of two queries, one with enable_seqscan set to "on"
and one with it set to "off"?  The planner might think that a
sequential scan would be faster than an index scan, and EXPLAIN
ANALYZE should tell us if that guess is correct.

What version of PostgreSQL are you using?

--
Michael Fuhr
http://www.fuhr.org/~mfuhr/

pgsql-performance by date:

Previous
From: Mike Nolan
Date:
Subject: Re: Sustained inserts per sec ... ?
Next
From: Mischa
Date:
Subject: Re: date - range