postgresql/src/backend/commands
David Rowley 161320b4b9 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
2024-10-11 17:19:59 +13:00
..
aggregatecmds.c Remove unused #include's from backend .c files 2024-03-04 12:02:20 +01:00
alter.c Repair ALTER EXTENSION ... SET SCHEMA. 2024-05-09 12:19:52 -04:00
amcmds.c Fix typos and duplicate words 2024-04-18 21:28:07 +02:00
analyze.c Add WAL usage reporting to ANALYZE VERBOSE output. 2024-09-09 14:56:08 -07:00
async.c Use more consistently int64 for page numbers in SLRU-related code 2024-07-23 17:59:05 +09:00
cluster.c Avoid repeating loads of frozen ID values. 2024-04-29 10:25:33 -07:00
collationcmds.c Remove lc_collate_is_c(). 2024-09-04 14:35:25 -07:00
comment.c Update copyright for 2024 2024-01-03 20:49:05 -05:00
constraint.c Add missing index_insert_cleanup calls 2024-04-19 16:08:34 +02:00
conversioncmds.c Remove unused #include's from backend .c files 2024-03-04 12:02:20 +01:00
copy.c Move check for binary mode and on_error option to the appropriate location. 2024-10-08 18:23:43 +09:00
copyfrom.c Add REJECT_LIMIT option to the COPY command. 2024-10-08 18:19:58 +09:00
copyfromparse.c Reject a copy EOF marker that has data ahead of it on the same line. 2024-10-01 16:53:54 -04:00
copyto.c Do not treat \. as an EOF marker in CSV mode for COPY IN. 2024-09-30 17:57:12 -04:00
createas.c Turn a few 'validnsps' static variables into locals 2024-08-06 23:03:43 +03:00
dbcommands.c For inplace update durability, make heap_update() callers wait. 2024-09-24 15:25:18 -07:00
define.c Remove unused #include's from backend .c files 2024-03-04 12:02:20 +01:00
discard.c Update copyright for 2024 2024-01-03 20:49:05 -05:00
dropcmds.c Remove unused #include's from backend .c files 2024-03-04 12:02:20 +01:00
event_trigger.c For inplace update durability, make heap_update() callers wait. 2024-09-24 15:25:18 -07:00
explain.c Adjust EXPLAIN's output for disabled nodes 2024-10-11 17:19:59 +13:00
extension.c Update extension lookup routines to use the syscache 2024-09-07 20:20:46 +09:00
foreigncmds.c Update copyright for 2024 2024-01-03 20:49:05 -05:00
functioncmds.c Disallow creating binary-coercible casts involving range types. 2024-08-21 12:00:03 -04:00
indexcmds.c Use generateClonedIndexStmt to propagate CREATE INDEX to partitions. 2024-10-05 14:46:44 -04:00
lockcmds.c Reintroduce MAINTAIN privilege and pg_maintain predefined role. 2024-03-13 14:49:26 -05:00
Makefile Implement pg_wal_replay_wait() stored procedure 2024-08-02 21:16:56 +03:00
matview.c Don't bother checking the result of SPI_connect[_ext] anymore. 2024-09-09 12:18:34 -04:00
meson.build Implement pg_wal_replay_wait() stored procedure 2024-08-02 21:16:56 +03:00
opclasscmds.c Remove unused #include's from backend .c files 2024-03-04 12:02:20 +01:00
operatorcmds.c Remove unused #include's from backend .c files 2024-03-04 12:02:20 +01:00
policy.c Remove unused #include's from backend .c files 2024-03-04 12:02:20 +01:00
portalcmds.c Update copyright for 2024 2024-01-03 20:49:05 -05:00
prepare.c Use TupleDescAttr macro consistently 2024-07-02 13:41:47 +12:00
proclang.c Remove unused #include's from backend .c files 2024-03-04 12:02:20 +01:00
publicationcmds.c Improve ALTER PUBLICATION validation and error messages 2024-08-15 13:10:25 +12:00
schemacmds.c Update copyright for 2024 2024-01-03 20:49:05 -05:00
seclabel.c Update copyright for 2024 2024-01-03 20:49:05 -05:00
sequence.c Repair pg_upgrade for identity sequences with non-default persistence. 2024-09-17 15:53:35 -04:00
statscmds.c Initialize variables to placate compiler. 2024-03-17 20:16:15 -05:00
subscriptioncmds.c Message style improvements 2024-08-29 14:43:34 +02:00
tablecmds.c Unbreak overflow test for attinhcount/coninhcount 2024-10-10 17:41:01 +02:00
tablespace.c Define PG_TBLSPC_DIR for path pg_tblspc/ in data folder 2024-09-03 09:11:54 +09:00
trigger.c Turn 'if' condition around to avoid Svace complaint 2024-09-25 16:42:02 +02:00
tsearchcmds.c Remove unused #include's from backend .c files 2024-03-04 12:02:20 +01:00
typecmds.c Add temporal PRIMARY KEY and UNIQUE constraints 2024-09-17 11:29:30 +02:00
user.c Assign error codes where missing for user-facing failures 2024-07-04 09:48:40 +09:00
vacuum.c Fix data loss at inplace update after heap_update(). 2024-09-24 15:25:18 -07:00
vacuumparallel.c Set query ID in parallel workers for vacuum, BRIN and btree 2024-09-30 08:43:28 +09:00
variable.c Use camel case for "DateStyle" in some error messages 2024-10-07 12:36:00 +09:00
view.c Separate equalRowTypes() from equalTupleDescs() 2024-03-17 05:58:04 +01:00
waitlsn.c Move pg_wal_replay_wait() to xlogfuncs.c 2024-09-19 14:26:11 +03:00