Re: Timestamp indexes (why ">" or "between" does not use index?)

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Timestamp indexes (why ">" or "between" does not use index?)
Дата
Msg-id 19464.1203176379@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Timestamp indexes (why ">" or "between" does not use index?)  (Michael Glaesemann <grzm@seespotcode.net>)
Ответы Re: Timestamp indexes (why ">" or "between" does not use index?)
Список pgsql-general
Michael Glaesemann <grzm@seespotcode.net> writes:
> The planner will choose a seq scan if it thinks that it will be
> faster than using an index: if based on its statistics it thinks a
> large portion of rows will match the criteria, a seq scan may well be
> faster than an index scan.

> Have you analyzed recently?

If you've never analyzed at all, the default assumptions will
discourage the planner from using an indexscan for a one-sided
inequality condition (like "x > constant").  On the other hand,
it usually will use an indexscan for a range inequality (like
"x > constant1 and x < constant2", or a BETWEEN construct).

If you do have ANALYZE stats then it all depends on what fraction of
the column's range is selected by the inequality or range condition.

            regards, tom lane

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

Предыдущее
От: Michael Glaesemann
Дата:
Сообщение: Re: Timestamp indexes (why ">" or "between" does not use index?)
Следующее
От: Tom Lane
Дата:
Сообщение: Re: SELECT CAST(123 AS char) -> 1