Re: Postgres using nested loops despite setting enable_nestloop to false

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Postgres using nested loops despite setting enable_nestloop to false
Дата
Msg-id 919168.1605630107@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Postgres using nested loops despite setting enable_nestloop to false  (Frits Jalvingh <jal@etc.to>)
Ответы Re: Postgres using nested loops despite setting enable_nestloop to false
Список pgsql-performance
Frits Jalvingh <jal@etc.to> writes:
> I have attached both plans, both made with set enable_nestloop = false in
> the attachments.

The reason why you're getting a nested loop is that the planner has no
other choice.  The "tijd" table has no join conditions that would be
amenable to hash- or merge-joining it to something else, because both
of those join methods require a plain equality join condition.  AFAICS
in a quick look, all of tijd's join conditions look more like

    Join Filter: ((di04238cluster.dv_start_dts <= tijd.einddatum) AND (di04238cluster.dv_end_dts > tijd.einddatum))

which is not amenable to anything except brute force cross-join-and-
test-the-condition.

Given that, it's likely that "enable_nestloop = false" is making things
worse not better, by artificially distorting the plan shape.

Seeing the large number of joins involved, I wonder what your
geqo_threshold, join_collapse_limit, and from_collapse_limit settings
are, and whether you can get a better plan by increasing them.

The planner doesn't seem to think that any of these joins involve
a very large number of rows, so I doubt that your work_mem setting
is very relevant.  However, are these rowcount estimates accurate?
You claimed upthread that you were dealing with hundreds of millions
of rows, but it's impossible to credit that cost estimates like

  ->  Seq Scan on s_h_cluster_ssm di01905cluster  (cost=0.00..155.05 rows=1072 width=24)
        Filter: (soort = 'FIN'::text)

correspond to scanning large tables.

In the end, I fear that finding a way to get rid of those
inequality join conditions may be your only real answer.

            regards, tom lane



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

Предыдущее
От: Frits Jalvingh
Дата:
Сообщение: Re: Postgres using nested loops despite setting enable_nestloop to false
Следующее
От: Frits Jalvingh
Дата:
Сообщение: Re: Postgres using nested loops despite setting enable_nestloop to false