Re: explain, planner and more..

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: explain, planner and more..
Дата
Msg-id 24654.997849404@sss.pgh.pa.us
обсуждение исходный текст
Ответ на explain, planner and more..  (Svenne Krap <usenet@krap.dk>)
Список pgsql-general
Svenne Krap <usenet@krap.dk> writes:
> Why does the planner choose not to use numberdomain_pkey as index on
> numberdomain ?

>                   ->  Seq Scan on numberdomain nd  (cost=0.00..1.85
> rows=1 width=31)

Evidently because it thinks numberdomain only has one disk block,
and hence there's no possible savings from reading an index in addition
to that one disk block.  (If it were estimating more than one block
read then the cost estimate would be 2 or more.  1.85 implies one block
read = 1.0 cost unit, plus some per-tuple CPU effort.)

If numberdomain is indeed big enough to warrant an index search,
then you need to VACUUM it to update the planner's statistics.
The plan you are getting is based on statistics that say numberdomain
is tiny.

            regards, tom lane

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

Предыдущее
От: Mike Withers
Дата:
Сообщение: Re: Null Conversion
Следующее
От: Stephan Szabo
Дата:
Сообщение: Re: Null Conversion