Re: SELECT from a set of values really slow?

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: SELECT from a set of values really slow?
Дата
Msg-id 13065.1097438410@sss.pgh.pa.us
обсуждение исходный текст
Ответ на SELECT from a set of values really slow?  (Tim Smith <reply_in_group@mouse-potato.com>)
Ответы Re: SELECT from a set of values really slow?
Список pgsql-general
Tim Smith <reply_in_group@mouse-potato.com> writes:
>     SELECT id FROM bench WHERE data IN ('X', 'Y')

> To my surprise, when I tried this trick with PostgreSQL, it did not
> speed things up.  In fact, it *massively* slowed down--it only is
> getting 13 selects in 3 seconds, searching for two at a time.

> What's going on here?

Likely it's switching from index to sequential scan because of a poor
estimate of how many rows will be returned.  Have you ever ANALYZEd
the test table?  Without either ANALYZE stats or a unique index,
the planner will certainly not think that the column is unique.

            regards, tom lane

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

Предыдущее
От: Gaetano Mendola
Дата:
Сообщение: Re: VACUUM FULL on 24/7 server
Следующее
От: "m.b."
Дата:
Сообщение: Get Postgre Status and Information