Re: unoptimized nested loops

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: unoptimized nested loops
Дата
Msg-id 843004.1654144360@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: unoptimized nested loops  (Jeff Janes <jeff.janes@gmail.com>)
Ответы Re: unoptimized nested loops  (Jeff Janes <jeff.janes@gmail.com>)
Re: unoptimized nested loops  (Tim Kelly <gtkelly@dialectronics.com>)
Список pgsql-general
Jeff Janes <jeff.janes@gmail.com> writes:
> On Tue, May 31, 2022 at 4:04 PM Tim Kelly <gtkelly@dialectronics.com> wrote:
>> I do not see evidence that the nested loop is trying to reduce overhead
>> by using the smaller set.  It seems to want to scan on data first either
>> way.

> The planner probably doesn't know which one is smaller.

There is not a lot of daylight between the cost estimates for
"a nestloop-join b" and "b nestloop-join a", if we're considering
plain seqscans on both tables and all else is equal.  It tends to
come down to factors like which one is more densely populated.

As best I can tell, the issue Tim's unhappy about is not so
much the use of a nestloop as the lack of use of any index.
But "string like '%foo%'" is not at all optimizable with a
btree index.  You might be able to get somewhere with a
pg_trgm GIN or GIST index.

            regards, tom lane



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

Предыдущее
От: Jeff Janes
Дата:
Сообщение: Re: unoptimized nested loops
Следующее
От: jian he
Дата:
Сообщение: How to display complicated Chinese character: Biang.