BTW, getting off the question of EXPLAIN output for a moment,
I don't understand why disable_cost is still a thing.  The
one remaining usage seems trivial to replace, as attached.

                        regards, tom lane

diff --git a/src/backend/optimizer/path/costsize.c b/src/backend/optimizer/path/costsize.c
index e1523d15df..a676ed2ef6 100644
--- a/src/backend/optimizer/path/costsize.c
+++ b/src/backend/optimizer/path/costsize.c
@@ -137,9 +137,6 @@ double		parallel_setup_cost = DEFAULT_PARALLEL_SETUP_COST;
 double		recursive_worktable_factor = DEFAULT_RECURSIVE_WORKTABLE_FACTOR;
 
 int			effective_cache_size = DEFAULT_EFFECTIVE_CACHE_SIZE;
-
-Cost		disable_cost = 1.0e10;
-
 int			max_parallel_workers_per_gather = 2;
 
 bool		enable_seqscan = true;
@@ -4355,15 +4352,15 @@ final_cost_hashjoin(PlannerInfo *root, HashPath *path,
 
 	/*
 	 * If the bucket holding the inner MCV would exceed hash_mem, we don't
-	 * want to hash unless there is really no other alternative, so apply
-	 * disable_cost.  (The executor normally copes with excessive memory usage
+	 * want to hash unless there is really no other alternative, so mark path
+	 * as disabled.  (The executor normally copes with excessive memory usage
 	 * by splitting batches, but obviously it cannot separate equal values
 	 * that way, so it will be unable to drive the batch size below hash_mem
 	 * when this is true.)
 	 */
 	if (relation_byte_size(clamp_row_est(inner_path_rows * innermcvfreq),
 						   inner_path->pathtarget->width) > get_hash_memory_limit())
-		startup_cost += disable_cost;
+		path->jpath.path.disabled_nodes++;
 
 	/*
 	 * Compute cost of the hashquals and qpquals (other restriction clauses)
diff --git a/src/include/optimizer/cost.h b/src/include/optimizer/cost.h
index 854a782944..ebd0e93f5e 100644
--- a/src/include/optimizer/cost.h
+++ b/src/include/optimizer/cost.h
@@ -47,7 +47,6 @@ typedef enum
  */
 
 /* parameter variables and flags (see also optimizer.h) */
-extern PGDLLIMPORT Cost disable_cost;
 extern PGDLLIMPORT int max_parallel_workers_per_gather;
 extern PGDLLIMPORT bool enable_seqscan;
 extern PGDLLIMPORT bool enable_indexscan;

Reply via email to