Re: On disable_cost
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Robert Haas <robertmhaas@gmail.com>
Cc: Jian Guo <gjian@vmware.com>, Euler Taveira <euler@timbira.com.br>,
Zhenghua Lyu <zlyu@vmware.com>,
PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2024-04-01T21:00:11Z
Lists: pgsql-hackers
Robert Haas <robertmhaas@gmail.com> writes: > One of the things I realized relatively early is that the patch does > nothing to propagate disable_cost upward through the plan tree. > ... > After straining my brain over various plan changes for a long time, > and hacking on the code somewhat, I realized that just propagating the > Boolean upward is insufficient to set things right. That's basically > because I was being dumb when I said this: >> I don't think we should care how MANY disabled nodes appear in a >> plan, particularly. Very interesting, thanks for the summary. So the fact that disable_cost is additive across plan nodes is actually a pretty important property of the current setup. I think this is closely related to one argument you made against my upthread idea of using IEEE Infinity for disable_cost: that'd mask whether more than one of the sub-plans had been disabled. > ... And while there's probably more than one way > to make it work, the easiest thing seems to be to just have a > disabled-counter in every node that gets initialized to the total > disabled-counter values of all of its children, and then you add 1 if > that node is itself doing something that is disabled, i.e. the exact > opposite of what I said in the quote above. Yeah, that seems like the next thing to try if anyone plans to pursue this further. That'd essentially do what we're doing now except that disable_cost is its own "order of infinity", entirely separate from normal costs. regards, tom lane
Commits
-
Doc: add detail about EXPLAIN's "Disabled" property
- 84b8fccbe5c2 18.0 landed
-
Adjust EXPLAIN's output for disabled nodes
- 161320b4b960 18.0 landed
-
Fix order of parameters in a cost_sort call
- 87b6c3c0b703 18.0 landed
-
Show number of disabled nodes in EXPLAIN ANALYZE output.
- c01743aa4866 18.0 landed
-
Treat number of disabled nodes in a path as a separate cost metric.
- e22253467942 18.0 landed
-
Remove grotty use of disable_cost for TID scan plans.
- e4326fbc60c4 18.0 landed