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/ ---------------------------(end of broadcast)--------------------------- TIP 6: Have you searched our list archives? http://archives.postgresql.org