Re: Curious index selection when using a date range

Поиск
Список
Период
Сортировка
От Scott Marlowe
Тема Re: Curious index selection when using a date range
Дата
Msg-id dcc563d11001031303p279a4a60i32d6eb0f49ba82a5@mail.gmail.com
обсуждение исходный текст
Ответ на Curious index selection when using a date range  (Robert Gravsjö <robert@blogg.se>)
Ответы Re: Curious index selection when using a date range
Список pgsql-general
On Sun, Jan 3, 2010 at 1:10 PM, Robert Gravsjö <robert@blogg.se> wrote:
> I encountered a curious thing today. Simple select queries against a fairly
> large, ~60M rows, and active, both in reading and writing, suddenly were
> aweful slow, from milliseconds into 10th of seconds.
>
> Looking a bit closer revealed that on a date condition having a between
> 2010-01-01 00:00:00 and 2010-01-31 23:59:59 a simple datetime index was
> choosen while if the year was switched to 2009 a composed index making use
> of the other condition parameters as well was choosen.
>
> After this we ran vacuum analyze on the table which solved the issue with
> the composed index getting used for the current year as well.

Assuming the analyze part is what fixed this, then the problem is
you're analyzing often enough.  Got autovac on?  What version of pgsql
are you running?

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

Предыдущее
От: Robert Gravsjö
Дата:
Сообщение: Curious index selection when using a date range
Следующее
От: Robert Gravsjö
Дата:
Сообщение: Re: Curious index selection when using a date range