Re: Slight change in query leads to unexpected change in query plan

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Slight change in query leads to unexpected change in query plan
Дата
Msg-id 13786.1245766316@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Slight change in query leads to unexpected change in query plan  (Jack Orenstein <jack.orenstein@hds.com>)
Ответы Re: Slight change in query leads to unexpected change in query plan  (Jack Orenstein <jack.orenstein@hds.com>)
Список pgsql-general
Jack Orenstein <jack.orenstein@hds.com> writes:
>    Limit  (cost=0.00..324.99 rows=100 width=451)
>      ->  Index Scan using t_pkey on t  (cost=0.00..296027.98 rows=91088 width=451)
>            Index Cond: (pk > 1000000000)

> Adding the value restriction at the top of this query plan wouldn't increase the
> cost very much.

You're missing the point: with the value restriction in place, it's
estimating that it will probably have to scan all 91000 rows (because
there are fewer than 100 satisfying the value restriction).  And that
is going to cost somewhere north of 296027 cost units --- the cost
shown, plus 91000 invocations of the value-restriction check.
Which is considerably more than the cost of the other plan.

            regards, tom lane

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Explaining functions.
Следующее
От: David Fetter
Дата:
Сообщение: Re: [BUGS] Integrity check