Re: Timestamp-based indexing

Поиск
Список
Период
Сортировка
От Kevin Barnard
Тема Re: Timestamp-based indexing
Дата
Msg-id 41051C1E.90805@speedfc.com
обсуждение исходный текст
Ответ на Timestamp-based indexing  ("Harmon S. Nine" <hnine@netarx.com>)
Ответы Re: Timestamp-based indexing
Список pgsql-performance

Harmon S. Nine wrote:

> monitor=# explain analyze select * from "eventtable" where timestamp >
> CURRENT_TIMESTAMP - INTERVAL '10 minutes';
>                                                         QUERY PLAN

Try

SELECT * FROM eventtable where timestamp BETWEEN  (CURRENT_TIMESTAMP -
INTERVAL '10 minutes') AND CURRENT_TIMESTAMP;

This should will use a range off valid times.  What your query is doing
is looking for 10 minutes ago to an infinate future.  Statically
speaking that should encompass most of the table because you have an
infinate range.  No index will be used.  If you assign a range the
planner can fiqure out what you are looking for.

--
Kevin Barnard
Speed Fulfillment and Call Center
kbarnard@speedfc.com
214-258-0120


В списке pgsql-performance по дате отправления:

Предыдущее
От: "Merlin Moncure"
Дата:
Сообщение: Re: arrays and indexes
Следующее
От: "Matthew T. O'Connor"
Дата:
Сообщение: Re: Timestamp-based indexing