Re: Cursors and different settings for default_statistics_target

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Cursors and different settings for default_statistics_target
Дата
Msg-id 9629.1207066619@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Cursors and different settings for default_statistics_target  ("Hell, Robert" <Robert.Hell@fabasoft.com>)
Ответы Re: Cursors and different settings for default_statistics_target
Список pgsql-performance
"Hell, Robert" <Robert.Hell@fabasoft.com> writes:
> That's it - I found a more simple statement which has the same problem
> (0.02 seconds vs. 6 seconds):

This isn't necessarily the very same problem --- what are the plans for
your original case with the two different stats settings?

> What's the difference between plan calculation for cursors and straight
> queries?

The planner is set up to favor fast-start plans a little bit when
planning a cursor, on the theory that you are probably more interested
in getting some of the rows sooner than you are in the total runtime,
and that you might not ever intend to fetch all the rows anyway.
In the example you give here, it likes the indexscan/unique plan because
of the zero startup cost, even though the total cost is (correctly)
estimated as much higher.  (Looking at this example, I wonder if the
fast-start bias isn't a bit too strong...)

It's not immediately apparent to me though how that would affect
your original query.

            regards, tom lane

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

Предыдущее
От: "Hell, Robert"
Дата:
Сообщение: Re: Cursors and different settings for default_statistics_target
Следующее
От: "Hell, Robert"
Дата:
Сообщение: Re: Cursors and different settings for default_statistics_target