Re: Does PostgreSQL do bind-peeking? Is `col like '%'` optimized-away by the planner?

Поиск
Список
Период
Сортировка
От David G. Johnston
Тема Re: Does PostgreSQL do bind-peeking? Is `col like '%'` optimized-away by the planner?
Дата
Msg-id CAKFQuwZA6iKQOQWSDu8MY2NCYhB0RhQpmRCKakLUsVhwAEOxfg@mail.gmail.com
обсуждение исходный текст
Ответ на Does PostgreSQL do bind-peeking? Is `col like '%'` optimized-away by the planner?  (Dominique Devienne <ddevienne@gmail.com>)
Список pgsql-general
On Fri, Jan 21, 2022 at 9:36 AM Dominique Devienne <ddevienne@gmail.com> wrote:

for the various cases of empty argN strings, or does the planner do
*bind-peeking*, and thus a single prepared statement would do the job,
and still have different plans used depending on the actual binds?

I'm assuming PostgreSQL does bind-peeking like Oracle, but I don't
know, and I've never read anything yet about that.


A prepared statement either generates a custom plan and, as a side-effect, does bind-peeking, or it uses the single prepared plan it has established and executes that.  It doesn't use bind-peeking to decide among multiple saved prepared plans. There is more to it than that, like a 5 custom plan threshold before abandoning bind-peeking (I think I got that right...).

David J.

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

Предыдущее
От: Dominique Devienne
Дата:
Сообщение: Does PostgreSQL do bind-peeking? Is `col like '%'` optimized-away by the planner?
Следующее
От: Guillaume Lelarge
Дата:
Сообщение: Re: Using a different column name in a foreign table