From: | Michael Fuhr <mike(at)fuhr(dot)org> |
---|---|
To: | "H(dot)J(dot) Sanders" <hjs(at)rmax(dot)nl> |
Cc: | pgsql-performance(at)postgresql(dot)org |
Subject: | Re: date - range |
Date: | 2005-04-01 23:24:01 |
Message-ID: | 20050401232401.GA8389@winnie.fuhr.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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/
From | Date | Subject | |
---|---|---|---|
Next Message | Mischa | 2005-04-02 05:59:44 | Re: date - range |
Previous Message | Mike Nolan | 2005-04-01 22:36:47 | Re: Sustained inserts per sec ... ? |