От: Michael Fuhr
Тема: Re: date - range
Дата: ,
Msg-id: 20050401232401.GA8389@winnie.fuhr.org
(см: обсуждение, исходный текст)
Ответ на: date - range  ("H.J. Sanders")
Список: pgsql-performance

Скрыть дерево обсуждения

date - range  ("H.J. Sanders", )
 Re: date - range  (Michael Fuhr, )
 Re: date - range  (Mischa, )
  Re: date - range  (Mischa, )
  Re: date - range  (Michael Fuhr, )
   Re: date - range  (Bruno Wolff III, )

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 по дате сообщения:

От: Michael Fuhr
Дата:
Сообщение: Re: date - range
От: Mischa
Дата:
Сообщение: Re: date - range