1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-30 11:03:19 +03:00

Invent recursive_worktable_factor GUC to replace hard-wired constant.

Up to now, the planner estimated the size of a recursive query's
worktable as 10 times the size of the non-recursive term.  It's hard
to see how to do significantly better than that automatically, but
we can give users control over the multiplier to allow tuning for
specific use-cases.  The default behavior remains the same.

Simon Riggs

Discussion: https://postgr.es/m/CANbhV-EuaLm4H3g0+BSTYHEGxJj3Kht0R+rJ8vT57Dejnh=_nA@mail.gmail.com
This commit is contained in:
Tom Lane
2022-03-24 11:47:41 -04:00
parent a47651447f
commit 0bd7af082a
6 changed files with 44 additions and 3 deletions

View File

@ -5919,6 +5919,29 @@ SELECT * FROM parent WHERE key = 2400;
</listitem>
</varlistentry>
<varlistentry id="guc-recursive-worktable-factor" xreflabel="recursive_worktable_factor">
<term><varname>recursive_worktable_factor</varname> (<type>floating point</type>)
<indexterm>
<primary><varname>recursive_worktable_factor</varname> configuration parameter</primary>
</indexterm>
</term>
<listitem>
<para>
Sets the planner's estimate of the average size of the working
table of a <link linkend="queries-with-recursive">recursive
query</link>, as a multiple of the estimated size of the initial
non-recursive term of the query. This helps the planner choose
the most appropriate method for joining the working table to the
query's other tables.
The default value is <literal>10.0</literal>. A smaller value
such as <literal>1.0</literal> can be helpful when the recursion
has low <quote>fan-out</quote> from one step to the next, as for
example in shortest-path queries. Graph analytics queries may
benefit from larger-than-default values.
</para>
</listitem>
</varlistentry>
</variablelist>
</sect2>
</sect1>