From: Michael Fuhr <mike@fuhr.org>
To: H.J. Sanders <hjs@rmax.nl>
Cc: pgsql-performance@postgresql.org
Subject: Re: date - range
Date: Fri, 1 Apr 2005 16:24:01 -0700
Message-ID: <20050401232401.GA8389@winnie.fuhr.org> (raw)
In-Reply-To: <KIEBKBGIGGNDKKJJNKCFKEPLEEAA.hjs@rmax.nl>
References: <KIEBKBGIGGNDKKJJNKCFKEPLEEAA.hjs@rmax.nl>
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/
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-performance@postgresql.org
Cc: mike@fuhr.org, hjs@rmax.nl
Subject: Re: date - range
In-Reply-To: <20050401232401.GA8389@winnie.fuhr.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox