pgsql: Adjust EXPLAIN's output for disabled nodes
От | David Rowley |
---|---|
Тема | pgsql: Adjust EXPLAIN's output for disabled nodes |
Дата | |
Msg-id | E1sz79l-000Giz-Ik@gemulon.postgresql.org обсуждение исходный текст |
Список | pgsql-committers |
Adjust EXPLAIN's output for disabled nodes c01743aa4 added EXPLAIN output to display the plan node's disabled_node count whenever that count is above 0. Seemingly, there weren't many people who liked that output as each parent of a disabled node would also have a "Disabled Nodes" output due to the way disabled_nodes is accumulated towards the root plan node. It was often hard and sometimes impossible to figure out which nodes were disabled from looking at EXPLAIN. You might think it would be possible to manually add up the numbers from the "Disabled Nodes" output of a given node's children to figure out if that node has a higher disabled_nodes count than its children, but that wouldn't have worked for Append and Merge Append nodes if some disabled child nodes were run-time pruned during init plan. Those children are not displayed in EXPLAIN. Here we attempt to improve this output by only showing "Disabled: true" against only the nodes which are explicitly disabled themselves. That seems to be the output that's desired by the most people who voiced their opinion. This is done by summing up the disabled_nodes of the given node's children and checking if that number is less than the disabled_nodes of the current node. This commit also fixes a bug in make_sort() which was neglecting to set the Sort's disabled_nodes field. This should have copied what was done in cost_sort(), but it hadn't been updated. With the new output, the choice to not maintain that field properly was clearly wrong as the disabled-ness of the node was attributed to the Sort's parent instead. Reviewed-by: Laurenz Albe, Alena Rybakina Discussion: https://postgr.es/m/9e4ad616bebb103ec2084bf6f724cfc739e7fabb.camel@cybertec.at Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/161320b4b960ee4fe918959be6529ae9b106ea5a Modified Files -------------- src/backend/commands/explain.c | 98 ++++++++++++++++++++++++- src/backend/optimizer/plan/createplan.c | 1 + src/test/regress/expected/aggregates.out | 27 +++---- src/test/regress/expected/btree_index.out | 5 +- src/test/regress/expected/collate.icu.utf8.out | 4 +- src/test/regress/expected/explain.out | 11 ++- src/test/regress/expected/incremental_sort.out | 8 +- src/test/regress/expected/inherit.out | 5 +- src/test/regress/expected/insert_conflict.out | 4 +- src/test/regress/expected/join.out | 5 +- src/test/regress/expected/memoize.out | 10 +-- src/test/regress/expected/select_parallel.out | 7 +- src/test/regress/expected/sqljson_jsontable.out | 1 + src/test/regress/expected/union.out | 2 +- src/test/regress/expected/xml.out | 3 + src/test/regress/expected/xml_1.out | 3 + src/test/regress/expected/xml_2.out | 3 + 17 files changed, 147 insertions(+), 50 deletions(-)
В списке pgsql-committers по дате отправления: