Re: Why isn't an index scan being used?

Поиск
Список
Период
Сортировка
От Andrew Gierth
Тема Re: Why isn't an index scan being used?
Дата
Msg-id 87ftsji2tb.fsf@news-spur.riddles.org.uk
обсуждение исходный текст
Ответ на Why isn't an index scan being used?  (Abi Noda <a@abinoda.com>)
Ответы Re: Why isn't an index scan being used?  (Michael Lewis <mlewis@entrata.com>)
Список pgsql-performance
>>>>> "Abi" == Abi Noda <a@abinoda.com> writes:

 Abi> However, when I index the closed column, a bitmap scan is used
 Abi> instead of an index scan, with slightly slower performance. Why
 Abi> isn't an index scan being used, given that the exact same number
 Abi> of rows are at play as in my query on the state column?

Most likely difference is the correlation estimate for the conditions.
The cost of an index scan includes a factor based on how well correlated
the physical position of rows is with the index order, because this
affects the number of random seeks in the scan. But for nulls this
estimate cannot be performed, and bitmapscan is cheaper than plain
indexscan on poorly correlated data.

-- 
Andrew (irc:RhodiumToad)


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

Предыдущее
От: Abi Noda
Дата:
Сообщение: Re: Why isn't an index scan being used?
Следующее
От: Michael Lewis
Дата:
Сообщение: Re: Why isn't an index scan being used?