Re: On disable_cost

Laurenz Albe <laurenz.albe@cybertec.at>

From: Laurenz Albe <laurenz.albe@cybertec.at>
To: David Rowley <dgrowleyml@gmail.com>
Cc: Alena Rybakina <a.rybakina@postgrespro.ru>, Robert Haas <robertmhaas@gmail.com>, Tom Lane <tgl@sss.pgh.pa.us>, Heikki Linnakangas <hlinnaka@iki.fi>, Peter Geoghegan <pg@bowt.ie>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2024-10-18T12:09:04Z
Lists: pgsql-hackers
Thanks for the fixes; I have only a few quibbles now.

On Fri, 2024-10-18 at 23:54 +1300, David Rowley wrote:
> --- a/doc/src/sgml/perform.sgml
> +++ b/doc/src/sgml/perform.sgml
> @@ -578,6 +578,33 @@ WHERE t1.unique1 &lt; 100 AND t1.unique2 = t2.unique2;
>      discussed <link linkend="using-explain-analyze">below</link>.
>     </para>
>  
> +   <para>
> +    When using the enable/disable flags to disable plan node types, many of
> +    the flags only discourage the use of the corresponding plan node and don't
> +    outright disallow the planner's ability to use the plan node type.  This
> +    is done so that the planner still maintains the ability to form a plan for
> +    a given query.  Otherwise, certain queries could be executed when certain

You mean "could *not* be executed".

> +    plan node types are disabled.  This means it is possible that the planner

The "this" is potentially confusing.  Does it refer to queries that cannot be
executed?

> +    chooses a plan using a node that has been disabled.  When this happens,
> +    the <command>EXPLAIN</command> output will indicate this fact.

Here is my attempt on that paragraph:

  When using the enable/disable flags to disable plan node types, many of
  the flags only discourage the use of the corresponding plan node and don't
  outright disallow the planner's ability to use the plan node type.
  Otherwise, certain queries could not be executed for lack of an alternative
  to using a disabled plan node.  As a consequence, it is possible that the
  planner chooses a plan using a node that has been disabled.  When this
  happens, the <command>EXPLAIN</command> output will indicate this fact.

Yours,
Laurenz Albe



Commits

  1. Doc: add detail about EXPLAIN's "Disabled" property

  2. Adjust EXPLAIN's output for disabled nodes

  3. Fix order of parameters in a cost_sort call

  4. Show number of disabled nodes in EXPLAIN ANALYZE output.

  5. Treat number of disabled nodes in a path as a separate cost metric.

  6. Remove grotty use of disable_cost for TID scan plans.