Re: Postgresql selecting strange index for simple query

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Postgresql selecting strange index for simple query
Дата
Msg-id 2424.1235678644@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Postgresql selecting strange index for simple query  (Maxim Boguk <mboguk@masterhost.ru>)
Ответы Re: Postgresql selecting strange index for simple query  (Maxim Boguk <mboguk@masterhost.ru>)
Список pgsql-general
Maxim Boguk <mboguk@masterhost.ru> writes:
> So i have two theory (just waving hands ofcourse):
> 1)integer owerflow somewhere in cost calculation

Costs are floats, and in any case you're not showing costs anywhere near
the integer overflow limit...

> 2)floating rounding errors (because cost very close in wrong situations: 254918.19 vs 259709.09)

The planner is intentionally set up to consider costs within a percent
or so of each other as being effectively equal.  If the estimated costs
are that close then it doesn't surprise me if it sometimes picks the
"wrong" plan.  The real question is why are the estimates so close?
They should not be, since AFAICS you are talking about a situation
where we'd have to scan all of the multicol index versus only about
a fifth of the single-col one.

            regards, tom lane

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

Предыдущее
От: Andreas Kretschmer
Дата:
Сообщение: Re: Returning null for joined tables when one column non existant
Следующее
От: Martin Gainty
Дата:
Сообщение: Re: Off Topic: ICD-10 codes in a database table?