You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@impala.apache.org by jo...@apache.org on 2023/05/12 05:27:44 UTC

[impala] 02/03: IMPALA-12091: Control scan parallelism by its processing cost

This is an automated email from the ASF dual-hosted git repository.

joemcdonnell pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/impala.git

commit 1d0b111bcf090efa521e6bf09c0c2eebec4b8976
Author: Riza Suminto <ri...@cloudera.com>
AuthorDate: Thu Apr 20 17:31:59 2023 -0700

    IMPALA-12091: Control scan parallelism by its processing cost
    
    Before this patch, Impala still relies on MT_DOP option to decide the
    degree of parallelism of the scan fragment when a query runs with
    COMPUTE_PROCESSING_COST=1. This patch adds the scan node's processing
    cost as another consideration to raise scan parallelism beyond MT_DOP.
    
    Scan node cost is now adjusted to also consider the number of effective
    scan ranges. Each scan range is given a weight of (0.5% *
    min_processing_per_thread), which roughly means that one scan node
    instance can handle at most 200 scan ranges.
    
    Query option MAX_FRAGMENT_INSTANCES_PER_NODE is added as an upper
    bound on scan parallelism if COMPUTE_PROCESSING_COST=true. If the number
    of scan ranges is fewer than the maximum parallelism allowed by the scan
    node's processing cost, that processing cost will be clamped down
    to (min_processing_per_thread / number of scan ranges). Lowering
    MAX_FRAGMENT_INSTANCES_PER_NODE can also clamp down the scan processing
    cost in a similar way. For interior fragments, a combination of
    MAX_FRAGMENT_INSTANCES_PER_NODE, PROCESSING_COST_MIN_THREADS, and the
    number of available cores per node is accounted to determine maximum
    fragment parallelism per node. For scan fragment, only the first two are
    considered to encourage Frontend to choose a larger executor group as
    needed.
    
    Two new static state is added into exec-node.h: is_mt_fragment_ and
    num_instances_per_node_. The backend code that refers to the MT_DOP
    option is replaced with either is_mt_fragment_ or
    num_instances_per_node_.
    
    Two new criteria are added during effective parallelism calculation in
    PlanFragment.adjustToMaxParallelism():
    
    - If a fragment has UnionNode, its parallelism is the maximum between
      its input fragments and its collocated ScanNode's expected
      parallelism.
    - If a fragment only has a single ScanNode (and no UnionNode), its
      parallelism is calculated in the same fashion as the interior fragment
      but will not be lowered anymore since it will not have any child
      fragment to compare with.
    
    Admission control slots remain unchanged. This may cause a query to fail
    admission if Planner selects scan parallelism that is higher than the
    configured admission control slots value. Setting
    MAX_FRAGMENT_INSTANCES_PER_NODE equal to or lower than configured
    admission control slots value can help lower scan parallelism and pass
    the admission controller.
    
    The previous workaround to control scan parallelism by IMPALA-12029 is
    now removed. This patch also disables IMPALA-10287 optimization if
    COMPUTE_PROCESSING_COST=true. This is because IMPALA-10287 relies on a
    fixed number of fragment instances in DistributedPlanner.java. However,
    effective parallelism calculation is done much later and may change the
    final number of instances of hash join fragment, rendering
    DistributionMode selected by IMPALA-10287 inaccurate.
    
    This patch is benchmarked using single_node_perf_run.py with the
    following parameters:
    
    args="-gen_experimental_profile=true -default_query_options="
    args+="mt_dop=4,compute_processing_cost=1,processing_cost_min_threads=1 "
    ./bin/single_node_perf_run.py --num_impalads=3 --scale=10 \
        --workloads=tpcds --iterations=5 --table_formats=parquet/none/none \
        --impalad_args="$args" \
        --query_names=TPCDS-Q3,TPCDS-Q14-1,TPCDS-Q14-2,TPCDS-Q23-1,TPCDS-Q23-2,TPCDS-Q49,TPCDS-Q76,TPCDS-Q78,TPCDS-Q80A \
        "IMPALA-12091~1" IMPALA-12091
    
    The benchmark result is as follows:
    +-----------+-------------+-----------------------+--------+-------------+------------+------------+----------------+-------+----------------+---------+-------+
    | Workload  | Query       | File Format           | Avg(s) | Base Avg(s) | Delta(Avg) | StdDev(%)  | Base StdDev(%) | Iters | Median Diff(%) | MW Zval | Tval  |
    +-----------+-------------+-----------------------+--------+-------------+------------+------------+----------------+-------+----------------+---------+-------+
    | TPCDS(10) | TPCDS-Q23-1 | parquet / none / none | 4.62   | 4.54        |   +1.92%   |   0.23%    |   1.59%        | 5     |   +2.32%       | 1.15    | 2.67  |
    | TPCDS(10) | TPCDS-Q14-1 | parquet / none / none | 5.82   | 5.76        |   +1.08%   |   5.27%    |   3.89%        | 5     |   +2.04%       | 0.00    | 0.37  |
    | TPCDS(10) | TPCDS-Q23-2 | parquet / none / none | 4.65   | 4.58        |   +1.38%   |   1.97%    |   0.48%        | 5     |   +0.81%       | 0.87    | 1.51  |
    | TPCDS(10) | TPCDS-Q49   | parquet / none / none | 1.49   | 1.48        |   +0.46%   | * 36.02% * | * 34.95% *     | 5     |   +1.26%       | 0.58    | 0.02  |
    | TPCDS(10) | TPCDS-Q14-2 | parquet / none / none | 3.76   | 3.75        |   +0.39%   |   1.67%    |   0.58%        | 5     |   -0.03%       | -0.58   | 0.49  |
    | TPCDS(10) | TPCDS-Q78   | parquet / none / none | 2.80   | 2.80        |   -0.04%   |   1.32%    |   1.33%        | 5     |   -0.42%       | -0.29   | -0.05 |
    | TPCDS(10) | TPCDS-Q80A  | parquet / none / none | 2.87   | 2.89        |   -0.51%   |   1.33%    |   0.40%        | 5     |   -0.01%       | -0.29   | -0.82 |
    | TPCDS(10) | TPCDS-Q3    | parquet / none / none | 0.18   | 0.19        |   -1.29%   | * 15.26% * | * 15.87% *     | 5     |   -0.54%       | -0.87   | -0.13 |
    | TPCDS(10) | TPCDS-Q76   | parquet / none / none | 1.08   | 1.11        |   -2.98%   |   0.92%    |   1.70%        | 5     |   -3.99%       | -2.02   | -3.47 |
    +-----------+-------------+-----------------------+--------+-------------+------------+------------+----------------+-------+----------------+---------+-------+
    
    Testing:
    - Pass PlannerTest.testProcessingCost
    - Pass test_executor_groups.py
    - Reenable test_tpcds_q51a in TestTpcdsQueryWithProcessingCost with
      MAX_FRAGMENT_INSTANCES_PER_NODE set to 5
    - Pass test_tpcds_queries.py::TestTpcdsQueryWithProcessingCost
    - Pass core tests
    
    Change-Id: If948e45455275d9a61a6cd5d6a30a8b98a7c729a
    Reviewed-on: http://gerrit.cloudera.org:8080/19807
    Reviewed-by: Impala Public Jenkins <im...@cloudera.com>
    Tested-by: Impala Public Jenkins <im...@cloudera.com>
---
 be/src/exec/blocking-join-node.h                   |    2 +-
 be/src/exec/data-sink.h                            |    4 +-
 be/src/exec/exec-node.cc                           |   12 +
 be/src/exec/exec-node.h                            |   16 +-
 be/src/exec/hdfs-scanner.h                         |    3 +-
 be/src/exec/scan-node.cc                           |   61 +-
 be/src/exec/scan-node.h                            |   12 +-
 be/src/scheduling/scheduler.cc                     |  115 +-
 be/src/scheduling/scheduler.h                      |    9 +-
 be/src/service/query-options-test.cc               |    7 +-
 be/src/service/query-options.cc                    |   22 +-
 be/src/service/query-options.h                     |    4 +-
 common/thrift/ImpalaService.thrift                 |   10 +-
 common/thrift/Planner.thrift                       |    6 +-
 common/thrift/Query.thrift                         |    6 +
 .../java/org/apache/impala/analysis/Analyzer.java  |   35 +
 .../org/apache/impala/planner/AggregationNode.java |    3 +-
 .../apache/impala/planner/DistributedPlanner.java  |   10 +-
 .../org/apache/impala/planner/EmptySetNode.java    |    5 -
 .../org/apache/impala/planner/HashJoinNode.java    |   13 +-
 .../org/apache/impala/planner/HdfsScanNode.java    |    7 +-
 .../org/apache/impala/planner/HdfsTableSink.java   |    3 +-
 .../org/apache/impala/planner/KuduScanNode.java    |    2 +-
 .../org/apache/impala/planner/PlanFragment.java    |  218 +--
 .../java/org/apache/impala/planner/PlanNode.java   |   19 +-
 .../java/org/apache/impala/planner/Planner.java    |   64 +-
 .../org/apache/impala/planner/ProcessingCost.java  |   27 +-
 .../java/org/apache/impala/planner/ScanNode.java   |   61 +-
 .../java/org/apache/impala/planner/UnionNode.java  |    7 -
 .../java/org/apache/impala/service/Frontend.java   |   69 +-
 .../org/apache/impala/planner/PlannerTest.java     |    2 +-
 fe/src/test/resources/llama-site-3-groups.xml      |    4 +-
 .../queries/PlannerTest/tpcds-processing-cost.test | 1535 ++++++++++----------
 tests/custom_cluster/test_executor_groups.py       |  233 +--
 tests/query_test/test_insert.py                    |   29 +-
 tests/query_test/test_tpcds_queries.py             |    7 +-
 36 files changed, 1447 insertions(+), 1195 deletions(-)

diff --git a/be/src/exec/blocking-join-node.h b/be/src/exec/blocking-join-node.h
index 135cd8e93..66856dc0e 100644
--- a/be/src/exec/blocking-join-node.h
+++ b/be/src/exec/blocking-join-node.h
@@ -46,7 +46,7 @@ class BlockingJoinPlanNode : public PlanNode {
   /// Note: This depends on the containing subplan being initialized, and isn't accurate
   /// until the whole PlanNode tree has been initialized.
   bool UseSeparateBuild(const TQueryOptions& query_options) const {
-    return !IsInSubplan() && query_options.mt_dop > 0 && query_options.num_nodes != 1;
+    return !IsInSubplan() && query_options.num_nodes != 1 && is_mt_fragment();
   }
 
   TJoinOp::type join_op() const { return join_op_; }
diff --git a/be/src/exec/data-sink.h b/be/src/exec/data-sink.h
index 44823da41..8e094d1d5 100644
--- a/be/src/exec/data-sink.h
+++ b/be/src/exec/data-sink.h
@@ -45,8 +45,8 @@ class TInsertStats;
 
 /// Configuration class for creating DataSink objects. It contains a subset of the static
 /// state of their corresponding DataSink, of which there is one instance per fragment.
-/// DataSink contains the runtime state and there can be up to MT_DOP instances of it per
-/// fragment.
+/// DataSink contains the runtime state and there can be up to
+/// PlanNode::num_instances_per_node() of it per fragment.
 class DataSinkConfig {
  public:
   DataSinkConfig() = default;
diff --git a/be/src/exec/exec-node.cc b/be/src/exec/exec-node.cc
index 7d4bd3070..c456d3e69 100644
--- a/be/src/exec/exec-node.cc
+++ b/be/src/exec/exec-node.cc
@@ -83,6 +83,18 @@ Status PlanNode::Init(const TPlanNode& tnode, FragmentState* state) {
     RETURN_IF_ERROR(
         ScalarExpr::Create(tnode_->conjuncts, *row_descriptor_, state, &conjuncts_));
   }
+
+  if (state->query_options().compute_processing_cost) {
+    DCHECK_GT(state->fragment().effective_instance_count, 0);
+    is_mt_fragment_ = true;
+    num_instances_per_node_ = state->fragment().effective_instance_count;
+  } else if (state->query_options().mt_dop > 0) {
+    is_mt_fragment_ = true;
+    num_instances_per_node_ = state->query_options().mt_dop;
+  } else {
+    is_mt_fragment_ = false;
+    num_instances_per_node_ = 1;
+  }
   return Status::OK();
 }
 
diff --git a/be/src/exec/exec-node.h b/be/src/exec/exec-node.h
index 97bbc60fe..40d77a327 100644
--- a/be/src/exec/exec-node.h
+++ b/be/src/exec/exec-node.h
@@ -56,9 +56,9 @@ class ExecNode;
 /// PlanNode and ExecNode are the super-classes of all plan nodes and execution nodes
 /// respectively. The plan nodes contain a subset of the static state of their
 /// corresponding ExecNode, of which there is one instance per fragment. ExecNode contains
-/// only runtime state and there can be up to MT_DOP instances of it per fragment.
-/// Hence every ExecNode has a corresponding PlanNode which may or may not be at the same
-/// level of hierarchy as the ExecNode.
+/// only runtime state and there can be up to num_instances_per_node() of it per
+/// fragment. Hence every ExecNode has a corresponding PlanNode which may or may not be at
+/// the same level of hierarchy as the ExecNode.
 /// TODO: IMPALA-9216: Move all the static state of ExecNode into PlanNode.
 ///
 /// All subclasses need to make sure to check RuntimeState::is_cancelled()
@@ -128,6 +128,9 @@ class PlanNode {
   /// profile to convey codegen related information. Populated in Codegen().
   std::vector<std::string> codegen_status_msgs_;
 
+  bool is_mt_fragment() const { return is_mt_fragment_; }
+  int num_instances_per_node() const { return num_instances_per_node_; }
+
  protected:
   /// Helper method to add codegen messages from status objects.
   void AddCodegenStatus(
@@ -136,6 +139,13 @@ class PlanNode {
  private:
   DISALLOW_COPY_AND_ASSIGN(PlanNode);
 
+  /// Whether multi-threaded fragment strategy is being used.
+  /// ie., either MT_DOP>0 or COMPUTE_PROCESSING_COST=true.
+  bool is_mt_fragment_ = false;
+
+  /// The effective degree of parallelism of this fragment.
+  int num_instances_per_node_ = 1;
+
   /// Create a single exec node derived from thrift node; place exec node in 'pool'.
   static Status CreatePlanNode(ObjectPool* pool, const TPlanNode& tnode, PlanNode** node);
 
diff --git a/be/src/exec/hdfs-scanner.h b/be/src/exec/hdfs-scanner.h
index ec9096975..007a567a7 100644
--- a/be/src/exec/hdfs-scanner.h
+++ b/be/src/exec/hdfs-scanner.h
@@ -385,7 +385,8 @@ class HdfsScanner {
   vector<LocalFilterStats> filter_stats_;
 
   /// Counter for the number of batches returned from GetNext(). Only updated by the
-  /// GetNext() API (i.e. mt_dop > 0), not the ProcessSplit() API.
+  /// GetNext() API (i.e. PlanNode::num_instances_per_node() > 0),
+  /// not the ProcessSplit() API.
   int64_t getnext_batches_returned_ = 0;
 
   /// Check runtime filters' effectiveness every BATCHES_PER_FILTER_SELECTIVITY_CHECK
diff --git a/be/src/exec/scan-node.cc b/be/src/exec/scan-node.cc
index afe6ef6fd..3b7935f20 100644
--- a/be/src/exec/scan-node.cc
+++ b/be/src/exec/scan-node.cc
@@ -128,11 +128,10 @@ Status ScanPlanNode::CreateExecNode(RuntimeState* state, ExecNode** node) const
       break;
     case TPlanNodeType::KUDU_SCAN_NODE:
       if (tnode_->kudu_scan_node.use_mt_scan_node) {
-        DCHECK_GT(state->query_options().mt_dop, 0);
+        DCHECK(is_mt_fragment());
         *node = pool->Add(new KuduScanNodeMt(pool, *this, state->desc_tbl()));
       } else {
-        DCHECK(state->query_options().mt_dop == 0
-            || state->query_options().num_scanner_threads == 1);
+        DCHECK(!is_mt_fragment() || state->query_options().num_scanner_threads == 1);
         *node = pool->Add(new KuduScanNode(pool, *this, state->desc_tbl()));
       }
       break;
@@ -273,30 +272,40 @@ void ScanNode::ScannerThreadState::Open(
     ScanNode* parent, int64_t max_row_batches_override) {
   RuntimeState* state = parent->runtime_state_;
   max_num_scanner_threads_ = CpuInfo::num_cores();
-  if (state->query_options().num_scanner_threads > 0) {
-    max_num_scanner_threads_ = state->query_options().num_scanner_threads;
-  }
-  DCHECK_GT(max_num_scanner_threads_, 0);
-
   int max_row_batches = max_row_batches_override;
-  if (max_row_batches_override <= 0) {
-    // Legacy heuristic to determine the size, based on the idea that more disks means a
-    // faster producer. Also used for Kudu under the assumption that the scan runs
-    // co-located with a Kudu tablet server and that the tablet server is using disks
-    // similarly as a datanode would.
-    // TODO: IMPALA-7096: re-evaluate this heuristic to get a tighter bound on memory
-    // consumption, we could do something better.
-    max_row_batches = max(1, min(
-        10 * (DiskInfo::num_disks() + io::DiskIoMgr::REMOTE_NUM_DISKS),
-        max_num_scanner_threads_ * FLAGS_max_queued_row_batches_per_scanner_thread));
-  }
-  if (state->query_options().__isset.mt_dop && state->query_options().mt_dop > 0) {
-    // To avoid a significant memory increase when running the multithreaded scans
-    // with mt_dop > 0 (if mt_dop is not supported for this scan), then adjust the number
-    // of maximally queued row batches per scan instance based on MT_DOP. The max
-    // materialized row batches is at least 2 to allow for some parallelism between
-    // the producer/consumer.
-    max_row_batches = max(2, max_row_batches / state->query_options().mt_dop);
+
+  if (state->query_options().compute_processing_cost) {
+    // If COMPUTE_PROCESSING_COST=true, we fix the maximum num scanner threads to 1 per
+    // instance and maximum row batches to 2.
+    max_num_scanner_threads_ = 1;
+    max_row_batches = 2;
+  } else {
+    if (state->query_options().num_scanner_threads > 0) {
+      max_num_scanner_threads_ = state->query_options().num_scanner_threads;
+    }
+    DCHECK_GT(max_num_scanner_threads_, 0);
+
+    if (max_row_batches_override <= 0) {
+      // Legacy heuristic to determine the size, based on the idea that more disks means a
+      // faster producer. Also used for Kudu under the assumption that the scan runs
+      // co-located with a Kudu tablet server and that the tablet server is using disks
+      // similarly as a datanode would.
+      // TODO: IMPALA-7096: re-evaluate this heuristic to get a tighter bound on memory
+      // consumption, we could do something better.
+      max_row_batches = max(1,
+          min(10 * (DiskInfo::num_disks() + io::DiskIoMgr::REMOTE_NUM_DISKS),
+              max_num_scanner_threads_
+                  * FLAGS_max_queued_row_batches_per_scanner_thread));
+    }
+    if (parent->plan_node().is_mt_fragment()) {
+      // To avoid a significant memory increase when running the multithreaded scans
+      // (if multithreaded fragment is not supported for this scan), then adjust the
+      // number of maximally queued row batches per scan instance based on
+      // num_instances_per_node(). The max materialized row batches is at least 2 to allow
+      // for some parallelism between the producer/consumer.
+      max_row_batches =
+          max(2, max_row_batches / parent->plan_node().num_instances_per_node());
+    }
   }
   VLOG(2) << "Max row batch queue size for scan node '" << parent->id()
           << "' in fragment instance '" << PrintId(state->fragment_instance_id())
diff --git a/be/src/exec/scan-node.h b/be/src/exec/scan-node.h
index e61f1790c..3e47de395 100644
--- a/be/src/exec/scan-node.h
+++ b/be/src/exec/scan-node.h
@@ -260,10 +260,14 @@ class ScanNode : public ExecNode {
     /// Thread group for all scanner threads.
     ThreadGroup scanner_threads_;
 
-    /// Maximum number of scanner threads. Set to 'NUM_SCANNER_THREADS' if that query
-    /// option is set. Otherwise, it's set to the number of cpu cores. Scanner threads
-    /// are generally cpu bound so there is no benefit in spinning up more threads than
-    /// the number of cores. Set in Open().
+    /// Maximum number of scanner threads.
+    /// The value is set to either of the following:
+    /// - 1, if COMPUTE_PROCESSING_COST=true;
+    /// - 'NUM_SCANNER_THREADS', if that query option is set and
+    ///   COMPUTE_PROCESSING_COST=false;
+    /// - Otherwise, it's set to the number of cpu cores.
+    /// Scanner threads are generally cpu bound so there is no benefit in spinning up
+    /// more threads than the number of cores. Set in Open().
     int max_num_scanner_threads_ = 0;
 
     /// Estimated amount of memory that each additional scanner thread will consume. Used
diff --git a/be/src/scheduling/scheduler.cc b/be/src/scheduling/scheduler.cc
index 9f4a96592..57a080815 100644
--- a/be/src/scheduling/scheduler.cc
+++ b/be/src/scheduling/scheduler.cc
@@ -31,6 +31,7 @@
 #include "gen-cpp/DataSinks_types.h"
 #include "gen-cpp/ErrorCodes_types.h"
 #include "gen-cpp/ImpalaInternalService_types.h"
+#include "gen-cpp/Query_constants.h"
 #include "gen-cpp/Types_types.h"
 #include "gen-cpp/common.pb.h"
 #include "gen-cpp/statestore_service.pb.h"
@@ -208,7 +209,7 @@ Status Scheduler::ComputeScanRangeAssignment(
   return Status::OK();
 }
 
-void Scheduler::ComputeFragmentExecParams(
+Status Scheduler::ComputeFragmentExecParams(
     const ExecutorConfig& executor_config, ScheduleState* state) {
   const TQueryExecRequest& exec_request = state->request();
 
@@ -218,8 +219,8 @@ void Scheduler::ComputeFragmentExecParams(
   // be easily co-located with the plans consuming their output.
   for (const TPlanExecInfo& plan_exec_info : exec_request.plan_exec_info) {
     // set instance_id, host, per_node_scan_ranges
-    ComputeFragmentExecParams(executor_config, plan_exec_info,
-        state->GetFragmentScheduleState(plan_exec_info.fragments[0].idx), state);
+    RETURN_IF_ERROR(ComputeFragmentExecParams(executor_config, plan_exec_info,
+        state->GetFragmentScheduleState(plan_exec_info.fragments[0].idx), state));
 
     // Set destinations, per_exch_num_senders, sender_id.
     for (const TPlanFragment& src_fragment : plan_exec_info.fragments) {
@@ -262,35 +263,81 @@ void Scheduler::ComputeFragmentExecParams(
       }
     }
   }
+  return Status::OK();
 }
 
-void Scheduler::CheckEffectiveInstanceCount(
+Status Scheduler::CheckEffectiveInstanceCount(
     const FragmentScheduleState* fragment_state, const ScheduleState* state) {
+  // These checks are only intended if COMPUTE_PROCESSING_COST=true.
+  if (!state->query_options().compute_processing_cost) return Status::OK();
+
   int effective_instance_count = fragment_state->fragment.effective_instance_count;
-  if (effective_instance_count > 0) {
-    if (ContainsUnionNode(fragment_state->fragment.plan)
-        || ContainsScanNode(fragment_state->fragment.plan)
-        || IsExceedMaxFsWriters(fragment_state, fragment_state, state)) {
-      // TODO: Fragment with UnionNode or ScanNode or one where IsExceedMaxFsWriters
-      // equals true is not checked for now since it require further modification of the
-      // scan-range based scheduling in CreateCollocatedAndScanInstances().
-      return;
+  if (effective_instance_count < fragment_state->instance_states.size()) {
+    return Status(
+        Substitute("$0 scheduled $1 instances, higher than the effective count ($2). "
+                   "Consider running the query with COMPUTE_PROCESSING_COST=false.",
+            fragment_state->fragment.display_name, fragment_state->instance_states.size(),
+            effective_instance_count));
+  }
+
+  DCHECK(!fragment_state->instance_states.empty());
+  // Find host with the largest instance assignment.
+  // Initialize to the first fragment instance.
+  int largest_inst_idx = 0;
+  int largest_inst_per_host = 1;
+  int this_inst_count = 1;
+  int num_host = 1;
+  for (int i = 1; i < fragment_state->instance_states.size(); i++) {
+    if (fragment_state->instance_states[i].host
+        == fragment_state->instance_states[i - 1].host) {
+      this_inst_count++;
+    } else {
+      if (largest_inst_per_host < this_inst_count) {
+        largest_inst_per_host = this_inst_count;
+        largest_inst_idx = i - 1;
+      }
+      this_inst_count = 1;
+      num_host++;
     }
+  }
+  if (largest_inst_per_host < this_inst_count) {
+    largest_inst_per_host = this_inst_count;
+    largest_inst_idx = fragment_state->instance_states.size() - 1;
+  }
+
+  QueryConstants qc;
+  if (largest_inst_per_host > qc.MAX_FRAGMENT_INSTANCES_PER_NODE) {
+    return Status(Substitute(
+        "$0 scheduled $1 instances, higher than maximum instances per node ($2). "
+        "Consider running the query with COMPUTE_PROCESSING_COST=false.",
+        fragment_state->fragment.display_name, largest_inst_per_host,
+        qc.MAX_FRAGMENT_INSTANCES_PER_NODE));
+  }
 
-    DCHECK_GE(effective_instance_count, fragment_state->instance_states.size())
-        << fragment_state->fragment.display_name
-        << " scheduled higher than the effective count.";
+  int planned_inst_per_host = ceil((float)effective_instance_count / num_host);
+  if (largest_inst_per_host > planned_inst_per_host) {
+    stringstream err_msg;
+    err_msg << fragment_state->fragment.display_name
+            << " has imbalance number of instance to host assignment."
+            << " Consider running the query with COMPUTE_PROCESSING_COST=false."
+            << " Host " << fragment_state->instance_states[largest_inst_idx].host
+            << " has " << largest_inst_per_host << " instances assigned."
+            << " effective_instance_count=" << effective_instance_count
+            << " planned_inst_per_host=" << planned_inst_per_host
+            << " num_host=" << num_host;
+    return Status(err_msg.str());
   }
+  return Status::OK();
 }
 
-void Scheduler::ComputeFragmentExecParams(const ExecutorConfig& executor_config,
+Status Scheduler::ComputeFragmentExecParams(const ExecutorConfig& executor_config,
     const TPlanExecInfo& plan_exec_info, FragmentScheduleState* fragment_state,
     ScheduleState* state) {
   // Create exec params for child fragments connected by an exchange. Instance creation
   // for this fragment depends on where the input fragment instances are scheduled.
   for (FragmentIdx input_fragment_idx : fragment_state->exchange_input_fragments) {
-    ComputeFragmentExecParams(executor_config, plan_exec_info,
-        state->GetFragmentScheduleState(input_fragment_idx), state);
+    RETURN_IF_ERROR(ComputeFragmentExecParams(executor_config, plan_exec_info,
+        state->GetFragmentScheduleState(input_fragment_idx), state));
   }
 
   const TPlanFragment& fragment = fragment_state->fragment;
@@ -370,7 +417,7 @@ void Scheduler::ComputeFragmentExecParams(const ExecutorConfig& executor_config,
     // follow the effective_instance_count specified by planner.
     CreateInputCollocatedInstances(fragment_state, state);
   }
-  CheckEffectiveInstanceCount(fragment_state, state);
+  return CheckEffectiveInstanceCount(fragment_state, state);
 }
 
 // Maybe the easiest way to understand the objective of this algorithm is as a
@@ -459,11 +506,24 @@ void Scheduler::CreateCollocatedAndScanInstances(const ExecutorConfig& executor_
     int& host_num_instances = instances_per_host[host_addr];
     host_num_instances = max(1, host_num_instances);
   }
-  DCHECK(!instances_per_host.empty()) << "no hosts for fragment " << fragment.idx;
+  DCHECK(!instances_per_host.empty())
+      << "no hosts for fragment " << fragment.idx << " (" << fragment.display_name << ")";
+
+  const TQueryOptions& request_query_option =
+      state->request().query_ctx.client_request.query_options;
+  int max_num_instances = 1;
+  if (request_query_option.compute_processing_cost) {
+    // Numbers should follow 'effective_instance_count' from planner.
+    // 'effective_instance_count' is total instances across all executors.
+    DCHECK(fragment.effective_instance_count > 0);
+    int inst_per_host =
+        ceil((float)fragment.effective_instance_count / instances_per_host.size());
+    max_num_instances = max(1, inst_per_host);
+  } else {
+    // Number of instances should be bounded by mt_dop.
+    max_num_instances = max(1, request_query_option.mt_dop);
+  }
 
-  // Number of instances should be bounded by mt_dop.
-  int max_num_instances =
-      max(1, state->request().query_ctx.client_request.query_options.mt_dop);
   // Track the index of the next instance to be created for this fragment.
   int per_fragment_instance_idx = 0;
   for (const auto& entry : instances_per_host) {
@@ -492,7 +552,12 @@ void Scheduler::CreateCollocatedAndScanInstances(const ExecutorConfig& executor_
     int num_instances = entry.second;
     DCHECK_GE(num_instances, 1);
     DCHECK_LE(num_instances, max_num_instances)
-        << "Input parallelism too high for mt_dop";
+        << "Input parallelism too high. Fragment " << fragment.display_name
+        << " num_host=" << instances_per_host.size()
+        << " scan_host_count=" << scan_hosts.size()
+        << " mt_dop=" << request_query_option.mt_dop
+        << " compute_processing_cost=" << request_query_option.compute_processing_cost
+        << " effective_instance_count=" << fragment.effective_instance_count;
     for (const auto& per_scan_ranges : per_scan_per_instance_ranges) {
       num_instances = max(num_instances, static_cast<int>(per_scan_ranges.size()));
     }
@@ -846,7 +911,7 @@ void Scheduler::GetScanHosts(const vector<TPlanNodeId>& scan_ids,
 Status Scheduler::Schedule(const ExecutorConfig& executor_config, ScheduleState* state) {
   RETURN_IF_ERROR(DebugAction(state->query_options(), "SCHEDULER_SCHEDULE"));
   RETURN_IF_ERROR(ComputeScanRangeAssignment(executor_config, state));
-  ComputeFragmentExecParams(executor_config, state);
+  RETURN_IF_ERROR(ComputeFragmentExecParams(executor_config, state));
   ComputeBackendExecParams(executor_config, state);
 #ifndef NDEBUG
   state->Validate();
diff --git a/be/src/scheduling/scheduler.h b/be/src/scheduling/scheduler.h
index 084d9cb34..600a74851 100644
--- a/be/src/scheduling/scheduler.h
+++ b/be/src/scheduling/scheduler.h
@@ -365,13 +365,13 @@ class Scheduler {
   /// This includes the routing information (destinations, per_exch_num_senders,
   /// sender_id)
   /// 'executor_config' is the executor configuration to use for scheduling.
-  void ComputeFragmentExecParams(
+  Status ComputeFragmentExecParams(
       const ExecutorConfig& executor_config, ScheduleState* state);
 
   /// Recursively create FInstanceScheduleState and set per_node_scan_ranges for
   /// fragment_state and its input fragments via a depth-first traversal.
   /// All fragments are part of plan_exec_info.
-  void ComputeFragmentExecParams(const ExecutorConfig& executor_config,
+  Status ComputeFragmentExecParams(const ExecutorConfig& executor_config,
       const TPlanExecInfo& plan_exec_info, FragmentScheduleState* fragment_state,
       ScheduleState* state);
 
@@ -383,7 +383,8 @@ class Scheduler {
   /// joins or grouping aggregates as children runs on at least as many hosts as the
   /// input to those children).
   ///
-  /// The maximum number of instances per host is the value of query option mt_dop.
+  /// The maximum number of instances per host is the value of query option mt_dop,
+  /// or fragment's effective_instance_count if compute_processing_cost=true.
   /// For HDFS, this load balances among instances within a host using
   /// AssignRangesToInstances().
   void CreateCollocatedAndScanInstances(const ExecutorConfig& executor_config,
@@ -442,7 +443,7 @@ class Scheduler {
   /// If TPlanFragment.effective_instance_count is positive, verify that resulting
   /// instance_states size match with effective_instance_count. Fragment with UnionNode or
   /// ScanNode or one where IsExceedMaxFsWriters equals true is not checked.
-  static void CheckEffectiveInstanceCount(
+  static Status CheckEffectiveInstanceCount(
       const FragmentScheduleState* fragment_state, const ScheduleState* state);
 
   /// Check if sink_fragment_state has hdfs_table_sink AND ref_fragment_state scheduled
diff --git a/be/src/service/query-options-test.cc b/be/src/service/query-options-test.cc
index 152f13c6d..f4e9ab9cf 100644
--- a/be/src/service/query-options-test.cc
+++ b/be/src/service/query-options-test.cc
@@ -21,6 +21,7 @@
 #include <boost/preprocessor/seq/for_each.hpp>
 #include <boost/preprocessor/tuple/to_seq.hpp>
 
+#include "gen-cpp/Query_constants.h"
 #include "gutil/strings/substitute.h"
 #include "runtime/runtime-filter.h"
 #include "testutil/gtest-util.h"
@@ -243,6 +244,7 @@ TEST(QueryOptions, SetEnumOptions) {
 // Test integer options. Some of them have lower/upper bounds.
 TEST(QueryOptions, SetIntOptions) {
   TQueryOptions options;
+  QueryConstants qc;
   // List of pairs of Key and its valid range
   pair<OptionDef<int32_t>, Range<int32_t>> case_set[]{
       {MAKE_OPTIONDEF(runtime_filter_wait_time_ms),    {0, I32_MAX}},
@@ -259,7 +261,10 @@ TEST(QueryOptions, SetIntOptions) {
       {MAKE_OPTIONDEF(max_cnf_exprs),                  {-1, I32_MAX}},
       {MAKE_OPTIONDEF(max_fs_writers),                 {0, I32_MAX}},
       {MAKE_OPTIONDEF(default_ndv_scale),              {1, 10}},
-      {MAKE_OPTIONDEF(processing_cost_min_threads),    {1, 128}},
+      {MAKE_OPTIONDEF(processing_cost_min_threads),
+          {1, qc.MAX_FRAGMENT_INSTANCES_PER_NODE}},
+      {MAKE_OPTIONDEF(max_fragment_instances_per_node),
+          {1, qc.MAX_FRAGMENT_INSTANCES_PER_NODE}},
   };
   for (const auto& test_case : case_set) {
     const OptionDef<int32_t>& option_def = test_case.first;
diff --git a/be/src/service/query-options.cc b/be/src/service/query-options.cc
index 201962fdf..da959234d 100644
--- a/be/src/service/query-options.cc
+++ b/be/src/service/query-options.cc
@@ -26,6 +26,7 @@
 
 #include "exprs/timezone_db.h"
 #include "gen-cpp/ImpalaInternalService_types.h"
+#include "gen-cpp/Query_constants.h"
 #include "runtime/runtime-filter.h"
 #include "service/query-option-parser.h"
 #include "util/debug-util.h"
@@ -200,6 +201,7 @@ Status impala::SetQueryOption(const string& key, const string& value,
     return Status(Substitute("Invalid query option: $0", key));
   }
 
+  QueryConstants qc;
   TImpalaQueryOptions::type option = static_cast<TImpalaQueryOptions::type>(option_int);
 
   if (value.empty()) {
@@ -1068,10 +1070,11 @@ Status impala::SetQueryOption(const string& key, const string& value,
         StringParser::ParseResult result;
         const int32_t min_num =
             StringParser::StringToInt<int32_t>(value.c_str(), value.length(), &result);
-        if (result != StringParser::PARSE_SUCCESS || min_num < 1 || min_num > 128) {
+        if (result != StringParser::PARSE_SUCCESS || min_num < 1
+            || min_num > qc.MAX_FRAGMENT_INSTANCES_PER_NODE) {
           return Status(Substitute("$0 is not valid for processing_cost_min_threads. "
-                                   "Valid values are in [1, 128].",
-              value));
+                                   "Valid values are in [1, $1].",
+              value, qc.MAX_FRAGMENT_INSTANCES_PER_NODE));
         }
         query_options->__set_processing_cost_min_threads(min_num);
         break;
@@ -1083,6 +1086,19 @@ Status impala::SetQueryOption(const string& key, const string& value,
         query_options->__set_join_selectivity_correlation_factor(double_val);
         break;
       }
+      case TImpalaQueryOptions::MAX_FRAGMENT_INSTANCES_PER_NODE: {
+        StringParser::ParseResult result;
+        const int32_t max_num =
+            StringParser::StringToInt<int32_t>(value.c_str(), value.length(), &result);
+        if (result != StringParser::PARSE_SUCCESS || max_num < 1
+            || max_num > qc.MAX_FRAGMENT_INSTANCES_PER_NODE) {
+          return Status(Substitute("$0 is not valid for max_fragment_instances_per_node. "
+                                   "Valid values are in [1, $1].",
+              value, qc.MAX_FRAGMENT_INSTANCES_PER_NODE));
+        }
+        query_options->__set_max_fragment_instances_per_node(max_num);
+        break;
+      }
       default:
         if (IsRemovedQueryOption(key)) {
           LOG(WARNING) << "Ignoring attempt to set removed query option '" << key << "'";
diff --git a/be/src/service/query-options.h b/be/src/service/query-options.h
index 2a721c9b2..db47664ec 100644
--- a/be/src/service/query-options.h
+++ b/be/src/service/query-options.h
@@ -50,7 +50,7 @@ typedef std::unordered_map<string, beeswax::TQueryOptionLevel::type>
 // time we add or remove a query option to/from the enum TImpalaQueryOptions.
 #define QUERY_OPTS_TABLE                                                                 \
   DCHECK_EQ(_TImpalaQueryOptions_VALUES_TO_NAMES.size(),                                 \
-      TImpalaQueryOptions::JOIN_SELECTIVITY_CORRELATION_FACTOR + 1);                     \
+      TImpalaQueryOptions::MAX_FRAGMENT_INSTANCES_PER_NODE + 1);                         \
   REMOVED_QUERY_OPT_FN(abort_on_default_limit_exceeded, ABORT_ON_DEFAULT_LIMIT_EXCEEDED) \
   QUERY_OPT_FN(abort_on_error, ABORT_ON_ERROR, TQueryOptionLevel::REGULAR)               \
   REMOVED_QUERY_OPT_FN(allow_unsupported_formats, ALLOW_UNSUPPORTED_FORMATS)             \
@@ -289,6 +289,8 @@ typedef std::unordered_map<string, beeswax::TQueryOptionLevel::type>
   QUERY_OPT_FN(processing_cost_min_threads, PROCESSING_COST_MIN_THREADS,                 \
       TQueryOptionLevel::ADVANCED)                                                       \
   QUERY_OPT_FN(join_selectivity_correlation_factor, JOIN_SELECTIVITY_CORRELATION_FACTOR, \
+      TQueryOptionLevel::ADVANCED)                                                       \
+  QUERY_OPT_FN(max_fragment_instances_per_node, MAX_FRAGMENT_INSTANCES_PER_NODE,         \
       TQueryOptionLevel::ADVANCED);
 
 /// Enforce practical limits on some query options to avoid undesired query state.
diff --git a/common/thrift/ImpalaService.thrift b/common/thrift/ImpalaService.thrift
index f4859fde1..07d69ab89 100644
--- a/common/thrift/ImpalaService.thrift
+++ b/common/thrift/ImpalaService.thrift
@@ -770,7 +770,7 @@ enum TImpalaQueryOptions {
   // Control whether to consider CPU processing cost during query planning.
   COMPUTE_PROCESSING_COST = 153;
 
-  // Minimum number of threads of a query fragment per host in processing
+  // Minimum number of threads of a query fragment per node in processing
   // cost algorithm. It is recommend to not set it with value more than number of
   // physical cores in executor node. Valid values are in [1, 128]. Default to 1.
   PROCESSING_COST_MIN_THREADS = 154;
@@ -783,6 +783,14 @@ enum TImpalaQueryOptions {
   // this to a value between 0 to 1 computes the combined selectivity by
   // taking the product of the selectivities and dividing by this factor.
   JOIN_SELECTIVITY_CORRELATION_FACTOR = 155;
+
+  // Maximum number of threads of a query fragment per node in processing
+  // cost algorithm. It is recommend to not set it with value more than number of
+  // physical cores in executor node. This query option may be ignored if selected
+  // executor group has lower max-query-cpu-core-per-node-limit configuration or
+  // PROCESSING_COST_MIN_THREADS option has higher value.
+  // Valid values are in [1, 128]. Default to 128.
+  MAX_FRAGMENT_INSTANCES_PER_NODE = 156
 }
 
 // The summary of a DML statement.
diff --git a/common/thrift/Planner.thrift b/common/thrift/Planner.thrift
index 5eb11c452..c18294395 100644
--- a/common/thrift/Planner.thrift
+++ b/common/thrift/Planner.thrift
@@ -86,9 +86,9 @@ struct TPlanFragment {
 
   // The effective number of parallelism for this fragment that dictated by the frontend
   // planner. If the frontend planner set this to a positive number, the backend scheduler
-  // must make sure that it schedules no more than this many instance fragments. Currently
-  // not enforced on fragments having scan nodes or union nodes or when fragment need to
-  // exceed max_fs_writers query option (see IMPALA-8125).
+  // must make sure that it schedules no more than this many instance fragments. Must be
+  // greater than 0 if query option COMPUTE_PROCESSING_COST=true. Currently not enforced
+  // when fragment need to exceed max_fs_writers query option (see IMPALA-8125).
   14: optional i32 effective_instance_count
 }
 
diff --git a/common/thrift/Query.thrift b/common/thrift/Query.thrift
index e04c20779..f482d21b5 100644
--- a/common/thrift/Query.thrift
+++ b/common/thrift/Query.thrift
@@ -111,6 +111,9 @@ enum TParquetBloomFilterWrite {
 // constants for TQueryOptions.num_nodes
 const i32 NUM_NODES_ALL = 0
 const i32 NUM_NODES_ALL_RACKS = -1
+// constant used as upperbound for TQueryOptions.processing_cost_min_threads and
+// TQueryOptions.max_fragment_instances_per_node
+const i32 MAX_FRAGMENT_INSTANCES_PER_NODE = 128
 
 // Query options that correspond to ImpalaService.ImpalaQueryOptions, with their
 // respective defaults. Query options can be set in the following ways:
@@ -627,6 +630,9 @@ struct TQueryOptions {
 
   // See comment in ImpalaService.thrift
   156: optional double join_selectivity_correlation_factor = 0.0;
+
+  // See comment in ImpalaService.thrift
+  157: optional i32 max_fragment_instances_per_node = MAX_FRAGMENT_INSTANCES_PER_NODE
 }
 
 // Impala currently has three types of sessions: Beeswax, HiveServer2 and external
diff --git a/fe/src/main/java/org/apache/impala/analysis/Analyzer.java b/fe/src/main/java/org/apache/impala/analysis/Analyzer.java
index b8d537487..fd3dce68e 100644
--- a/fe/src/main/java/org/apache/impala/analysis/Analyzer.java
+++ b/fe/src/main/java/org/apache/impala/analysis/Analyzer.java
@@ -99,6 +99,7 @@ import org.apache.impala.rewrite.SimplifyDistinctFromRule;
 import org.apache.impala.rewrite.CountDistinctToNdvRule;
 import org.apache.impala.rewrite.DefaultNdvScaleRule;
 import org.apache.impala.service.FeSupport;
+import org.apache.impala.thrift.QueryConstants;
 import org.apache.impala.thrift.TAccessEvent;
 import org.apache.impala.thrift.TCatalogObjectType;
 import org.apache.impala.thrift.TLineageGraph;
@@ -158,6 +159,7 @@ public class Analyzer {
   public static final byte ACCESSTYPE_READ = (byte)2;
   public static final byte ACCESSTYPE_WRITE = (byte)4;
   public static final byte ACCESSTYPE_READWRITE = (byte)8;
+
   // Common analysis error messages
   public final static String DB_DOES_NOT_EXIST_ERROR_MSG = "Database does not exist: ";
   public final static String DB_ALREADY_EXISTS_ERROR_MSG = "Database already exists: ";
@@ -575,6 +577,8 @@ public class Analyzer {
     // singleton.
     private int numExecutorsForPlanning_ = -1;
 
+    private int availableCoresPerNode_ = -1;
+
     // Cache of KuduTables opened for this query. (map from table name to kudu table)
     // This cache prevent multiple openTable calls for a given table in the same query.
     public final Map<String, org.apache.kudu.client.KuduTable> kuduTables =
@@ -646,6 +650,37 @@ public class Analyzer {
     globalState_.numExecutorsForPlanning_ = x;
   }
 
+  public int getAvailableCoresPerNode() {
+    Preconditions.checkState(globalState_.availableCoresPerNode_ > 0);
+    return globalState_.availableCoresPerNode_;
+  }
+
+  public void setAvailableCoresPerNode(int x) {
+    Preconditions.checkArgument(x > 0);
+    globalState_.availableCoresPerNode_ =
+        Math.min(QueryConstants.MAX_FRAGMENT_INSTANCES_PER_NODE, x);
+  }
+
+  public int getMinParallelismPerNode() {
+    if (getQueryOptions().isCompute_processing_cost()) {
+      return getQueryOptions().getProcessing_cost_min_threads();
+    } else {
+      return 1;
+    }
+  }
+
+  public int getMaxParallelismPerNode() {
+    if (getQueryOptions().isCompute_processing_cost()) {
+      return Math.max(getMinParallelismPerNode(),
+          Math.min(getQueryOptions().getMax_fragment_instances_per_node(),
+              getAvailableCoresPerNode()));
+    } else if (getQueryOptions().getMt_dop() > 0) {
+      return getQueryOptions().getMt_dop();
+    } else {
+      return 1;
+    }
+  }
+
   // An analyzer stores analysis state for a single select block. A select block can be
   // a top level select statement, or an inline view select block.
   // ancestors contains the Analyzers of the enclosing select blocks of 'this'
diff --git a/fe/src/main/java/org/apache/impala/planner/AggregationNode.java b/fe/src/main/java/org/apache/impala/planner/AggregationNode.java
index e4eea634c..2b095f02c 100644
--- a/fe/src/main/java/org/apache/impala/planner/AggregationNode.java
+++ b/fe/src/main/java/org/apache/impala/planner/AggregationNode.java
@@ -537,8 +537,7 @@ public class AggregationNode extends PlanNode {
       TQueryOptions queryOptions, AggregateInfo aggInfo) {
     Preconditions.checkNotNull(
         fragment_, "PlanNode must be placed into a fragment before calling this method.");
-    long perInstanceCardinality =
-        fragment_.getPerInstanceNdv(queryOptions.getMt_dop(), aggInfo.getGroupingExprs());
+    long perInstanceCardinality = fragment_.getPerInstanceNdv(aggInfo.getGroupingExprs());
     long perInstanceMemEstimate;
     long perInstanceDataBytes = -1;
     if (perInstanceCardinality == -1) {
diff --git a/fe/src/main/java/org/apache/impala/planner/DistributedPlanner.java b/fe/src/main/java/org/apache/impala/planner/DistributedPlanner.java
index 56e54a7b2..b6559f44b 100644
--- a/fe/src/main/java/org/apache/impala/planner/DistributedPlanner.java
+++ b/fe/src/main/java/org/apache/impala/planner/DistributedPlanner.java
@@ -509,7 +509,8 @@ public class DistributedPlanner {
         // because it must be broadcast once per instance.
         long dataPayload = rhsDataSize * leftChildNodes;
         long hashTblBuildCost = dataPayload;
-        if (mt_dop > 1 && ctx_.getQueryOptions().use_dop_for_costing) {
+        if (mt_dop > 1 && ctx_.getQueryOptions().use_dop_for_costing
+            && !ProcessingCost.isComputeCost(ctx_.getQueryOptions())) {
           // In the broadcast join a single thread per node is building the hash
           // table of size N compared to the partition case where m threads are
           // building hash tables of size N/m each (assuming uniform distribution).
@@ -517,8 +518,11 @@ public class DistributedPlanner {
           // we multiply the hash table build cost by C sqrt(m) where m = plan node's
           // parallelism and C = a coefficient that controls the function's rate of
           // growth (a tunable parameter). We use the sqrt to model a non-linear
-          // function since the slowdown with broadcast is not exactly linear (TODO:
-          // more analysis is needed to establish an accurate correlation).
+          // function since the slowdown with broadcast is not exactly linear.
+          // TODO: more analysis is needed to establish an accurate correlation.
+          // TODO: this cost calculation is disabled if COMPUTE_PROCESSING_COST=true
+          // since num instances might change after plan created during
+          // Planner.computeProcessingCost() later. Need to find way to enable this back.
           PlanNode leftPlanRoot = leftChildFragment.getPlanRoot();
           int actual_dop = leftPlanRoot.getNumInstances()/leftPlanRoot.getNumNodes();
           hashTblBuildCost *= (long) (ctx_.getQueryOptions().broadcast_to_partition_factor
diff --git a/fe/src/main/java/org/apache/impala/planner/EmptySetNode.java b/fe/src/main/java/org/apache/impala/planner/EmptySetNode.java
index 02bdcff1f..c57a515d6 100644
--- a/fe/src/main/java/org/apache/impala/planner/EmptySetNode.java
+++ b/fe/src/main/java/org/apache/impala/planner/EmptySetNode.java
@@ -83,9 +83,4 @@ public class EmptySetNode extends PlanNode {
 
   @Override
   protected boolean displayCardinality(TExplainLevel detailLevel) { return false; }
-
-  @Override
-  protected boolean isLeafNode() {
-    return true;
-  }
 }
diff --git a/fe/src/main/java/org/apache/impala/planner/HashJoinNode.java b/fe/src/main/java/org/apache/impala/planner/HashJoinNode.java
index 7aeee7433..d521bc49c 100644
--- a/fe/src/main/java/org/apache/impala/planner/HashJoinNode.java
+++ b/fe/src/main/java/org/apache/impala/planner/HashJoinNode.java
@@ -282,12 +282,17 @@ public class HashJoinNode extends JoinNode {
         computeMaxSpillableBufferSize(bufferSize, queryOptions.getMax_row_size());
     long perInstanceBuildMinMemReservation =
         bufferSize * (minBuildBuffers - 2) + maxRowBufferSize * 2;
-    if (queryOptions.mt_dop > 0 && canShareBuild()) {
+    if (Planner.useMTFragment(queryOptions) && canShareBuild()) {
       // Ensure we reserve enough memory to hand off to the PartitionedHashJoinNodes for
-      // probe streams when spilling. mt_dop is an upper bound on the number of
-      // PartitionedHashJoinNodes per builder.
+      // probe streams when spilling. numInstancePerHost is an upper bound on the number
+      // of PartitionedHashJoinNodes per builder.
       // TODO: IMPALA-9416: be less conservative here
-      perInstanceBuildMinMemReservation *= queryOptions.mt_dop;
+      // TODO: In case of compute_processing_cost=false, it is probably OK to stil use
+      //     getNumInstancesPerHost(). Leave this for future work to avoid regression.
+      int numInstancePerHost = queryOptions.compute_processing_cost ?
+          fragment_.getNumInstancesPerHost(queryOptions) :
+          queryOptions.getMt_dop();
+      perInstanceBuildMinMemReservation *= numInstancePerHost;
     }
     // Most reservation for probe buffers is obtained from the join builder when
     // spilling. However, for NAAJ, two additional probe streams are needed that
diff --git a/fe/src/main/java/org/apache/impala/planner/HdfsScanNode.java b/fe/src/main/java/org/apache/impala/planner/HdfsScanNode.java
index ea48a3bc9..3b6320a8c 100644
--- a/fe/src/main/java/org/apache/impala/planner/HdfsScanNode.java
+++ b/fe/src/main/java/org/apache/impala/planner/HdfsScanNode.java
@@ -2118,7 +2118,7 @@ public class HdfsScanNode extends ScanNode {
   @Override
   public void computeNodeResourceProfile(TQueryOptions queryOptions) {
     // Update 'useMtScanNode_' before any return cases. It's used in BE.
-    useMtScanNode_ = queryOptions.mt_dop > 0;
+    useMtScanNode_ = Planner.useMTFragment(queryOptions);
     Preconditions.checkNotNull(scanRangeSpecs_, "Cost estimation requires scan ranges.");
     long scanRangeSize = getEffectiveNumScanRanges();
     if (scanRangeSize == 0) {
@@ -2170,6 +2170,11 @@ public class HdfsScanNode extends ScanNode {
     long perThreadIoBuffers =
         Math.min((long) Math.ceil(avgScanRangeBytes / (double) maxIoBufferSize),
             MAX_IO_BUFFERS_PER_THREAD) + 1;
+    if (queryOptions.compute_processing_cost) {
+      // In scan-node.cc, we fix max_row_batches to a constant of 2.
+      Preconditions.checkState(maxScannerThreads == 1);
+      perThreadIoBuffers = 2;
+    }
     long perInstanceMemEstimate = checkedMultiply(
         checkedMultiply(maxScannerThreads, perThreadIoBuffers), maxIoBufferSize);
 
diff --git a/fe/src/main/java/org/apache/impala/planner/HdfsTableSink.java b/fe/src/main/java/org/apache/impala/planner/HdfsTableSink.java
index 8c6df6174..d93c96bab 100644
--- a/fe/src/main/java/org/apache/impala/planner/HdfsTableSink.java
+++ b/fe/src/main/java/org/apache/impala/planner/HdfsTableSink.java
@@ -158,8 +158,7 @@ public class HdfsTableSink extends TableSink {
       // If the insert is clustered, it produces a single partition at a time.
       numBufferedPartitionsPerInstance = 1;
     } else {
-      numBufferedPartitionsPerInstance =
-          fragment_.getPerInstanceNdv(queryOptions.getMt_dop(), partitionKeyExprs_);
+      numBufferedPartitionsPerInstance = fragment_.getPerInstanceNdv(partitionKeyExprs_);
       if (numBufferedPartitionsPerInstance == -1) {
         numBufferedPartitionsPerInstance = DEFAULT_NUM_PARTITIONS;
       }
diff --git a/fe/src/main/java/org/apache/impala/planner/KuduScanNode.java b/fe/src/main/java/org/apache/impala/planner/KuduScanNode.java
index 98a4520b6..e774f114b 100644
--- a/fe/src/main/java/org/apache/impala/planner/KuduScanNode.java
+++ b/fe/src/main/java/org/apache/impala/planner/KuduScanNode.java
@@ -422,7 +422,7 @@ public class KuduScanNode extends ScanNode {
         kudu_scanner_thread_max_estimated_bytes;
     long mem_estimate_per_thread = Math.min(getNumMaterializedSlots(desc_) *
         estimated_bytes_per_column_per_thread, max_estimated_bytes_per_thread);
-    useMtScanNode_ = queryOptions.mt_dop > 0;
+    useMtScanNode_ = Planner.useMTFragment(queryOptions);
     nodeResourceProfile_ = new ResourceProfileBuilder()
         .setMemEstimateBytes(mem_estimate_per_thread * maxScannerThreads)
         .setThreadReservation(useMtScanNode_ ? 0 : 1).build();
diff --git a/fe/src/main/java/org/apache/impala/planner/PlanFragment.java b/fe/src/main/java/org/apache/impala/planner/PlanFragment.java
index 6c27ed8d3..e7614e7a0 100644
--- a/fe/src/main/java/org/apache/impala/planner/PlanFragment.java
+++ b/fe/src/main/java/org/apache/impala/planner/PlanFragment.java
@@ -17,7 +17,6 @@
 
 package org.apache.impala.planner;
 
-import java.math.RoundingMode;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
@@ -34,7 +33,6 @@ import org.apache.impala.common.TreeNode;
 import org.apache.impala.planner.JoinNode.DistributionMode;
 import org.apache.impala.planner.PlanNode.ExecPhaseResourceProfiles;
 import org.apache.impala.planner.RuntimeFilterGenerator.RuntimeFilter;
-import org.apache.impala.service.BackendConfig;
 import org.apache.impala.thrift.TExplainLevel;
 import org.apache.impala.thrift.TPartitionType;
 import org.apache.impala.thrift.TPlanFragment;
@@ -49,7 +47,6 @@ import com.google.common.base.Predicates;
 import com.google.common.collect.ImmutableList;
 import com.google.common.collect.Lists;
 import com.google.common.math.IntMath;
-import com.google.common.math.LongMath;
 
 /**
  * PlanFragments form a tree structure via their ExchangeNodes. A tree of fragments
@@ -148,7 +145,7 @@ public class PlanFragment extends TreeNode<PlanFragment> {
   private CostingSegment rootSegment_;
 
   // Maximum allowed parallelism based on minimum processing load per fragment.
-  // Set in getCostBasedMaxParallelism().
+  // Set in adjustToMaxParallelism().
   private int costBasedMaxParallelism_ = -1;
 
   // An adjusted number of instance based on ProcessingCost calculation.
@@ -259,14 +256,13 @@ public class PlanFragment extends TreeNode<PlanFragment> {
    *
    * @param queryOptions A query options for this query.
    */
-  public void computeCostingSegment(
-      TQueryOptions queryOptions, boolean limitScanParallelism) {
-    for (PlanNode node : collectPlanNodes()) {
-      if (node instanceof ScanNode) {
-        ((ScanNode) node).setLimitScanParallelism(limitScanParallelism);
-      }
+  public void computeCostingSegment(TQueryOptions queryOptions) {
+    List<PlanNode> planNodes = collectPlanNodes();
+    // Iterate node list in reverse from leaf to root.
+    for (int i = planNodes.size() - 1; i >= 0; i--) {
+      PlanNode node = planNodes.get(i);
       node.computeProcessingCost(queryOptions);
-      node.computeRowConsumptionAndProductionToCost(limitScanParallelism);
+      node.computeRowConsumptionAndProductionToCost();
       if (LOG.isTraceEnabled()) {
         LOG.trace("ProcessingCost Node " + node.getProcessingCost().debugString());
       }
@@ -485,8 +481,8 @@ public class PlanFragment extends TreeNode<PlanFragment> {
   /*
    * Return the resource profile for all instances on a single backend.
    */
-  public ResourceProfile getTotalPerBackendResourceProfile(int mtDop) {
-    return perInstanceResourceProfile_.multiply(getNumInstancesPerHost(mtDop))
+  public ResourceProfile getTotalPerBackendResourceProfile(TQueryOptions queryOptions) {
+    return perInstanceResourceProfile_.multiply(getNumInstancesPerHost(queryOptions))
         .sum(perBackendResourceProfile_);
   }
 
@@ -513,12 +509,15 @@ public class PlanFragment extends TreeNode<PlanFragment> {
    * Return an estimate of the number of instances of this fragment per host that it
    * executes on.
    */
-  public int getNumInstancesPerHost(int mt_dop) {
+  public int getNumInstancesPerHost(TQueryOptions queryOptions) {
     // Assume that instances are evenly divided across hosts.
     int numNodes = getNumNodes();
     int numInstances = getNumInstances();
-    // Fall back to assuming that all mt_dop instances will be generated.
-    if (numNodes == -1 || numInstances == -1) return Math.max(1, mt_dop);
+    if (numNodes == -1 || numInstances == -1) {
+      Preconditions.checkState(!queryOptions.isCompute_processing_cost());
+      // Fall back to assuming that all maxDop instances will be generated.
+      return Math.max(1, queryOptions.getMt_dop());
+    }
     return (int) Math.ceil((double)numInstances / (double)numNodes);
   }
 
@@ -546,7 +545,7 @@ public class PlanFragment extends TreeNode<PlanFragment> {
     * Returns -1 for an invalid estimate, e.g., because getNumDistinctValues() failed on
     * one of the exprs.
     */
-  public long getPerInstanceNdv(int mt_dop, List<Expr> exprs) {
+  public long getPerInstanceNdv(List<Expr> exprs) {
     Preconditions.checkNotNull(dataPartition_);
     long result = 1;
     int numInstances = getNumInstances();
@@ -662,25 +661,25 @@ public class PlanFragment extends TreeNode<PlanFragment> {
    */
   public String getFragmentHeaderString(String firstLinePrefix, String detailPrefix,
       TQueryOptions queryOptions, TExplainLevel explainLevel) {
-    int mt_dop = queryOptions.getMt_dop();
+    boolean isComputeCost = ProcessingCost.isComputeCost(queryOptions);
+    boolean useMTFragment = Planner.useMTFragment(queryOptions);
     StringBuilder builder = new StringBuilder();
     builder.append(String.format("%s%s:PLAN FRAGMENT [%s]", firstLinePrefix,
         fragmentId_.toString(), dataPartition_.getExplainString()));
     builder.append(PrintUtils.printNumHosts(" ", getNumNodes()));
     builder.append(PrintUtils.printNumInstances(" ", getNumInstances()));
-    if (ProcessingCost.isComputeCost(queryOptions)
-        && originalInstanceCount_ != getNumInstances()) {
+    if (isComputeCost && originalInstanceCount_ != getNumInstances()) {
       builder.append(" (adjusted from " + originalInstanceCount_ + ")");
     }
     builder.append("\n");
-    String perHostPrefix = mt_dop == 0 ?
-        "Per-Host Resources: " : "Per-Host Shared Resources: ";
+    String perHostPrefix =
+        !useMTFragment ? "Per-Host Resources: " : "Per-Host Shared Resources: ";
     String perHostExplainString = null;
     String perInstanceExplainString = null;
-    if (mt_dop == 0) {
+    if (!useMTFragment) {
       // There is no point separating out per-host and per-instance resources when there
       // is only a single instance per host so combine them together.
-      ResourceProfile perHostProfile = getTotalPerBackendResourceProfile(mt_dop);
+      ResourceProfile perHostProfile = getTotalPerBackendResourceProfile(queryOptions);
       StringBuilder perHostBuilder = new StringBuilder(perHostProfile.getExplainString());
       long totalRuntimeFilterReservation = producedRuntimeFiltersMemReservationBytes_
           + consumedGlobalRuntimeFiltersMemReservationBytes_;
@@ -725,16 +724,15 @@ public class PlanFragment extends TreeNode<PlanFragment> {
       builder.append(perInstanceExplainString);
       builder.append("\n");
     }
-    if (ProcessingCost.isComputeCost(queryOptions) && rootSegment_ != null
+    if (isComputeCost && rootSegment_ != null
         && explainLevel.ordinal() >= TExplainLevel.EXTENDED.ordinal()) {
       // Print processing cost.
       builder.append(detailPrefix);
       builder.append("max-parallelism=");
-      if (isFixedParallelism_
-          || ((sink_ instanceof JoinBuildSink) && !((JoinBuildSink) sink_).isShared())) {
-        builder.append(getAdjustedInstanceCount());
+      if (costBasedMaxParallelism_ > 0) {
+        builder.append(costBasedMaxParallelism_);
       } else {
-        builder.append(getCostBasedMaxParallelism());
+        builder.append(getAdjustedInstanceCount());
       }
       builder.append(" segment-costs=");
       builder.append(costingSegmentSummary());
@@ -877,13 +875,11 @@ public class PlanFragment extends TreeNode<PlanFragment> {
   /**
    * Get maximum allowed parallelism based on minimum processing load per fragment.
    * <p>This is controlled by {@code min_processing_per_thread} flag. Only valid after
-   * {@link #computeCostingSegment(TQueryOptions, boolean)} has been called.
+   * {@link #computeCostingSegment(TQueryOptions)} has been called.
    *
    * @return maximum allowed parallelism based on minimum processing load per fragment.
    */
   protected int getCostBasedMaxParallelism() {
-    if (costBasedMaxParallelism_ >= 0) return costBasedMaxParallelism_;
-
     ProcessingCost maxCostingSegment = ProcessingCost.zero();
     List<CostingSegment> allSegments = rootSegment_.getNodesPostOrder();
     for (CostingSegment costingSegment : allSegments) {
@@ -891,23 +887,7 @@ public class PlanFragment extends TreeNode<PlanFragment> {
           ProcessingCost.maxCost(maxCostingSegment, costingSegment.getProcessingCost());
     }
 
-    long maxParallelism = LongMath.divide(maxCostingSegment.getTotalCost(),
-        BackendConfig.INSTANCE.getMinProcessingPerThread(), RoundingMode.CEILING);
-    // Round up to the nearest multiple of numNodes.
-    // Little over-parallelize is better than under-parallelize.
-    int numNodes = getNumNodes();
-    maxParallelism =
-        LongMath.divide(maxParallelism, numNodes, RoundingMode.CEILING) * numNodes;
-
-    if (maxParallelism <= 0) {
-      costBasedMaxParallelism_ = 1;
-    } else if (maxParallelism <= Integer.MAX_VALUE) {
-      costBasedMaxParallelism_ = (int) maxParallelism;
-    } else {
-      // Floor Integer.MAX_VALUE to the nearest multiple of numNodes.
-      costBasedMaxParallelism_ = Integer.MAX_VALUE - (Integer.MAX_VALUE % numNodes);
-    }
-    return costBasedMaxParallelism_;
+    return maxCostingSegment.getNumInstanceMax(getNumNodes());
   }
 
   protected boolean hasBlockingNode() {
@@ -997,21 +977,20 @@ public class PlanFragment extends TreeNode<PlanFragment> {
    * @param minThreadPerNode Minimum thread per fragment per node based on
    *                         {@code PROCESSING_COST_MIN_THREADS} query option.
    * @param maxThreadPerNode Maximum thread per fragment per node based on
-   *                         {@code max(PROCESSING_COST_MIN_THREADS, MT_DOP,
+   *                         {@code max(PROCESSING_COST_MIN_THREADS,
    *                         TExecutorGroupSet.num_cores_per_executor)}.
    * @param parentParallelism Number of instance of parent fragment.
-   * @param limitScanParallelism Whether scan nodes parallelism is fixed to MT_DOP or not.
    */
-  protected void traverseEffectiveParallelism(int minThreadPerNode, int maxThreadPerNode,
-      int parentParallelism, boolean limitScanParallelism) {
+  protected void traverseEffectiveParallelism(
+      int minThreadPerNode, int maxThreadPerNode, int parentParallelism) {
     Preconditions.checkNotNull(
         rootSegment_, "ProcessingCost Fragment %s has not been computed!", getId());
     int nodeStepCount = getNumInstances() % getNumNodes() == 0 ? getNumNodes() : 1;
 
     // step 1: Set initial parallelism to the maximum possible.
     //   Subsequent steps after this will not exceed maximum parallelism sets here.
-    boolean canTryLower = adjustToMaxParallelism(minThreadPerNode, maxThreadPerNode,
-        parentParallelism, nodeStepCount, limitScanParallelism);
+    boolean canTryLower = adjustToMaxParallelism(
+        minThreadPerNode, maxThreadPerNode, parentParallelism, nodeStepCount);
 
     if (canTryLower) {
       // step 2: Try lower parallelism by comparing output ProcessingCost of the input
@@ -1040,8 +1019,8 @@ public class PlanFragment extends TreeNode<PlanFragment> {
     //   parallelism to match the child fragment parallelism.
     for (PlanFragment child : getChildren()) {
       if (child.getSink() instanceof JoinBuildSink) {
-        child.traverseEffectiveParallelism(minThreadPerNode, maxThreadPerNode,
-            getAdjustedInstanceCount(), limitScanParallelism);
+        child.traverseEffectiveParallelism(
+            minThreadPerNode, maxThreadPerNode, getAdjustedInstanceCount());
       }
     }
   }
@@ -1052,17 +1031,16 @@ public class PlanFragment extends TreeNode<PlanFragment> {
    * @param minThreadPerNode Minimum thread per fragment per node based on
    *                         {@code PROCESSING_COST_MIN_THREADS} query option.
    * @param maxThreadPerNode Maximum thread per fragment per node based on
-   *                         {@code max(PROCESSING_COST_MIN_THREADS, MT_DOP,
+   *                         {@code max(PROCESSING_COST_MIN_THREADS,
    *                         TExecutorGroupSet.num_cores_per_executor)}.
    * @param parentParallelism Parallelism of parent fragment.
    * @param nodeStepCount The step count used to increase this fragment's parallelism.
    *                      Usually equal to number of nodes or just 1.
-   * @param limitScanParallelism Whether scan nodes parallelism is fixed to MT_DOP or not.
    * @return True if it is possible to lower this fragment's parallelism through
    * ProcessingCost comparison. False if the parallelism should not be changed anymore.
    */
   private boolean adjustToMaxParallelism(int minThreadPerNode, int maxThreadPerNode,
-      int parentParallelism, int nodeStepCount, boolean limitScanParallelism) {
+      int parentParallelism, int nodeStepCount) {
     boolean canTryLower = true;
     // Compute maximum allowed parallelism.
     int maxParallelism = getNumInstances();
@@ -1080,46 +1058,82 @@ public class PlanFragment extends TreeNode<PlanFragment> {
       maxParallelism = parentParallelism;
       canTryLower = false; // no need to compute effective parallelism anymore.
     } else {
-      // TODO: Fragment with UnionNode but without ScanNode should have its parallelism
-      //   bounded by the maximum parallelism between its exchanging child.
-      //   For now, it wont get here since fragment with UnionNode has fixed parallelism
-      //   (equal to MT_DOP, and previouslyAdjusted == true).
-      //   However, a fragment that has leaf node (EmptySetNode, ScanNode, or UnionNode)
-      //   may still reach this code if this is the first planning round over selected
-      //   executor group (see IMPALA-12029).
-      maxParallelism = IntMath.saturatedMultiply(maxThreadPerNode, getNumNodes());
-      int minParallelism = IntMath.saturatedMultiply(minThreadPerNode, getNumNodes());
-      int costBasedMaxParallelism = Math.max(nodeStepCount, getCostBasedMaxParallelism());
-      if (costBasedMaxParallelism < maxParallelism) {
-        if (costBasedMaxParallelism < minParallelism) {
-          maxParallelism = minParallelism;
-          canTryLower = false;
-          if (LOG.isTraceEnabled()) {
-            logCountAdjustmentTrace(
-                getNumInstances(), maxParallelism, "Follow minThreadPerNode.");
-          }
-        } else {
-          maxParallelism = costBasedMaxParallelism;
-          if (LOG.isTraceEnabled()) {
-            logCountAdjustmentTrace(
-                getNumInstances(), maxParallelism, "Follow minimum work per thread.");
-          }
+      if (hasUnionNode()) {
+        // We set parallelism of union fragment as a max between its input fragments and
+        // its collocated ScanNode's expected parallelism
+        // (see Scheduler::CreateCollocatedAndScanInstances()).
+        // We skip any join builder child fragment here because their parallelism
+        // is not adjusted yet.
+        maxParallelism = 1;
+        for (PlanFragment child : getChildren()) {
+          if (child.getSink() instanceof JoinBuildSink) continue;
+          Preconditions.checkState(child.hasAdjustedInstanceCount());
+          maxParallelism = Math.max(maxParallelism, child.getAdjustedInstanceCount());
+        }
+
+        List<ScanNode> scanNodes = Lists.newArrayList();
+        collectPlanNodes(Predicates.instanceOf(ScanNode.class), scanNodes);
+        for (ScanNode scanNode : scanNodes) {
+          // Increase maxParallelism following ScanNode with largest effective scan range
+          // count.
+          maxParallelism =
+              Math.max(maxParallelism, scanNode.getMaxScannerThreads(nodeStepCount));
         }
+        canTryLower = false;
       } else {
-        if (LOG.isTraceEnabled()) {
-          logCountAdjustmentTrace(
-              getNumInstances(), maxParallelism, "Follow maxThreadPerNode.");
+        // This is an interior fragment or fragment with single scan node.
+        // We calculate maxParallelism, minParallelism, and costBasedMaxParallelism across
+        // all executors in the selected executor group.
+        maxParallelism = IntMath.saturatedMultiply(maxThreadPerNode, getNumNodes());
+
+        // Bound maxParallelism by ScanNode's effective scan range count if this fragment
+        // has ScanNode.
+        List<ScanNode> scanNodes = Lists.newArrayList();
+        collectPlanNodes(Predicates.instanceOf(ScanNode.class), scanNodes);
+        if (!scanNodes.isEmpty()) {
+          Preconditions.checkState(scanNodes.size() <= 1);
+          ScanNode scanNode = scanNodes.get(0);
+          int maxScannerThreads = scanNode.getMaxScannerThreads(nodeStepCount);
+          if (nodeStepCount == getNumNodes()) {
+            Preconditions.checkState(maxScannerThreads >= getNumNodes(),
+                "nodeStepCount=" + nodeStepCount + " getNumNodes=" + getNumNodes()
+                    + " maxScannerThreads=" + maxScannerThreads);
+          } else {
+            // This fragment parallelism is limited by its scan range count.
+            Preconditions.checkState(nodeStepCount == 1);
+            Preconditions.checkState(maxScannerThreads <= getNumNodes(),
+                "nodeStepCount=" + nodeStepCount + " getNumNodes=" + getNumNodes()
+                    + " maxScannerThreads=" + maxScannerThreads);
+          }
+          maxParallelism = Math.min(maxParallelism, maxScannerThreads);
+          // Prevent caller from lowering parallelism if fragment has ScanNode.
+          canTryLower = false;
         }
-      }
 
-      if (!limitScanParallelism) {
-        // If this is the first round of executor group planning, then it is possible for
-        // scan/leaf node to have its parallelism NOT fixed to MT_DOP. In that case
-        // prevent the next step from lowering parallelism.
-        for (PlanNode node : collectPlanNodes()) {
-          if (node.isLeafNode()) {
+        int minParallelism = Math.min(
+            maxParallelism, IntMath.saturatedMultiply(minThreadPerNode, getNumNodes()));
+        int costBasedMaxParallelism_ =
+            Math.max(nodeStepCount, getCostBasedMaxParallelism());
+
+        if (costBasedMaxParallelism_ < maxParallelism) {
+          if (costBasedMaxParallelism_ < minParallelism) {
+            maxParallelism = minParallelism;
             canTryLower = false;
-            break;
+            if (LOG.isTraceEnabled()) {
+              logCountAdjustmentTrace(
+                  getNumInstances(), maxParallelism, "Follow minThreadPerNode.");
+            }
+          } else {
+            maxParallelism = costBasedMaxParallelism_;
+            if (LOG.isTraceEnabled()) {
+              logCountAdjustmentTrace(
+                  getNumInstances(), maxParallelism, "Follow minimum work per thread.");
+            }
+          }
+        } else {
+          if (LOG.isTraceEnabled()) {
+            logCountAdjustmentTrace(
+                getNumInstances(), maxParallelism, "Follow maxThreadPerNode.");
           }
         }
       }
@@ -1130,6 +1144,18 @@ public class PlanFragment extends TreeNode<PlanFragment> {
     return canTryLower;
   }
 
+  private boolean hasUnionNode() {
+    List<ScanNode> nodes = Lists.newArrayList();
+    collectPlanNodes(Predicates.instanceOf(UnionNode.class), nodes);
+    return !nodes.isEmpty();
+  }
+
+  private boolean hasScanNode() {
+    List<ScanNode> nodes = Lists.newArrayList();
+    collectPlanNodes(Predicates.instanceOf(ScanNode.class), nodes);
+    return !nodes.isEmpty();
+  }
+
   /**
    * Compute {@link CoreCount} of this fragment and populate it into 'fragmentCoreState'.
    * @param fragmentCoreState A map holding per-fragment core state.
@@ -1160,7 +1186,7 @@ public class PlanFragment extends TreeNode<PlanFragment> {
   /**
    * Override parallelism of this fragment with adjusted parallelism from CPU costing
    * algorithm.
-   * <p>Only valid after {@link #traverseEffectiveParallelism(int, int, int, boolean)}
+   * <p>Only valid after {@link #traverseEffectiveParallelism(int, int, int)}
    * called.
    */
   protected void setEffectiveNumInstance() {
diff --git a/fe/src/main/java/org/apache/impala/planner/PlanNode.java b/fe/src/main/java/org/apache/impala/planner/PlanNode.java
index 59c95d8a7..1e3923394 100644
--- a/fe/src/main/java/org/apache/impala/planner/PlanNode.java
+++ b/fe/src/main/java/org/apache/impala/planner/PlanNode.java
@@ -914,31 +914,20 @@ abstract public class PlanNode extends TreeNode<PlanNode> {
 
   /**
    * Compute peak resources consumed when executing this PlanNode, initializing
-   * 'nodeResourceProfile_' and 'processingCost_'. May only be called after this PlanNode
+   * 'nodeResourceProfile_'. May only be called after this PlanNode
    * has been placed in a PlanFragment because the cost computation is dependent on the
    * enclosing fragment's data partition.
    */
   public abstract void computeNodeResourceProfile(TQueryOptions queryOptions);
 
-  /**
-   * Determine whether a PlanNode is a leaf node within the plan tree.
-   * @return true if a PlanNode is a leaf node within the plan tree.
-   */
-  protected boolean isLeafNode() { return false; }
-
   /**
    * Set number of rows consumed and produced data fields in processing cost.
    */
-  public void computeRowConsumptionAndProductionToCost(boolean limitScanParallelism) {
+  public void computeRowConsumptionAndProductionToCost() {
     Preconditions.checkState(processingCost_.isValid(),
         "Processing cost of PlanNode " + getDisplayLabel() + " is invalid!");
     processingCost_.setNumRowToConsume(getInputCardinality());
     processingCost_.setNumRowToProduce(getCardinality());
-    if ((isLeafNode() && limitScanParallelism)
-        && (!fragment_.hasAdjustedInstanceCount()
-            || fragment_.getAdjustedInstanceCount() < getNumInstances())) {
-      fragment_.setFixedInstanceCount(getNumInstances());
-    }
   }
 
   /**
@@ -1030,10 +1019,10 @@ abstract public class PlanNode extends TreeNode<PlanNode> {
 
   /**
    * Returns the max number of instances of a fragment that can be scheduled on a single
-   * node - the mt_dop value if mt_dop > 0, or 1 otherwise.
+   * node.
    */
   protected int getMaxInstancesPerNode(Analyzer analyzer) {
-    return Math.max(1, analyzer.getQueryOptions().getMt_dop());
+    return Math.max(1, analyzer.getMaxParallelismPerNode());
   }
 
   protected void addRuntimeFilter(RuntimeFilter filter) { runtimeFilters_.add(filter); }
diff --git a/fe/src/main/java/org/apache/impala/planner/Planner.java b/fe/src/main/java/org/apache/impala/planner/Planner.java
index 891a6004f..3dfc288f6 100644
--- a/fe/src/main/java/org/apache/impala/planner/Planner.java
+++ b/fe/src/main/java/org/apache/impala/planner/Planner.java
@@ -43,6 +43,7 @@ import org.apache.impala.common.Pair;
 import org.apache.impala.common.PrintUtils;
 import org.apache.impala.common.RuntimeEnv;
 import org.apache.impala.service.BackendConfig;
+import org.apache.impala.thrift.QueryConstants;
 import org.apache.impala.thrift.TExplainLevel;
 import org.apache.impala.thrift.TMinmaxFilteringLevel;
 import org.apache.impala.thrift.TQueryCtx;
@@ -276,11 +277,16 @@ public class Planner {
 
   /**
    * Return true if we should generate a parallel plan for this query, based on the
-   * current mt_dop value and whether a single-node plan was chosen.
+   * current parallelism mode and whether a single-node plan was chosen.
    */
   public static boolean useParallelPlan(PlannerContext planCtx) {
-    Preconditions.checkState(planCtx.getQueryOptions().isSetMt_dop());
-    return planCtx.getQueryOptions().mt_dop > 0 && !planCtx.isSingleNodeExec();
+    return useMTFragment(planCtx.getQueryOptions()) && !planCtx.isSingleNodeExec();
+  }
+
+  // Return true if MT_DOP>0 or COMPUTE_PROCESSING_COST=true.
+  public static boolean useMTFragment(TQueryOptions queryOptions) {
+    Preconditions.checkState(queryOptions.isSetMt_dop());
+    return queryOptions.getMt_dop() > 0 || queryOptions.isCompute_processing_cost();
   }
 
   /**
@@ -419,17 +425,20 @@ public class Planner {
    * Adjust effective parallelism of each plan fragment of query after considering
    * processing cost rate and blocking operator.
    * <p>
-   * Only valid after {@link PlanFragment#computeCostingSegment(TQueryOptions, boolean)}
+   * Only valid after {@link PlanFragment#computeCostingSegment(TQueryOptions)}
    * has been called for all plan fragments in the list.
    */
-  private static void computeEffectiveParallelism(List<PlanFragment> postOrderFragments,
-      int minThreadPerNode, int maxThreadPerNode, boolean limitScanParallelism) {
+  private static void computeEffectiveParallelism(
+      List<PlanFragment> postOrderFragments, int minThreadPerNode, int maxThreadPerNode) {
+    Preconditions.checkArgument(minThreadPerNode > 0);
+    Preconditions.checkArgument(maxThreadPerNode >= minThreadPerNode);
+    Preconditions.checkArgument(
+        QueryConstants.MAX_FRAGMENT_INSTANCES_PER_NODE >= maxThreadPerNode);
     for (PlanFragment fragment : postOrderFragments) {
       if (!(fragment.getSink() instanceof JoinBuildSink)) {
         // Only adjust parallelism of non-join build fragment.
         // Join build fragment will be adjusted later by fragment hosting the join node.
-        fragment.traverseEffectiveParallelism(
-            minThreadPerNode, maxThreadPerNode, -1, limitScanParallelism);
+        fragment.traverseEffectiveParallelism(minThreadPerNode, maxThreadPerNode, -1);
       }
     }
 
@@ -442,7 +451,7 @@ public class Planner {
    * This method returns the effective CPU requirement of a query when considering
    * processing cost rate and blocking operator.
    * <p>
-   * Only valid after {@link #computeEffectiveParallelism(List, int, int, boolean)} has
+   * Only valid after {@link #computeEffectiveParallelism(List, int, int)} has
    * been called over the plan fragment list.
    */
   private static CoreCount computeBlockingAwareCores(
@@ -470,38 +479,30 @@ public class Planner {
    * Compute processing cost of each plan fragment in the query plan and adjust each
    * fragment parallelism according to producer-consumer rate between them.
    */
-  public static void computeProcessingCost(List<PlanFragment> planRoots,
-      TQueryExecRequest request, PlannerContext planCtx, int numCoresPerExecutor,
-      boolean limitScanParallelism) {
-    TQueryOptions queryOptions = planCtx.getRootAnalyzer().getQueryOptions();
-
-    if (!ProcessingCost.isComputeCost(queryOptions)) {
+  public static void computeProcessingCost(
+      List<PlanFragment> planRoots, TQueryExecRequest request, PlannerContext planCtx) {
+    Analyzer rootAnalyzer = planCtx.getRootAnalyzer();
+    if (!ProcessingCost.isComputeCost(rootAnalyzer.getQueryOptions())) {
       request.setCores_required(-1);
       return;
     }
 
-    // TODO: remove dependence on MT_DOP in the future.
-    //   We still depend on MT_DOP here since many aspect of query planning is still
-    //   controlled through MT_DOP.
-    int mtDop = queryOptions.getMt_dop();
-    int numNode = planCtx.getRootAnalyzer().numExecutorsForPlanning();
-    int minThreads = queryOptions.getProcessing_cost_min_threads();
-    int maxThreads = Math.max(minThreads, Math.max(mtDop, numCoresPerExecutor));
-
     PlanFragment rootFragment = planRoots.get(0);
     List<PlanFragment> postOrderFragments = rootFragment.getNodesPostOrder();
     for (PlanFragment fragment : postOrderFragments) {
-      fragment.computeCostingSegment(queryOptions, limitScanParallelism);
+      fragment.computeCostingSegment(rootAnalyzer.getQueryOptions());
     }
 
     if (LOG.isTraceEnabled()) {
-      LOG.trace("Computing effective parallelism. numNode=" + numNode + " mtDop=" + mtDop
-          + " numCoresPerExecutor=" + numCoresPerExecutor + " minThreads=" + minThreads
-          + " maxThreads=" + maxThreads);
+      LOG.trace("Computing effective parallelism."
+          + " numNode=" + rootAnalyzer.numExecutorsForPlanning()
+          + " availableCoresPerNode=" + rootAnalyzer.getAvailableCoresPerNode()
+          + " minThreads=" + rootAnalyzer.getMinParallelismPerNode()
+          + " maxThreads=" + rootAnalyzer.getMaxParallelismPerNode());
     }
 
-    computeEffectiveParallelism(
-        postOrderFragments, minThreads, maxThreads, limitScanParallelism);
+    computeEffectiveParallelism(postOrderFragments,
+        rootAnalyzer.getMinParallelismPerNode(), rootAnalyzer.getMaxParallelismPerNode());
     CoreCount effectiveCores = computeBlockingAwareCores(postOrderFragments);
     request.setCores_required(effectiveCores.total());
 
@@ -519,7 +520,6 @@ public class Planner {
     Preconditions.checkState(!planRoots.isEmpty());
     Preconditions.checkNotNull(request);
     TQueryOptions queryOptions = planCtx.getRootAnalyzer().getQueryOptions();
-    int mtDop = queryOptions.getMt_dop();
 
     // Peak per-host peak resources for all plan fragments, assuming that all fragments
     // are scheduled on all nodes. The actual per-host resource requirements are computed
@@ -545,8 +545,8 @@ public class Planner {
       // at the same time, i.e. that the query-wide peak resources is the sum of the
       // per-fragment-instance peak resources.
       // TODO: IMPALA-9255: take into account parallel plan dependencies.
-      maxPerHostPeakResources =
-          maxPerHostPeakResources.sum(fragment.getTotalPerBackendResourceProfile(mtDop));
+      maxPerHostPeakResources = maxPerHostPeakResources.sum(
+          fragment.getTotalPerBackendResourceProfile(queryOptions));
       // Coordinator has to have a copy of each of the runtime filters to perform filter
       // aggregation. Note that this overestimates because it includes local runtime
       // filters that do not go via the coordinator.
diff --git a/fe/src/main/java/org/apache/impala/planner/ProcessingCost.java b/fe/src/main/java/org/apache/impala/planner/ProcessingCost.java
index 6093a28b3..691a12c1b 100644
--- a/fe/src/main/java/org/apache/impala/planner/ProcessingCost.java
+++ b/fe/src/main/java/org/apache/impala/planner/ProcessingCost.java
@@ -97,7 +97,7 @@ public abstract class ProcessingCost implements Cloneable {
   }
 
   public static boolean isComputeCost(TQueryOptions queryOptions) {
-    return queryOptions.getMt_dop() > 0 && queryOptions.isCompute_processing_cost();
+    return queryOptions.isCompute_processing_cost();
   }
 
   /**
@@ -206,14 +206,27 @@ public abstract class ProcessingCost implements Cloneable {
     return numInstanceSupplier_ != null && numInstanceSupplier_.get() > 0;
   }
 
-  private int getNumInstanceMax() {
-    long maxInstance = LongMath.divide(getTotalCost(),
+  protected int getNumInstanceMax() { return getNumInstanceMax(1); }
+
+  protected int getNumInstanceMax(int numNodes) {
+    long maxParallelism = LongMath.divide(getTotalCost(),
         BackendConfig.INSTANCE.getMinProcessingPerThread(), RoundingMode.CEILING);
-    if (maxInstance > 0) {
-      return maxInstance < Integer.MAX_VALUE ? (int) maxInstance : Integer.MAX_VALUE;
-    } else {
-      return 1;
+    return roundUpNumNodeMultiple(maxParallelism, numNodes);
+  }
+
+  protected static int roundUpNumNodeMultiple(long parallelism, int numNodes) {
+    // Round up to the nearest multiple of numNodes.
+    // Little over-parallelize is better than under-parallelize.
+    long maxParallelism =
+        LongMath.divide(parallelism, numNodes, RoundingMode.CEILING) * numNodes;
+
+    if (maxParallelism <= 0) {
+      maxParallelism = 1;
+    } else if (maxParallelism > Integer.MAX_VALUE) {
+      // Floor Integer.MAX_VALUE to the nearest multiple of numNodes.
+      maxParallelism = Integer.MAX_VALUE - (Integer.MAX_VALUE % numNodes);
     }
+    return (int) maxParallelism;
   }
 
   /**
diff --git a/fe/src/main/java/org/apache/impala/planner/ScanNode.java b/fe/src/main/java/org/apache/impala/planner/ScanNode.java
index d9b3ac49b..9f82a02d3 100644
--- a/fe/src/main/java/org/apache/impala/planner/ScanNode.java
+++ b/fe/src/main/java/org/apache/impala/planner/ScanNode.java
@@ -30,7 +30,6 @@ import org.apache.impala.analysis.MultiAggregateInfo;
 import org.apache.impala.analysis.SlotDescriptor;
 import org.apache.impala.analysis.SlotRef;
 import org.apache.impala.analysis.TupleDescriptor;
-import org.apache.impala.catalog.FeTable;
 import org.apache.impala.catalog.HdfsFileFormat;
 import org.apache.impala.catalog.Type;
 import org.apache.impala.common.NotImplementedException;
@@ -84,11 +83,6 @@ abstract public class ScanNode extends PlanNode {
   // Refer to the comment of 'TableRef.tableNumRowsHint_'
   protected long tableNumRowsHint_ = -1;
 
-  // When in multiple executor group set setup, true value means scan instance count
-  // is limited by MT_DOP. Otherwise, scan parallelism is decided by ProcessingCost.
-  // Set by PlanFragment.computeCostingSegment().
-  protected boolean limitScanParallelism_;
-
   public ScanNode(PlanNodeId id, TupleDescriptor desc, String displayName) {
     super(id, desc.getId().asList(), displayName);
     desc_ = desc;
@@ -334,7 +328,7 @@ abstract public class ScanNode extends PlanNode {
   protected int computeMaxNumberOfScannerThreads(TQueryOptions queryOptions,
       int perHostScanRanges) {
     // The non-MT scan node requires at least one scanner thread.
-    if (queryOptions.getMt_dop() >= 1) {
+    if (Planner.useMTFragment(queryOptions)) {
       return 1;
     }
     int maxScannerThreads = Math.min(perHostScanRanges,
@@ -350,31 +344,35 @@ abstract public class ScanNode extends PlanNode {
 
   protected ProcessingCost computeScanProcessingCost(
       TQueryOptions queryOptions, long effectiveScanRangeCount) {
-    ProcessingCost cardinalityBasedCost =
-        ProcessingCost.basicCost(getDisplayLabel(), getInputCardinality(),
-            ExprUtil.computeExprsTotalCost(conjuncts_), rowMaterializationCost());
-
-    long maxScanThreads = effectiveScanRangeCount;
-    if (!limitScanParallelism_ && queryOptions.getNum_scanner_threads() > 0) {
-      maxScanThreads = Math.min(maxScanThreads,
-          LongMath.saturatedMultiply(
-              getNumNodes(), queryOptions.getNum_scanner_threads()));
+    ProcessingCost cardinalityBasedCost = ProcessingCost.basicCost(getDisplayLabel(),
+        getInputCardinality(), ExprUtil.computeExprsTotalCost(conjuncts_),
+        rowMaterializationCost(effectiveScanRangeCount));
+
+    int maxScannerThreads = (int) Math.min(effectiveScanRangeCount, Integer.MAX_VALUE);
+    if (ProcessingCost.isComputeCost(queryOptions)) {
+      // maxThread calculation below intentionally does not include core count from
+      // executor group config. This is to allow scan fragment parallelism to scale
+      // regardless of the core count limit.
+      int maxThreads = Math.max(queryOptions.getProcessing_cost_min_threads(),
+          queryOptions.getMax_fragment_instances_per_node());
+      maxScannerThreads = (int) Math.min(
+          maxScannerThreads, LongMath.saturatedMultiply(getNumNodes(), maxThreads));
     }
 
     if (getInputCardinality() == 0) {
       Preconditions.checkState(cardinalityBasedCost.getTotalCost() == 0,
           "Scan is empty but cost is non-zero.");
       return cardinalityBasedCost;
-    } else if (maxScanThreads < cardinalityBasedCost.getTotalCost()
+    } else if (maxScannerThreads < cardinalityBasedCost.getTotalCost()
             / BackendConfig.INSTANCE.getMinProcessingPerThread()) {
       // Input cardinality is unknown or cost is too high compared to maxScanThreads
       // Return synthetic ProcessingCost based on maxScanThreads.
       long syntheticCardinality =
-          Math.max(1, Math.min(getInputCardinality(), maxScanThreads));
+          Math.max(1, Math.min(getInputCardinality(), maxScannerThreads));
       long syntheticPerRowCost = LongMath.saturatedMultiply(
-          (long) Math.ceil((double) BackendConfig.INSTANCE.getMinProcessingPerThread()
-              / syntheticCardinality),
-          maxScanThreads);
+          Math.max(1,
+              BackendConfig.INSTANCE.getMinProcessingPerThread() / syntheticCardinality),
+          maxScannerThreads);
 
       return ProcessingCost.basicCost(
           getDisplayLabel(), syntheticCardinality, 0, syntheticPerRowCost);
@@ -385,15 +383,20 @@ abstract public class ScanNode extends PlanNode {
   }
 
   /**
-   * Estimate per-row cost as 1 per 1KB row size.
+   * Estimate per-row cost as 1 per 1KB row size plus
+   * (0.5% * min_processing_per_thread) for every scan ranges.
    * <p>
-   * This reflects deserialization/copy cost per row.
+   * This reflects deserialization/copy cost per row and scan range open cost.
+   * (0.5% * min_processing_per_thread) for every scan ranges roughly means that one scan
+   * node instance will handle at most 200 scan ranges.
    */
-  private float rowMaterializationCost() { return getAvgRowSize() / 1024; }
+  private float rowMaterializationCost(long effectiveScanRangeCount) {
+    float perRowCost = getAvgRowSize() / 1024;
+    if (getInputCardinality() <= 0) return perRowCost;
 
-  @Override
-  protected boolean isLeafNode() {
-    return true;
+    float perScanRangeCost = BackendConfig.INSTANCE.getMinProcessingPerThread() * 0.005f
+        / getInputCardinality() * effectiveScanRangeCount;
+    return perRowCost + perScanRangeCost;
   }
 
   /**
@@ -410,7 +413,7 @@ abstract public class ScanNode extends PlanNode {
 
   public ExprSubstitutionMap getOptimizedAggSmap() { return optimizedAggSmap_; }
 
-  protected void setLimitScanParallelism(boolean isLimitScanParallelism) {
-    limitScanParallelism_ = isLimitScanParallelism;
+  protected int getMaxScannerThreads(int numNodes) {
+    return processingCost_.getNumInstanceMax(numNodes);
   }
 }
diff --git a/fe/src/main/java/org/apache/impala/planner/UnionNode.java b/fe/src/main/java/org/apache/impala/planner/UnionNode.java
index c8f45dd7b..0d51fafab 100644
--- a/fe/src/main/java/org/apache/impala/planner/UnionNode.java
+++ b/fe/src/main/java/org/apache/impala/planner/UnionNode.java
@@ -389,11 +389,4 @@ public class UnionNode extends PlanNode {
       }
     }
   }
-
-  @Override
-  protected boolean isLeafNode() {
-    // Union node is being scheduled the same as scan node.
-    // See Scheduler::CreateCollocatedAndScanInstances() in scheduler.cc.
-    return true;
-  }
 }
diff --git a/fe/src/main/java/org/apache/impala/service/Frontend.java b/fe/src/main/java/org/apache/impala/service/Frontend.java
index 448d6f9ba..ab38311fa 100644
--- a/fe/src/main/java/org/apache/impala/service/Frontend.java
+++ b/fe/src/main/java/org/apache/impala/service/Frontend.java
@@ -316,13 +316,9 @@ public class Frontend {
       // The group set being applied in current compilation.
       protected TExecutorGroupSet group_set_ = null;
 
-      // If false, set leaf fragment parallelism to maxScanParallelism_ per executor node.
-      // Otherwise, leaf fragment parallelism is set to MT_DOP per executor node.
-      protected boolean limitScanParallelism_ = true;
-
-      // Maximum leaf fragment parallelism per executor node.
-      // Only used if limitScanParallelism_ is false.
-      protected int maxLeafParallelism_ = 1;
+      // Available cores per executor node.
+      // Valid value must be >= 0. Set by Frontend.getTExecRequest().
+      protected int availableCoresPerNode_ = -1;
 
       public boolean disableAuthorization() { return disableAuthorization_; }
 
@@ -332,13 +328,11 @@ public class Frontend {
       public int getCoresRequired() { return cores_required_; }
       public void setCoresRequired(int x) { cores_required_ = x; }
 
-      public boolean isLimitScanParallelism() { return limitScanParallelism_; }
-      public void setLimitScanParallelism(boolean isLimitScanParallelism) {
-        limitScanParallelism_ = isLimitScanParallelism;
+      public int getAvailableCoresPerNode() {
+        Preconditions.checkState(availableCoresPerNode_ >= 0);
+        return availableCoresPerNode_;
       }
-
-      public int getMaxLeafParallelism() { return maxLeafParallelism_; }
-      public void setMaxLeafParallelism(int x) { maxLeafParallelism_ = x; }
+      public void setAvailableCoresPerNode(int x) { availableCoresPerNode_ = x; }
 
       // Capture the current state and initialize before iterative compilations begin.
       public void captureState() {
@@ -1785,12 +1779,7 @@ public class Frontend {
 
     // Compute resource requirements of the final plans.
     TQueryExecRequest result = new TQueryExecRequest();
-    boolean isLimitScanParallelism = planCtx.compilationState_.isLimitScanParallelism();
-    int maxCores = isLimitScanParallelism ?
-        planCtx.compilationState_.getGroupSet().getNum_cores_per_executor() :
-        planCtx.compilationState_.getMaxLeafParallelism();
-    Planner.computeProcessingCost(
-        planRoots, result, planner.getPlannerCtx(), maxCores, isLimitScanParallelism);
+    Planner.computeProcessingCost(planRoots, result, planner.getPlannerCtx());
     Planner.computeResourceReqs(planRoots, queryCtx, result,
         planner.getPlannerCtx(), planner.getAnalysisResult().isQueryStmt());
 
@@ -2032,8 +2021,9 @@ public class Frontend {
 
     // Capture the current state.
     planCtx.compilationState_.captureState();
+    boolean isComputeCost = ProcessingCost.isComputeCost(queryOptions);
 
-    if (ProcessingCost.isComputeCost(queryOptions)) {
+    if (isComputeCost) {
       FrontendProfile.getCurrent().setToCounter(CPU_COUNT_DIVISOR, TUnit.DOUBLE_VALUE,
           Double.doubleToLongBits(BackendConfig.INSTANCE.getQueryCpuCountDivisor()));
     }
@@ -2041,8 +2031,6 @@ public class Frontend {
     TExecutorGroupSet group_set = null;
     String reason = "Unknown";
     int attempt = 0;
-    planCtx.compilationState_.setLimitScanParallelism(
-        num_executor_group_sets <= 1 || !ProcessingCost.isComputeCost(queryOptions));
     int lastExecutorGroupTotalCores =
         expectedTotalCores(executorGroupSetsToUse.get(num_executor_group_sets - 1));
     long memoryAskUnbounded = -1;
@@ -2051,16 +2039,15 @@ public class Frontend {
     while (i < num_executor_group_sets) {
       group_set = executorGroupSetsToUse.get(i);
       planCtx.compilationState_.setGroupSet(group_set);
-      if (i == num_executor_group_sets - 1) {
-        // This is the last executor group. Fix leaf nodes parallelism back to MT_DOP.
-        planCtx.compilationState_.setLimitScanParallelism(true);
-        planCtx.compilationState_.setMaxLeafParallelism(
-            group_set.getNum_cores_per_executor());
-      } else if (!planCtx.compilationState_.isLimitScanParallelism()) {
-        planCtx.compilationState_.setMaxLeafParallelism(
-            lastExecutorGroupTotalCores / expectedNumExecutor(group_set));
+      if (isComputeCost) {
+        planCtx.compilationState_.setAvailableCoresPerNode(
+            Math.max(queryOptions.getProcessing_cost_min_threads(),
+                lastExecutorGroupTotalCores / expectedNumExecutor(group_set)));
+      } else {
+        planCtx.compilationState_.setAvailableCoresPerNode(queryOptions.getMt_dop());
       }
-      LOG.info("Consider executor group set: " + group_set);
+      LOG.info("Consider executor group set: " + group_set + " with assumption of "
+          + planCtx.compilationState_.getAvailableCoresPerNode() + " cores per node.");
 
       String retryMsg = "";
       while (true) {
@@ -2097,7 +2084,7 @@ public class Frontend {
           new TCounter(MEMORY_MAX, TUnit.BYTES,
               LongMath.saturatedMultiply(
                   expectedNumExecutor(group_set), group_set.getMax_mem_limit())));
-      if (ProcessingCost.isComputeCost(queryOptions)) {
+      if (isComputeCost) {
         addCounter(groupSetProfile, new TCounter(CPU_MAX, TUnit.UNIT, available_cores));
       }
 
@@ -2145,7 +2132,7 @@ public class Frontend {
 
       boolean cpuReqSatisfied = true;
       int scaled_cores_requirement = -1;
-      if (ProcessingCost.isComputeCost(queryOptions)) {
+      if (isComputeCost) {
         Preconditions.checkState(cores_requirement > 0);
         scaled_cores_requirement = (int) Math.min(Integer.MAX_VALUE,
             Math.ceil(
@@ -2182,20 +2169,6 @@ public class Frontend {
         addInfoString(groupSetProfile, VERDICT, reason);
         matchFound = true;
       } else if (memReqSatisfied && cpuReqSatisfied) {
-        if (!planCtx.compilationState_.isLimitScanParallelism()) {
-          // Fix leaf nodes parallelism back to MT_DOP and replan.
-          // TODO: Remove this extra replanning and related codes in the future once we
-          //   can fully manage scan node parallelism without MT_DOP.
-          planCtx.compilationState_.setLimitScanParallelism(true);
-          memoryAskUnbounded = per_host_mem_estimate;
-          if (ProcessingCost.isComputeCost(queryOptions)) {
-            cpuAskUnbounded = scaled_cores_requirement;
-          }
-          planCtx.compilationState_.restoreState();
-          LOG.info("Executor group " + group_set + " fit the unbounded scan plan. "
-              + "Replanning again with scan parallelism equals MT_DOP.");
-          continue;
-        }
         reason = "suitable group found (estimated per-host memory="
             + PrintUtils.printBytes(per_host_mem_estimate)
             + ", estimated cpu cores required=" + cores_requirement
@@ -2348,6 +2321,8 @@ public class Frontend {
     // used during planner phase for scans (see HdfsScanNode.computeNumNodes()).
     analysisResult.getAnalyzer().setNumExecutorsForPlanning(
         expectedNumExecutor(planCtx.compilationState_.getGroupSet()));
+    analysisResult.getAnalyzer().setAvailableCoresPerNode(
+        Math.max(1, planCtx.compilationState_.getAvailableCoresPerNode()));
 
     try {
       TQueryOptions queryOptions = queryCtx.client_request.query_options;
diff --git a/fe/src/test/java/org/apache/impala/planner/PlannerTest.java b/fe/src/test/java/org/apache/impala/planner/PlannerTest.java
index c60cefc3c..b032ebbce 100644
--- a/fe/src/test/java/org/apache/impala/planner/PlannerTest.java
+++ b/fe/src/test/java/org/apache/impala/planner/PlannerTest.java
@@ -1367,9 +1367,9 @@ public class PlannerTest extends PlannerTestBase {
   @Test
   public void testProcessingCost() {
     TQueryOptions options = new TQueryOptions();
-    options.setMt_dop(4);
     options.setCompute_processing_cost(true);
     options.setProcessing_cost_min_threads(2);
+    options.setMax_fragment_instances_per_node(16);
     options.setMinmax_filter_threshold(0.5);
     options.setMinmax_filter_sorted_columns(false);
     options.setMinmax_filter_partition_columns(false);
diff --git a/fe/src/test/resources/llama-site-3-groups.xml b/fe/src/test/resources/llama-site-3-groups.xml
index 874cc7a75..76ba67408 100644
--- a/fe/src/test/resources/llama-site-3-groups.xml
+++ b/fe/src/test/resources/llama-site-3-groups.xml
@@ -37,8 +37,8 @@
   </property>
   <property>
     <name>impala.admission-control.max-query-mem-limit.root.small</name>
-   <!-- 70 MB -->
-    <value>73400320</value>
+   <!-- 90 MB -->
+    <value>94371840</value>
   </property>
   <property>
     <name>impala.admission-control.min-query-mem-limit.root.small</name>
diff --git a/testdata/workloads/functional-planner/queries/PlannerTest/tpcds-processing-cost.test b/testdata/workloads/functional-planner/queries/PlannerTest/tpcds-processing-cost.test
index 2071ed691..94307dbfe 100644
--- a/testdata/workloads/functional-planner/queries/PlannerTest/tpcds-processing-cost.test
+++ b/testdata/workloads/functional-planner/queries/PlannerTest/tpcds-processing-cost.test
@@ -39,9 +39,9 @@ PLAN-ROOT SINK
 |  tuple-ids=4 row-size=52B cardinality=100 cost=6
 |  in pipelines: 06(GETNEXT)
 |
-F04:PLAN FRAGMENT [HASH(dt.d_year,item.i_brand,item.i_brand_id)] hosts=3 instances=6 (adjusted from 12)
+F04:PLAN FRAGMENT [HASH(dt.d_year,item.i_brand,item.i_brand_id)] hosts=3 instances=6 (adjusted from 48)
 Per-Instance Resources: mem-estimate=10.38MB mem-reservation=1.94MB thread-reservation=1
-max-parallelism=3 segment-costs=[12331, 300, 6] cpu-comparison-result=18 [max(6 (self) vs 18 (sum children))]
+max-parallelism=6 segment-costs=[12331, 300, 6] cpu-comparison-result=18 [max(6 (self) vs 18 (sum children))]
 06:TOP-N [LIMIT=100]
 |  order by: dt.d_year ASC, sum(ss_ext_sales_price) DESC, item.i_brand_id ASC
 |  mem-estimate=5.10KB mem-reservation=0B thread-reservation=0
@@ -60,9 +60,9 @@ max-parallelism=3 segment-costs=[12331, 300, 6] cpu-comparison-result=18 [max(6
 |  tuple-ids=3 row-size=52B cardinality=3.04K cost=167
 |  in pipelines: 01(GETNEXT)
 |
-F03:PLAN FRAGMENT [HASH(store_sales.ss_sold_date_sk)] hosts=3 instances=6 (adjusted from 12)
+F03:PLAN FRAGMENT [HASH(store_sales.ss_sold_date_sk)] hosts=3 instances=6 (adjusted from 48)
 Per-Instance Resources: mem-estimate=12.17MB mem-reservation=2.00MB thread-reservation=1
-max-parallelism=3 segment-costs=[15408, 167] cpu-comparison-result=18 [max(18 (self) vs 11 (sum children))]
+max-parallelism=6 segment-costs=[15408, 167] cpu-comparison-result=18 [max(18 (self) vs 11 (sum children))]
 05:AGGREGATE [STREAMING]
 |  output: sum(ss_ext_sales_price)
 |  group by: dt.d_year, item.i_brand, item.i_brand_id
@@ -78,7 +78,7 @@ max-parallelism=3 segment-costs=[15408, 167] cpu-comparison-result=18 [max(18 (s
 |  tuple-ids=1,2,0 row-size=72B cardinality=3.04K cost=3041
 |  in pipelines: 01(GETNEXT), 00(OPEN)
 |
-|--F06:PLAN FRAGMENT [HASH(store_sales.ss_sold_date_sk)] hosts=3 instances=6 (adjusted from 12)
+|--F06:PLAN FRAGMENT [HASH(store_sales.ss_sold_date_sk)] hosts=3 instances=6 (adjusted from 48)
 |  |  Per-Instance Resources: mem-estimate=3.02MB mem-reservation=2.94MB thread-reservation=1 runtime-filters-memory=1.00MB
 |  |  max-parallelism=6 segment-costs=[6183]
 |  JOIN BUILD
@@ -94,7 +94,7 @@ max-parallelism=3 segment-costs=[15408, 167] cpu-comparison-result=18 [max(18 (s
 |  |
 |  F02:PLAN FRAGMENT [RANDOM] hosts=1 instances=1
 |  Per-Instance Resources: mem-estimate=16.38MB mem-reservation=512.00KB thread-reservation=1
-|  max-parallelism=1 segment-costs=[74002]
+|  max-parallelism=1 segment-costs=[124002]
 |  00:SCAN HDFS [tpcds_parquet.date_dim dt, RANDOM]
 |     HDFS partitions=1/1 files=1 size=2.15MB
 |     predicates: dt.d_moy = CAST(12 AS INT)
@@ -105,7 +105,7 @@ max-parallelism=3 segment-costs=[15408, 167] cpu-comparison-result=18 [max(18 (s
 |     parquet statistics predicates: dt.d_moy = CAST(12 AS INT)
 |     parquet dictionary predicates: dt.d_moy = CAST(12 AS INT)
 |     mem-estimate=16.00MB mem-reservation=512.00KB thread-reservation=0
-|     tuple-ids=0 row-size=12B cardinality=6.09K cost=73906
+|     tuple-ids=0 row-size=12B cardinality=6.09K cost=123906
 |     in pipelines: 00(GETNEXT)
 |
 08:EXCHANGE [HASH(store_sales.ss_sold_date_sk)]
@@ -113,10 +113,10 @@ max-parallelism=3 segment-costs=[15408, 167] cpu-comparison-result=18 [max(18 (s
 |  tuple-ids=1,2 row-size=60B cardinality=3.04K cost=203
 |  in pipelines: 01(GETNEXT)
 |
-F00:PLAN FRAGMENT [RANDOM] hosts=3 instances=12
+F00:PLAN FRAGMENT [RANDOM] hosts=3 instances=12 (adjusted from 48)
 Per-Host Shared Resources: mem-estimate=2.00MB mem-reservation=2.00MB thread-reservation=0 runtime-filters-memory=2.00MB
 Per-Instance Resources: mem-estimate=17.60MB mem-reservation=1.00MB thread-reservation=1
-max-parallelism=12 segment-costs=[2925614]
+max-parallelism=12 segment-costs=[94125607]
 03:HASH JOIN [INNER JOIN, BROADCAST]
 |  hash-table-id=01
 |  hash predicates: store_sales.ss_item_sk = item.i_item_sk
@@ -141,7 +141,7 @@ max-parallelism=12 segment-costs=[2925614]
 |  |
 |  F01:PLAN FRAGMENT [RANDOM] hosts=1 instances=1
 |  Per-Instance Resources: mem-estimate=16.19MB mem-reservation=256.00KB thread-reservation=1
-|  max-parallelism=1 segment-costs=[18778]
+|  max-parallelism=1 segment-costs=[68778]
 |  02:SCAN HDFS [tpcds_parquet.item, RANDOM]
 |     HDFS partitions=1/1 files=1 size=1.73MB
 |     predicates: item.i_manufact_id = CAST(436 AS INT)
@@ -152,7 +152,7 @@ max-parallelism=12 segment-costs=[2925614]
 |     parquet statistics predicates: item.i_manufact_id = CAST(436 AS INT)
 |     parquet dictionary predicates: item.i_manufact_id = CAST(436 AS INT)
 |     mem-estimate=16.00MB mem-reservation=256.00KB thread-reservation=0
-|     tuple-ids=2 row-size=44B cardinality=19 cost=18777
+|     tuple-ids=2 row-size=44B cardinality=19 cost=68777
 |     in pipelines: 02(GETNEXT)
 |
 01:SCAN HDFS [tpcds_parquet.store_sales, RANDOM]
@@ -164,7 +164,7 @@ max-parallelism=12 segment-costs=[2925614]
      columns: all
    extrapolated-rows=disabled max-scan-range-rows=130.09K
    mem-estimate=16.00MB mem-reservation=1.00MB thread-reservation=0
-   tuple-ids=1 row-size=16B cardinality=2.88M cost=45007
+   tuple-ids=1 row-size=16B cardinality=2.88M cost=91245000
    in pipelines: 01(GETNEXT)
 ====
 # TPCDS-Q14a first of two
@@ -270,8 +270,8 @@ with  cross_items as
  order by channel,i_brand_id,i_class_id,i_category_id
 LIMIT 100
 ---- PARALLELPLANS
-Max Per-Host Resource Reservation: Memory=894.62MB Threads=163
-Per-Host Resource Estimates: Memory=3.09GB
+Max Per-Host Resource Reservation: Memory=790.00MB Threads=163
+Per-Host Resource Estimates: Memory=2.42GB
 F80:PLAN FRAGMENT [UNPARTITIONED] hosts=1 instances=1
 |  Per-Instance Resources: mem-estimate=4.03MB mem-reservation=4.00MB thread-reservation=1
 |  max-parallelism=1 segment-costs=[606] cpu-comparison-result=157 [max(1 (self) vs 157 (sum children))]
@@ -286,9 +286,9 @@ PLAN-ROOT SINK
 |  tuple-ids=110 row-size=48B cardinality=100 cost=6
 |  in pipelines: 129(GETNEXT)
 |
-F79:PLAN FRAGMENT [HASH(CASE valid_tid(104,105,106,107,108) WHEN 104 THEN murmur_hash(channel) WHEN 105 THEN murmur_hash(channel) WHEN 106 THEN murmur_hash(channel) WHEN 107 THEN murmur_hash(channel) WHEN 108 THEN murmur_hash(NULL) END,CASE valid_tid(104,105,106,107,108) WHEN 104 THEN murmur_hash(i_brand_id) WHEN 105 THEN murmur_hash(i_brand_id) WHEN 106 THEN murmur_hash(i_brand_id) WHEN 107 THEN murmur_hash(NULL) WHEN 108 THEN murmur_hash(NULL) END,CASE valid_tid(104,105,106,107,108) WH [...]
+F79:PLAN FRAGMENT [HASH(CASE valid_tid(104,105,106,107,108) WHEN 104 THEN murmur_hash(channel) WHEN 105 THEN murmur_hash(channel) WHEN 106 THEN murmur_hash(channel) WHEN 107 THEN murmur_hash(channel) WHEN 108 THEN murmur_hash(NULL) END,CASE valid_tid(104,105,106,107,108) WHEN 104 THEN murmur_hash(i_brand_id) WHEN 105 THEN murmur_hash(i_brand_id) WHEN 106 THEN murmur_hash(i_brand_id) WHEN 107 THEN murmur_hash(NULL) WHEN 108 THEN murmur_hash(NULL) END,CASE valid_tid(104,105,106,107,108) WH [...]
 Per-Instance Resources: mem-estimate=111.05MB mem-reservation=85.12MB thread-reservation=1
-max-parallelism=3 segment-costs=[17011772, 3936100, 400, 6] cpu-comparison-result=157 [max(6 (self) vs 157 (sum children))]
+max-parallelism=6 segment-costs=[17011772, 3936100, 400, 6] cpu-comparison-result=157 [max(6 (self) vs 157 (sum children))]
 129:TOP-N [LIMIT=100]
 |  order by: CASE valid_tid(104,105,106,107,108) WHEN 104 THEN channel WHEN 105 THEN channel WHEN 106 THEN channel WHEN 107 THEN channel WHEN 108 THEN NULL END ASC, CASE valid_tid(104,105,106,107,108) WHEN 104 THEN i_brand_id WHEN 105 THEN i_brand_id WHEN 106 THEN i_brand_id WHEN 107 THEN NULL WHEN 108 THEN NULL END ASC, CASE valid_tid(104,105,106,107,108) WHEN 104 THEN i_class_id WHEN 105 THEN i_class_id WHEN 106 THEN NULL WHEN 107 THEN NULL WHEN 108 THEN NULL END ASC, CASE valid_tid(10 [...]
 |  mem-estimate=4.69KB mem-reservation=0B thread-reservation=0
@@ -327,7 +327,7 @@ max-parallelism=3 segment-costs=[17011772, 3936100, 400, 6] cpu-comparison-resul
 |  tuple-ids=104N,105N,106N,107N,108N row-size=240B cardinality=562.30K cost=142772
 |  in pipelines: 151(GETNEXT), 179(GETNEXT), 207(GETNEXT)
 |
-F78:PLAN FRAGMENT [RANDOM] hosts=3 instances=12
+F78:PLAN FRAGMENT [RANDOM] hosts=3 instances=12 (adjusted from 48)
 Per-Instance Resources: mem-estimate=68.27MB mem-reservation=28.94MB thread-reservation=1
 max-parallelism=12 segment-costs=[749813, 429878, 215944, 13294224, 142772] cpu-comparison-result=157 [max(12 (self) vs 157 (sum children))]
 127:AGGREGATE [STREAMING]
@@ -376,7 +376,7 @@ max-parallelism=12 segment-costs=[749813, 429878, 215944, 13294224, 142772] cpu-
 |  |  |
 |  |  F77:PLAN FRAGMENT [UNPARTITIONED] hosts=1 instances=1
 |  |  Per-Instance Resources: mem-estimate=96.00KB mem-reservation=0B thread-reservation=1
-|  |  max-parallelism=1 segment-costs=[2, 1] cpu-comparison-result=12 [max(2 (self) vs 12 (sum children))]
+|  |  max-parallelism=2 segment-costs=[2, 1] cpu-comparison-result=12 [max(2 (self) vs 12 (sum children))]
 |  |  212:AGGREGATE [FINALIZE]
 |  |  |  output: avg:merge(quantity * list_price)
 |  |  |  mem-estimate=16.00KB mem-reservation=0B spill-buffer=2.00MB thread-reservation=0
@@ -388,9 +388,9 @@ max-parallelism=12 segment-costs=[749813, 429878, 215944, 13294224, 142772] cpu-
 |  |  |  tuple-ids=98 row-size=16B cardinality=1 cost=1
 |  |  |  in pipelines: 125(GETNEXT)
 |  |  |
-|  |  F76:PLAN FRAGMENT [RANDOM] hosts=3 instances=12
-|  |  Per-Instance Resources: mem-estimate=48.02MB mem-reservation=4.00MB thread-reservation=1
-|  |  max-parallelism=12 segment-costs=[40389768, 1] cpu-comparison-result=12 [max(12 (self) vs 12 (sum children))]
+|  |  F76:PLAN FRAGMENT [RANDOM] hosts=3 instances=12 (adjusted from 48)
+|  |  Per-Instance Resources: mem-estimate=16.02MB mem-reservation=4.00MB thread-reservation=1
+|  |  max-parallelism=12 segment-costs=[131839765, 1] cpu-comparison-result=12 [max(12 (self) vs 12 (sum children))]
 |  |  125:AGGREGATE
 |  |  |  output: avg(CAST(quantity AS DECIMAL(10,0)) * list_price)
 |  |  |  mem-estimate=16.00KB mem-reservation=0B spill-buffer=2.00MB thread-reservation=0
@@ -426,7 +426,7 @@ max-parallelism=12 segment-costs=[749813, 429878, 215944, 13294224, 142772] cpu-
 |  |  |  |  |
 |  |  |  |  F75:PLAN FRAGMENT [RANDOM] hosts=1 instances=1
 |  |  |  |  Per-Instance Resources: mem-estimate=16.05MB mem-reservation=512.00KB thread-reservation=1
-|  |  |  |  max-parallelism=1 segment-costs=[146755]
+|  |  |  |  max-parallelism=1 segment-costs=[196755]
 |  |  |  |  123:SCAN HDFS [tpcds_parquet.date_dim, RANDOM]
 |  |  |  |     HDFS partitions=1/1 files=1 size=2.15MB
 |  |  |  |     predicates: d_year <= CAST(2001 AS INT), d_year >= CAST(1999 AS INT)
@@ -437,7 +437,7 @@ max-parallelism=12 segment-costs=[749813, 429878, 215944, 13294224, 142772] cpu-
 |  |  |  |     parquet statistics predicates: d_year <= CAST(2001 AS INT), d_year >= CAST(1999 AS INT)
 |  |  |  |     parquet dictionary predicates: d_year <= CAST(2001 AS INT), d_year >= CAST(1999 AS INT)
 |  |  |  |     mem-estimate=16.00MB mem-reservation=512.00KB thread-reservation=0
-|  |  |  |     tuple-ids=95 row-size=8B cardinality=7.30K cost=146669
+|  |  |  |     tuple-ids=95 row-size=8B cardinality=7.30K cost=196669
 |  |  |  |     in pipelines: 123(GETNEXT)
 |  |  |  |
 |  |  |  122:SCAN HDFS [tpcds_parquet.web_sales, RANDOM]
@@ -447,8 +447,8 @@ max-parallelism=12 segment-costs=[749813, 429878, 215944, 13294224, 142772] cpu-
 |  |  |       table: rows=719.38K size=45.09MB
 |  |  |       columns: all
 |  |  |     extrapolated-rows=disabled max-scan-range-rows=644.77K
-|  |  |     mem-estimate=32.00MB mem-reservation=4.00MB thread-reservation=0
-|  |  |     tuple-ids=94 row-size=12B cardinality=719.38K cost=8431
+|  |  |     mem-estimate=16.00MB mem-reservation=4.00MB thread-reservation=0
+|  |  |     tuple-ids=94 row-size=12B cardinality=719.38K cost=108431
 |  |  |     in pipelines: 122(GETNEXT)
 |  |  |
 |  |  |--121:HASH JOIN [INNER JOIN, BROADCAST]
@@ -475,7 +475,7 @@ max-parallelism=12 segment-costs=[749813, 429878, 215944, 13294224, 142772] cpu-
 |  |  |  |  |
 |  |  |  |  F73:PLAN FRAGMENT [RANDOM] hosts=1 instances=1
 |  |  |  |  Per-Instance Resources: mem-estimate=16.05MB mem-reservation=512.00KB thread-reservation=1
-|  |  |  |  max-parallelism=1 segment-costs=[146755]
+|  |  |  |  max-parallelism=1 segment-costs=[196755]
 |  |  |  |  120:SCAN HDFS [tpcds_parquet.date_dim, RANDOM]
 |  |  |  |     HDFS partitions=1/1 files=1 size=2.15MB
 |  |  |  |     predicates: d_year <= CAST(2001 AS INT), d_year >= CAST(1999 AS INT)
@@ -486,7 +486,7 @@ max-parallelism=12 segment-costs=[749813, 429878, 215944, 13294224, 142772] cpu-
 |  |  |  |     parquet statistics predicates: d_year <= CAST(2001 AS INT), d_year >= CAST(1999 AS INT)
 |  |  |  |     parquet dictionary predicates: d_year <= CAST(2001 AS INT), d_year >= CAST(1999 AS INT)
 |  |  |  |     mem-estimate=16.00MB mem-reservation=512.00KB thread-reservation=0
-|  |  |  |     tuple-ids=93 row-size=8B cardinality=7.30K cost=146669
+|  |  |  |     tuple-ids=93 row-size=8B cardinality=7.30K cost=196669
 |  |  |  |     in pipelines: 120(GETNEXT)
 |  |  |  |
 |  |  |  119:SCAN HDFS [tpcds_parquet.catalog_sales, RANDOM]
@@ -496,8 +496,8 @@ max-parallelism=12 segment-costs=[749813, 429878, 215944, 13294224, 142772] cpu-
 |  |  |       table: rows=1.44M size=96.62MB
 |  |  |       columns: all
 |  |  |     extrapolated-rows=disabled max-scan-range-rows=650.14K
-|  |  |     mem-estimate=48.00MB mem-reservation=4.00MB thread-reservation=0
-|  |  |     tuple-ids=92 row-size=12B cardinality=1.44M cost=16894
+|  |  |     mem-estimate=16.00MB mem-reservation=4.00MB thread-reservation=0
+|  |  |     tuple-ids=92 row-size=12B cardinality=1.44M cost=166894
 |  |  |     in pipelines: 119(GETNEXT)
 |  |  |
 |  |  118:HASH JOIN [INNER JOIN, BROADCAST]
@@ -523,7 +523,7 @@ max-parallelism=12 segment-costs=[749813, 429878, 215944, 13294224, 142772] cpu-
 |  |  |  |
 |  |  |  F71:PLAN FRAGMENT [RANDOM] hosts=1 instances=1
 |  |  |  Per-Instance Resources: mem-estimate=16.05MB mem-reservation=512.00KB thread-reservation=1
-|  |  |  max-parallelism=1 segment-costs=[146755]
+|  |  |  max-parallelism=1 segment-costs=[196755]
 |  |  |  117:SCAN HDFS [tpcds_parquet.date_dim, RANDOM]
 |  |  |     HDFS partitions=1/1 files=1 size=2.15MB
 |  |  |     predicates: d_year <= CAST(2001 AS INT), d_year >= CAST(1999 AS INT)
@@ -534,7 +534,7 @@ max-parallelism=12 segment-costs=[749813, 429878, 215944, 13294224, 142772] cpu-
 |  |  |     parquet statistics predicates: d_year <= CAST(2001 AS INT), d_year >= CAST(1999 AS INT)
 |  |  |     parquet dictionary predicates: d_year <= CAST(2001 AS INT), d_year >= CAST(1999 AS INT)
 |  |  |     mem-estimate=16.00MB mem-reservation=512.00KB thread-reservation=0
-|  |  |     tuple-ids=91 row-size=8B cardinality=7.30K cost=146669
+|  |  |     tuple-ids=91 row-size=8B cardinality=7.30K cost=196669
 |  |  |     in pipelines: 117(GETNEXT)
 |  |  |
 |  |  116:SCAN HDFS [tpcds_parquet.store_sales, RANDOM]
@@ -545,7 +545,7 @@ max-parallelism=12 segment-costs=[749813, 429878, 215944, 13294224, 142772] cpu-
 |  |       columns: all
 |  |     extrapolated-rows=disabled max-scan-range-rows=130.09K
 |  |     mem-estimate=16.00MB mem-reservation=512.00KB thread-reservation=0
-|  |     tuple-ids=90 row-size=12B cardinality=2.88M cost=33755
+|  |     tuple-ids=90 row-size=12B cardinality=2.88M cost=91233752
 |  |     in pipelines: 116(GETNEXT)
 |  |
 |  207:AGGREGATE [FINALIZE]
@@ -562,8 +562,8 @@ max-parallelism=12 segment-costs=[749813, 429878, 215944, 13294224, 142772] cpu-
 |  |
 |  F52:PLAN FRAGMENT [RANDOM] hosts=2 instances=2
 |  Per-Host Shared Resources: mem-estimate=1.00MB mem-reservation=1.00MB thread-reservation=0 runtime-filters-memory=1.00MB
-|  Per-Instance Resources: mem-estimate=43.88MB mem-reservation=6.00MB thread-reservation=1
-|  max-parallelism=2 segment-costs=[1033413, 1674] cpu-comparison-result=39 [max(2 (self) vs 39 (sum children))]
+|  Per-Instance Resources: mem-estimate=27.88MB mem-reservation=6.00MB thread-reservation=1
+|  max-parallelism=2 segment-costs=[1133413, 1674] cpu-comparison-result=39 [max(2 (self) vs 39 (sum children))]
 |  114:AGGREGATE [STREAMING]
 |  |  output: sum(CAST(ws_quantity AS DECIMAL(10,0)) * ws_list_price), count(*)
 |  |  group by: i_brand_id, i_class_id, i_category_id
@@ -579,22 +579,22 @@ max-parallelism=12 segment-costs=[749813, 429878, 215944, 13294224, 142772] cpu-
 |  |  in pipelines: 85(GETNEXT), 204(OPEN)
 |  |
 |  |--F117:PLAN FRAGMENT [RANDOM] hosts=2 instances=2
-|  |  |  Per-Instance Resources: mem-estimate=7.96MB mem-reservation=7.75MB thread-reservation=1
+|  |  |  Per-Instance Resources: mem-estimate=2.14MB mem-reservation=1.94MB thread-reservation=1
 |  |  |  max-parallelism=2 segment-costs=[18397] cpu-comparison-result=33 [max(2 (self) vs 33 (sum children))]
 |  |  JOIN BUILD
 |  |  |  join-table-id=36 plan-id=37 cohort-id=01
 |  |  |  build expressions: tpcds_parquet.item.i_item_sk
 |  |  |  runtime filters: RF073[min_max] <- tpcds_parquet.item.i_item_sk
-|  |  |  mem-estimate=7.75MB mem-reservation=7.75MB spill-buffer=64.00KB thread-reservation=0 cost=17975
+|  |  |  mem-estimate=1.94MB mem-reservation=1.94MB spill-buffer=64.00KB thread-reservation=0 cost=17975
 |  |  |
 |  |  205:EXCHANGE [BROADCAST]
 |  |  |  mem-estimate=212.43KB mem-reservation=0B thread-reservation=0
 |  |  |  tuple-ids=170 row-size=8B cardinality=17.98K cost=422
 |  |  |  in pipelines: 204(GETNEXT)
 |  |  |
-|  |  F68:PLAN FRAGMENT [HASH(tpcds_parquet.item.i_item_sk)] hosts=3 instances=6 (adjusted from 12)
+|  |  F68:PLAN FRAGMENT [HASH(tpcds_parquet.item.i_item_sk)] hosts=3 instances=6 (adjusted from 48)
 |  |  Per-Instance Resources: mem-estimate=10.12MB mem-reservation=1.94MB thread-reservation=1
-|  |  max-parallelism=3 segment-costs=[18186, 211] cpu-comparison-result=33 [max(6 (self) vs 33 (sum children))]
+|  |  max-parallelism=6 segment-costs=[18186, 211] cpu-comparison-result=33 [max(6 (self) vs 33 (sum children))]
 |  |  204:AGGREGATE [FINALIZE]
 |  |  |  group by: tpcds_parquet.item.i_item_sk
 |  |  |  mem-estimate=10.00MB mem-reservation=1.94MB spill-buffer=64.00KB thread-reservation=0
@@ -606,9 +606,9 @@ max-parallelism=12 segment-costs=[749813, 429878, 215944, 13294224, 142772] cpu-
 |  |  |  tuple-ids=170 row-size=8B cardinality=17.98K cost=211
 |  |  |  in pipelines: 191(GETNEXT)
 |  |  |
-|  |  F58:PLAN FRAGMENT [HASH(iss.i_brand_id,iss.i_class_id,iss.i_category_id)] hosts=3 instances=6 (adjusted from 12)
+|  |  F58:PLAN FRAGMENT [HASH(iss.i_brand_id,iss.i_class_id,iss.i_category_id)] hosts=3 instances=6 (adjusted from 48)
 |  |  Per-Instance Resources: mem-estimate=20.76MB mem-reservation=3.94MB thread-reservation=1
-|  |  max-parallelism=3 segment-costs=[448725, 1488000, 211] cpu-comparison-result=33 [max(6 (self) vs 33 (sum children))]
+|  |  max-parallelism=6 segment-costs=[448725, 1488000, 211] cpu-comparison-result=33 [max(6 (self) vs 33 (sum children))]
 |  |  112:AGGREGATE [STREAMING]
 |  |  |  group by: tpcds_parquet.item.i_item_sk
 |  |  |  mem-estimate=10.00MB mem-reservation=2.00MB spill-buffer=64.00KB thread-reservation=0
@@ -623,7 +623,7 @@ max-parallelism=12 segment-costs=[749813, 429878, 215944, 13294224, 142772] cpu-
 |  |  |  tuple-ids=75,71 row-size=32B cardinality=148.80K cost=446400
 |  |  |  in pipelines: 191(GETNEXT), 88(OPEN)
 |  |  |
-|  |  |--F118:PLAN FRAGMENT [HASH(iss.i_brand_id,iss.i_class_id,iss.i_category_id)] hosts=3 instances=6 (adjusted from 12)
+|  |  |--F118:PLAN FRAGMENT [HASH(iss.i_brand_id,iss.i_class_id,iss.i_category_id)] hosts=3 instances=6 (adjusted from 48)
 |  |  |  |  Per-Instance Resources: mem-estimate=2.30MB mem-reservation=1.94MB thread-reservation=1
 |  |  |  |  max-parallelism=6 segment-costs=[54422]
 |  |  |  JOIN BUILD
@@ -639,7 +639,7 @@ max-parallelism=12 segment-costs=[749813, 429878, 215944, 13294224, 142772] cpu-
 |  |  |  |
 |  |  |  F67:PLAN FRAGMENT [RANDOM] hosts=1 instances=1
 |  |  |  Per-Instance Resources: mem-estimate=16.56MB mem-reservation=256.00KB thread-reservation=1
-|  |  |  max-parallelism=1 segment-costs=[774]
+|  |  |  max-parallelism=1 segment-costs=[50774]
 |  |  |  88:SCAN HDFS [tpcds_parquet.item, RANDOM]
 |  |  |     HDFS partitions=1/1 files=1 size=1.73MB
 |  |  |     stored statistics:
@@ -647,7 +647,7 @@ max-parallelism=12 segment-costs=[749813, 429878, 215944, 13294224, 142772] cpu-
 |  |  |       columns: all
 |  |  |     extrapolated-rows=disabled max-scan-range-rows=18.00K
 |  |  |     mem-estimate=16.00MB mem-reservation=256.00KB thread-reservation=0
-|  |  |     tuple-ids=71 row-size=20B cardinality=18.00K cost=352
+|  |  |     tuple-ids=71 row-size=20B cardinality=18.00K cost=50352
 |  |  |     in pipelines: 88(GETNEXT)
 |  |  |
 |  |  108:HASH JOIN [LEFT SEMI JOIN, PARTITIONED]
@@ -657,7 +657,7 @@ max-parallelism=12 segment-costs=[749813, 429878, 215944, 13294224, 142772] cpu-
 |  |  |  tuple-ids=75 row-size=12B cardinality=148.80K cost=446400
 |  |  |  in pipelines: 191(GETNEXT), 200(OPEN)
 |  |  |
-|  |  |--F119:PLAN FRAGMENT [HASH(iss.i_brand_id,iss.i_class_id,iss.i_category_id)] hosts=3 instances=6 (adjusted from 12)
+|  |  |--F119:PLAN FRAGMENT [HASH(iss.i_brand_id,iss.i_class_id,iss.i_category_id)] hosts=3 instances=6 (adjusted from 48)
 |  |  |  |  Per-Instance Resources: mem-estimate=2.85MB mem-reservation=1.94MB thread-reservation=1
 |  |  |  |  max-parallelism=6 segment-costs=[448725] cpu-comparison-result=6 [max(6 (self) vs 6 (sum children))]
 |  |  |  JOIN BUILD
@@ -672,7 +672,7 @@ max-parallelism=12 segment-costs=[749813, 429878, 215944, 13294224, 142772] cpu-
 |  |  |  |
 |  |  |  F66:PLAN FRAGMENT [HASH(iws.i_brand_id,iws.i_class_id,iws.i_category_id)] hosts=2 instances=4 (adjusted from 2)
 |  |  |  Per-Instance Resources: mem-estimate=10.88MB mem-reservation=1.94MB thread-reservation=1
-|  |  |  max-parallelism=2 segment-costs=[448725, 2325] cpu-comparison-result=6 [max(4 (self) vs 6 (sum children))]
+|  |  |  max-parallelism=4 segment-costs=[448725, 2325] cpu-comparison-result=6 [max(4 (self) vs 6 (sum children))]
 |  |  |  200:AGGREGATE [FINALIZE]
 |  |  |  |  group by: iws.i_brand_id, iws.i_class_id, iws.i_category_id
 |  |  |  |  mem-estimate=10.00MB mem-reservation=1.94MB spill-buffer=64.00KB thread-reservation=0
@@ -685,8 +685,8 @@ max-parallelism=12 segment-costs=[749813, 429878, 215944, 13294224, 142772] cpu-
 |  |  |  |  in pipelines: 100(GETNEXT)
 |  |  |  |
 |  |  |  F63:PLAN FRAGMENT [RANDOM] hosts=2 instances=2
-|  |  |  Per-Instance Resources: mem-estimate=42.25MB mem-reservation=9.00MB thread-reservation=1
-|  |  |  max-parallelism=2 segment-costs=[3605351, 2325] cpu-comparison-result=6 [max(2 (self) vs 6 (sum children))]
+|  |  |  Per-Instance Resources: mem-estimate=26.25MB mem-reservation=9.00MB thread-reservation=1
+|  |  |  max-parallelism=2 segment-costs=[3705351, 2325] cpu-comparison-result=6 [max(2 (self) vs 6 (sum children))]
 |  |  |  107:AGGREGATE [STREAMING]
 |  |  |  |  group by: iws.i_brand_id, iws.i_class_id, iws.i_category_id
 |  |  |  |  mem-estimate=10.00MB mem-reservation=5.00MB spill-buffer=256.00KB thread-reservation=0
@@ -702,13 +702,13 @@ max-parallelism=12 segment-costs=[749813, 429878, 215944, 13294224, 142772] cpu-
 |  |  |  |  in pipelines: 100(GETNEXT), 102(OPEN)
 |  |  |  |
 |  |  |  |--F120:PLAN FRAGMENT [RANDOM] hosts=2 instances=2
-|  |  |  |  |  Per-Instance Resources: mem-estimate=7.82MB mem-reservation=7.75MB thread-reservation=1
+|  |  |  |  |  Per-Instance Resources: mem-estimate=2.00MB mem-reservation=1.94MB thread-reservation=1
 |  |  |  |  |  max-parallelism=2 segment-costs=[7477]
 |  |  |  |  JOIN BUILD
 |  |  |  |  |  join-table-id=39 plan-id=40 cohort-id=12
 |  |  |  |  |  build expressions: d3.d_date_sk
 |  |  |  |  |  runtime filters: RF099[min_max] <- d3.d_date_sk
-|  |  |  |  |  mem-estimate=7.75MB mem-reservation=7.75MB spill-buffer=64.00KB thread-reservation=0 cost=7305
+|  |  |  |  |  mem-estimate=1.94MB mem-reservation=1.94MB spill-buffer=64.00KB thread-reservation=0 cost=7305
 |  |  |  |  |
 |  |  |  |  198:EXCHANGE [BROADCAST]
 |  |  |  |  |  mem-estimate=69.07KB mem-reservation=0B thread-reservation=0
@@ -717,7 +717,7 @@ max-parallelism=12 segment-costs=[749813, 429878, 215944, 13294224, 142772] cpu-
 |  |  |  |  |
 |  |  |  |  F65:PLAN FRAGMENT [RANDOM] hosts=1 instances=1
 |  |  |  |  Per-Instance Resources: mem-estimate=16.05MB mem-reservation=512.00KB thread-reservation=1
-|  |  |  |  max-parallelism=1 segment-costs=[146755]
+|  |  |  |  max-parallelism=1 segment-costs=[196755]
 |  |  |  |  102:SCAN HDFS [tpcds_parquet.date_dim d3, RANDOM]
 |  |  |  |     HDFS partitions=1/1 files=1 size=2.15MB
 |  |  |  |     predicates: d3.d_year <= CAST(2001 AS INT), d3.d_year >= CAST(1999 AS INT)
@@ -728,7 +728,7 @@ max-parallelism=12 segment-costs=[749813, 429878, 215944, 13294224, 142772] cpu-
 |  |  |  |     parquet statistics predicates: d3.d_year <= CAST(2001 AS INT), d3.d_year >= CAST(1999 AS INT)
 |  |  |  |     parquet dictionary predicates: d3.d_year <= CAST(2001 AS INT), d3.d_year >= CAST(1999 AS INT)
 |  |  |  |     mem-estimate=16.00MB mem-reservation=512.00KB thread-reservation=0
-|  |  |  |     tuple-ids=83 row-size=8B cardinality=7.30K cost=146669
+|  |  |  |     tuple-ids=83 row-size=8B cardinality=7.30K cost=196669
 |  |  |  |     in pipelines: 102(GETNEXT)
 |  |  |  |
 |  |  |  103:HASH JOIN [INNER JOIN, BROADCAST]
@@ -740,13 +740,13 @@ max-parallelism=12 segment-costs=[749813, 429878, 215944, 13294224, 142772] cpu-
 |  |  |  |  in pipelines: 100(GETNEXT), 101(OPEN)
 |  |  |  |
 |  |  |  |--F121:PLAN FRAGMENT [RANDOM] hosts=2 instances=2
-|  |  |  |  |  Per-Instance Resources: mem-estimate=8.12MB mem-reservation=7.75MB thread-reservation=1
+|  |  |  |  |  Per-Instance Resources: mem-estimate=2.30MB mem-reservation=1.94MB thread-reservation=1
 |  |  |  |  |  max-parallelism=2 segment-costs=[18844]
 |  |  |  |  JOIN BUILD
 |  |  |  |  |  join-table-id=40 plan-id=41 cohort-id=12
 |  |  |  |  |  build expressions: iws.i_item_sk
 |  |  |  |  |  runtime filters: RF101[min_max] <- iws.i_item_sk
-|  |  |  |  |  mem-estimate=7.75MB mem-reservation=7.75MB spill-buffer=64.00KB thread-reservation=0 cost=18000
+|  |  |  |  |  mem-estimate=1.94MB mem-reservation=1.94MB spill-buffer=64.00KB thread-reservation=0 cost=18000
 |  |  |  |  |
 |  |  |  |  197:EXCHANGE [BROADCAST]
 |  |  |  |  |  mem-estimate=375.56KB mem-reservation=0B thread-reservation=0
@@ -755,7 +755,7 @@ max-parallelism=12 segment-costs=[749813, 429878, 215944, 13294224, 142772] cpu-
 |  |  |  |  |
 |  |  |  |  F64:PLAN FRAGMENT [RANDOM] hosts=1 instances=1
 |  |  |  |  Per-Instance Resources: mem-estimate=16.09MB mem-reservation=256.00KB thread-reservation=1
-|  |  |  |  max-parallelism=1 segment-costs=[774]
+|  |  |  |  max-parallelism=1 segment-costs=[50774]
 |  |  |  |  101:SCAN HDFS [tpcds_parquet.item iws, RANDOM]
 |  |  |  |     HDFS partitions=1/1 files=1 size=1.73MB
 |  |  |  |     stored statistics:
@@ -763,7 +763,7 @@ max-parallelism=12 segment-costs=[749813, 429878, 215944, 13294224, 142772] cpu-
 |  |  |  |       columns: all
 |  |  |  |     extrapolated-rows=disabled max-scan-range-rows=18.00K
 |  |  |  |     mem-estimate=16.00MB mem-reservation=256.00KB thread-reservation=0
-|  |  |  |     tuple-ids=82 row-size=20B cardinality=18.00K cost=352
+|  |  |  |     tuple-ids=82 row-size=20B cardinality=18.00K cost=50352
 |  |  |  |     in pipelines: 101(GETNEXT)
 |  |  |  |
 |  |  |  100:SCAN HDFS [tpcds_parquet.web_sales, RANDOM]
@@ -773,8 +773,8 @@ max-parallelism=12 segment-costs=[749813, 429878, 215944, 13294224, 142772] cpu-
 |  |  |       table: rows=719.38K size=45.09MB
 |  |  |       columns: all
 |  |  |     extrapolated-rows=disabled max-scan-range-rows=644.77K
-|  |  |     mem-estimate=32.00MB mem-reservation=4.00MB thread-reservation=0
-|  |  |     tuple-ids=81 row-size=12B cardinality=719.38K cost=8431
+|  |  |     mem-estimate=16.00MB mem-reservation=4.00MB thread-reservation=0
+|  |  |     tuple-ids=81 row-size=12B cardinality=719.38K cost=108431
 |  |  |     in pipelines: 100(GETNEXT)
 |  |  |
 |  |  106:HASH JOIN [LEFT SEMI JOIN, PARTITIONED]
@@ -784,7 +784,7 @@ max-parallelism=12 segment-costs=[749813, 429878, 215944, 13294224, 142772] cpu-
 |  |  |  tuple-ids=75 row-size=12B cardinality=148.80K cost=446400
 |  |  |  in pipelines: 191(GETNEXT), 195(OPEN)
 |  |  |
-|  |  |--F122:PLAN FRAGMENT [HASH(iss.i_brand_id,iss.i_class_id,iss.i_category_id)] hosts=3 instances=6 (adjusted from 12)
+|  |  |--F122:PLAN FRAGMENT [HASH(iss.i_brand_id,iss.i_class_id,iss.i_category_id)] hosts=3 instances=6 (adjusted from 48)
 |  |  |  |  Per-Instance Resources: mem-estimate=2.60MB mem-reservation=1.94MB thread-reservation=1
 |  |  |  |  max-parallelism=6 segment-costs=[448725] cpu-comparison-result=8 [max(6 (self) vs 8 (sum children))]
 |  |  |  JOIN BUILD
@@ -799,7 +799,7 @@ max-parallelism=12 segment-costs=[749813, 429878, 215944, 13294224, 142772] cpu-
 |  |  |  |
 |  |  |  F62:PLAN FRAGMENT [HASH(ics.i_brand_id,ics.i_class_id,ics.i_category_id)] hosts=3 instances=6 (adjusted from 3)
 |  |  |  Per-Instance Resources: mem-estimate=10.61MB mem-reservation=1.94MB thread-reservation=1
-|  |  |  max-parallelism=3 segment-costs=[448725, 2325] cpu-comparison-result=8 [max(6 (self) vs 8 (sum children))]
+|  |  |  max-parallelism=6 segment-costs=[448725, 2325] cpu-comparison-result=8 [max(6 (self) vs 8 (sum children))]
 |  |  |  195:AGGREGATE [FINALIZE]
 |  |  |  |  group by: ics.i_brand_id, ics.i_class_id, ics.i_category_id
 |  |  |  |  mem-estimate=10.00MB mem-reservation=1.94MB spill-buffer=64.00KB thread-reservation=0
@@ -812,8 +812,8 @@ max-parallelism=12 segment-costs=[749813, 429878, 215944, 13294224, 142772] cpu-
 |  |  |  |  in pipelines: 95(GETNEXT)
 |  |  |  |
 |  |  |  F59:PLAN FRAGMENT [RANDOM] hosts=3 instances=3
-|  |  |  Per-Instance Resources: mem-estimate=58.38MB mem-reservation=9.00MB thread-reservation=1
-|  |  |  max-parallelism=3 segment-costs=[7224634, 2325] cpu-comparison-result=8 [max(3 (self) vs 8 (sum children))]
+|  |  |  Per-Instance Resources: mem-estimate=26.38MB mem-reservation=9.00MB thread-reservation=1
+|  |  |  max-parallelism=3 segment-costs=[7374634, 2325] cpu-comparison-result=8 [max(3 (self) vs 8 (sum children))]
 |  |  |  105:AGGREGATE [STREAMING]
 |  |  |  |  group by: ics.i_brand_id, ics.i_class_id, ics.i_category_id
 |  |  |  |  mem-estimate=10.00MB mem-reservation=5.00MB spill-buffer=256.00KB thread-reservation=0
@@ -829,13 +829,13 @@ max-parallelism=12 segment-costs=[749813, 429878, 215944, 13294224, 142772] cpu-
 |  |  |  |  in pipelines: 95(GETNEXT), 97(OPEN)
 |  |  |  |
 |  |  |  |--F123:PLAN FRAGMENT [RANDOM] hosts=3 instances=3
-|  |  |  |  |  Per-Instance Resources: mem-estimate=7.82MB mem-reservation=7.75MB thread-reservation=1
+|  |  |  |  |  Per-Instance Resources: mem-estimate=2.00MB mem-reservation=1.94MB thread-reservation=1
 |  |  |  |  |  max-parallelism=3 segment-costs=[7563]
 |  |  |  |  JOIN BUILD
 |  |  |  |  |  join-table-id=42 plan-id=43 cohort-id=13
 |  |  |  |  |  build expressions: d2.d_date_sk
 |  |  |  |  |  runtime filters: RF095[min_max] <- d2.d_date_sk
-|  |  |  |  |  mem-estimate=7.75MB mem-reservation=7.75MB spill-buffer=64.00KB thread-reservation=0 cost=7305
+|  |  |  |  |  mem-estimate=1.94MB mem-reservation=1.94MB spill-buffer=64.00KB thread-reservation=0 cost=7305
 |  |  |  |  |
 |  |  |  |  193:EXCHANGE [BROADCAST]
 |  |  |  |  |  mem-estimate=69.07KB mem-reservation=0B thread-reservation=0
@@ -844,7 +844,7 @@ max-parallelism=12 segment-costs=[749813, 429878, 215944, 13294224, 142772] cpu-
 |  |  |  |  |
 |  |  |  |  F61:PLAN FRAGMENT [RANDOM] hosts=1 instances=1
 |  |  |  |  Per-Instance Resources: mem-estimate=16.05MB mem-reservation=512.00KB thread-reservation=1
-|  |  |  |  max-parallelism=1 segment-costs=[146755]
+|  |  |  |  max-parallelism=1 segment-costs=[196755]
 |  |  |  |  97:SCAN HDFS [tpcds_parquet.date_dim d2, RANDOM]
 |  |  |  |     HDFS partitions=1/1 files=1 size=2.15MB
 |  |  |  |     predicates: d2.d_year <= CAST(2001 AS INT), d2.d_year >= CAST(1999 AS INT)
@@ -855,7 +855,7 @@ max-parallelism=12 segment-costs=[749813, 429878, 215944, 13294224, 142772] cpu-
 |  |  |  |     parquet statistics predicates: d2.d_year <= CAST(2001 AS INT), d2.d_year >= CAST(1999 AS INT)
 |  |  |  |     parquet dictionary predicates: d2.d_year <= CAST(2001 AS INT), d2.d_year >= CAST(1999 AS INT)
 |  |  |  |     mem-estimate=16.00MB mem-reservation=512.00KB thread-reservation=0
-|  |  |  |     tuple-ids=79 row-size=8B cardinality=7.30K cost=146669
+|  |  |  |     tuple-ids=79 row-size=8B cardinality=7.30K cost=196669
 |  |  |  |     in pipelines: 97(GETNEXT)
 |  |  |  |
 |  |  |  98:HASH JOIN [INNER JOIN, BROADCAST]
@@ -867,13 +867,13 @@ max-parallelism=12 segment-costs=[749813, 429878, 215944, 13294224, 142772] cpu-
 |  |  |  |  in pipelines: 95(GETNEXT), 96(OPEN)
 |  |  |  |
 |  |  |  |--F124:PLAN FRAGMENT [RANDOM] hosts=3 instances=3
-|  |  |  |  |  Per-Instance Resources: mem-estimate=8.12MB mem-reservation=7.75MB thread-reservation=1
+|  |  |  |  |  Per-Instance Resources: mem-estimate=2.30MB mem-reservation=1.94MB thread-reservation=1
 |  |  |  |  |  max-parallelism=3 segment-costs=[19266]
 |  |  |  |  JOIN BUILD
 |  |  |  |  |  join-table-id=43 plan-id=44 cohort-id=13
 |  |  |  |  |  build expressions: ics.i_item_sk
 |  |  |  |  |  runtime filters: RF097[min_max] <- ics.i_item_sk
-|  |  |  |  |  mem-estimate=7.75MB mem-reservation=7.75MB spill-buffer=64.00KB thread-reservation=0 cost=18000
+|  |  |  |  |  mem-estimate=1.94MB mem-reservation=1.94MB spill-buffer=64.00KB thread-reservation=0 cost=18000
 |  |  |  |  |
 |  |  |  |  192:EXCHANGE [BROADCAST]
 |  |  |  |  |  mem-estimate=375.56KB mem-reservation=0B thread-reservation=0
@@ -882,7 +882,7 @@ max-parallelism=12 segment-costs=[749813, 429878, 215944, 13294224, 142772] cpu-
 |  |  |  |  |
 |  |  |  |  F60:PLAN FRAGMENT [RANDOM] hosts=1 instances=1
 |  |  |  |  Per-Instance Resources: mem-estimate=16.09MB mem-reservation=256.00KB thread-reservation=1
-|  |  |  |  max-parallelism=1 segment-costs=[774]
+|  |  |  |  max-parallelism=1 segment-costs=[50774]
 |  |  |  |  96:SCAN HDFS [tpcds_parquet.item ics, RANDOM]
 |  |  |  |     HDFS partitions=1/1 files=1 size=1.73MB
 |  |  |  |     stored statistics:
@@ -890,7 +890,7 @@ max-parallelism=12 segment-costs=[749813, 429878, 215944, 13294224, 142772] cpu-
 |  |  |  |       columns: all
 |  |  |  |     extrapolated-rows=disabled max-scan-range-rows=18.00K
 |  |  |  |     mem-estimate=16.00MB mem-reservation=256.00KB thread-reservation=0
-|  |  |  |     tuple-ids=78 row-size=20B cardinality=18.00K cost=352
+|  |  |  |     tuple-ids=78 row-size=20B cardinality=18.00K cost=50352
 |  |  |  |     in pipelines: 96(GETNEXT)
 |  |  |  |
 |  |  |  95:SCAN HDFS [tpcds_parquet.catalog_sales, RANDOM]
@@ -900,8 +900,8 @@ max-parallelism=12 segment-costs=[749813, 429878, 215944, 13294224, 142772] cpu-
 |  |  |       table: rows=1.44M size=96.62MB
 |  |  |       columns: all
 |  |  |     extrapolated-rows=disabled max-scan-range-rows=650.14K
-|  |  |     mem-estimate=48.00MB mem-reservation=4.00MB thread-reservation=0
-|  |  |     tuple-ids=77 row-size=12B cardinality=1.44M cost=16894
+|  |  |     mem-estimate=16.00MB mem-reservation=4.00MB thread-reservation=0
+|  |  |     tuple-ids=77 row-size=12B cardinality=1.44M cost=166894
 |  |  |     in pipelines: 95(GETNEXT)
 |  |  |
 |  |  191:AGGREGATE [FINALIZE]
@@ -915,9 +915,9 @@ max-parallelism=12 segment-costs=[749813, 429878, 215944, 13294224, 142772] cpu-
 |  |  |  tuple-ids=75 row-size=12B cardinality=148.80K cost=2325
 |  |  |  in pipelines: 89(GETNEXT)
 |  |  |
-|  |  F55:PLAN FRAGMENT [RANDOM] hosts=3 instances=12
+|  |  F55:PLAN FRAGMENT [RANDOM] hosts=3 instances=12 (adjusted from 48)
 |  |  Per-Instance Resources: mem-estimate=26.38MB mem-reservation=5.50MB thread-reservation=1
-|  |  max-parallelism=12 segment-costs=[14435775, 2325] cpu-comparison-result=12 [max(12 (self) vs 8 (sum children))]
+|  |  max-parallelism=12 segment-costs=[105635772, 2325] cpu-comparison-result=12 [max(12 (self) vs 8 (sum children))]
 |  |  94:AGGREGATE [STREAMING]
 |  |  |  group by: iss.i_brand_id, iss.i_class_id, iss.i_category_id
 |  |  |  mem-estimate=10.00MB mem-reservation=5.00MB spill-buffer=256.00KB thread-reservation=0
@@ -947,7 +947,7 @@ max-parallelism=12 segment-costs=[749813, 429878, 215944, 13294224, 142772] cpu-
 |  |  |  |
 |  |  |  F57:PLAN FRAGMENT [RANDOM] hosts=1 instances=1
 |  |  |  Per-Instance Resources: mem-estimate=16.05MB mem-reservation=512.00KB thread-reservation=1
-|  |  |  max-parallelism=1 segment-costs=[146755]
+|  |  |  max-parallelism=1 segment-costs=[196755]
 |  |  |  91:SCAN HDFS [tpcds_parquet.date_dim d1, RANDOM]
 |  |  |     HDFS partitions=1/1 files=1 size=2.15MB
 |  |  |     predicates: d1.d_year <= CAST(2001 AS INT), d1.d_year >= CAST(1999 AS INT)
@@ -958,7 +958,7 @@ max-parallelism=12 segment-costs=[749813, 429878, 215944, 13294224, 142772] cpu-
 |  |  |     parquet statistics predicates: d1.d_year <= CAST(2001 AS INT), d1.d_year >= CAST(1999 AS INT)
 |  |  |     parquet dictionary predicates: d1.d_year <= CAST(2001 AS INT), d1.d_year >= CAST(1999 AS INT)
 |  |  |     mem-estimate=16.00MB mem-reservation=512.00KB thread-reservation=0
-|  |  |     tuple-ids=74 row-size=8B cardinality=7.30K cost=146669
+|  |  |     tuple-ids=74 row-size=8B cardinality=7.30K cost=196669
 |  |  |     in pipelines: 91(GETNEXT)
 |  |  |
 |  |  92:HASH JOIN [INNER JOIN, BROADCAST]
@@ -985,7 +985,7 @@ max-parallelism=12 segment-costs=[749813, 429878, 215944, 13294224, 142772] cpu-
 |  |  |  |
 |  |  |  F56:PLAN FRAGMENT [RANDOM] hosts=1 instances=1
 |  |  |  Per-Instance Resources: mem-estimate=16.09MB mem-reservation=256.00KB thread-reservation=1
-|  |  |  max-parallelism=1 segment-costs=[774]
+|  |  |  max-parallelism=1 segment-costs=[50774]
 |  |  |  90:SCAN HDFS [tpcds_parquet.item iss, RANDOM]
 |  |  |     HDFS partitions=1/1 files=1 size=1.73MB
 |  |  |     runtime filters: RF081[min_max] -> iss.i_brand_id, RF082[min_max] -> iss.i_category_id, RF083[min_max] -> iss.i_class_id
@@ -994,7 +994,7 @@ max-parallelism=12 segment-costs=[749813, 429878, 215944, 13294224, 142772] cpu-
 |  |  |       columns: all
 |  |  |     extrapolated-rows=disabled max-scan-range-rows=18.00K
 |  |  |     mem-estimate=16.00MB mem-reservation=256.00KB thread-reservation=0
-|  |  |     tuple-ids=73 row-size=20B cardinality=18.00K cost=352
+|  |  |     tuple-ids=73 row-size=20B cardinality=18.00K cost=50352
 |  |  |     in pipelines: 90(GETNEXT)
 |  |  |
 |  |  89:SCAN HDFS [tpcds_parquet.store_sales, RANDOM]
@@ -1006,7 +1006,7 @@ max-parallelism=12 segment-costs=[749813, 429878, 215944, 13294224, 142772] cpu-
 |  |       columns: all
 |  |     extrapolated-rows=disabled max-scan-range-rows=130.09K
 |  |     mem-estimate=16.00MB mem-reservation=512.00KB thread-reservation=0
-|  |     tuple-ids=72 row-size=12B cardinality=2.88M cost=33755
+|  |     tuple-ids=72 row-size=12B cardinality=2.88M cost=91233752
 |  |     in pipelines: 89(GETNEXT)
 |  |
 |  111:HASH JOIN [INNER JOIN, BROADCAST]
@@ -1018,13 +1018,13 @@ max-parallelism=12 segment-costs=[749813, 429878, 215944, 13294224, 142772] cpu-
 |  |  in pipelines: 85(GETNEXT), 86(OPEN)
 |  |
 |  |--F127:PLAN FRAGMENT [RANDOM] hosts=2 instances=2
-|  |  |  Per-Instance Resources: mem-estimate=8.12MB mem-reservation=7.75MB thread-reservation=1
+|  |  |  Per-Instance Resources: mem-estimate=2.30MB mem-reservation=1.94MB thread-reservation=1
 |  |  |  max-parallelism=2 segment-costs=[18844]
 |  |  JOIN BUILD
 |  |  |  join-table-id=46 plan-id=47 cohort-id=01
 |  |  |  build expressions: i_item_sk
 |  |  |  runtime filters: RF075[min_max] <- i_item_sk
-|  |  |  mem-estimate=7.75MB mem-reservation=7.75MB spill-buffer=64.00KB thread-reservation=0 cost=18000
+|  |  |  mem-estimate=1.94MB mem-reservation=1.94MB spill-buffer=64.00KB thread-reservation=0 cost=18000
 |  |  |
 |  |  187:EXCHANGE [BROADCAST]
 |  |  |  mem-estimate=375.56KB mem-reservation=0B thread-reservation=0
@@ -1033,7 +1033,7 @@ max-parallelism=12 segment-costs=[749813, 429878, 215944, 13294224, 142772] cpu-
 |  |  |
 |  |  F54:PLAN FRAGMENT [RANDOM] hosts=1 instances=1
 |  |  Per-Instance Resources: mem-estimate=16.09MB mem-reservation=256.00KB thread-reservation=1
-|  |  max-parallelism=1 segment-costs=[774]
+|  |  max-parallelism=1 segment-costs=[50774]
 |  |  86:SCAN HDFS [tpcds_parquet.item, RANDOM]
 |  |     HDFS partitions=1/1 files=1 size=1.73MB
 |  |     runtime filters: RF073[min_max] -> tpcds_parquet.item.i_item_sk
@@ -1042,7 +1042,7 @@ max-parallelism=12 segment-costs=[749813, 429878, 215944, 13294224, 142772] cpu-
 |  |       columns: all
 |  |     extrapolated-rows=disabled max-scan-range-rows=18.00K
 |  |     mem-estimate=16.00MB mem-reservation=256.00KB thread-reservation=0
-|  |     tuple-ids=69 row-size=20B cardinality=18.00K cost=352
+|  |     tuple-ids=69 row-size=20B cardinality=18.00K cost=50352
 |  |     in pipelines: 86(GETNEXT)
 |  |
 |  110:HASH JOIN [INNER JOIN, BROADCAST]
@@ -1054,13 +1054,13 @@ max-parallelism=12 segment-costs=[749813, 429878, 215944, 13294224, 142772] cpu-
 |  |  in pipelines: 85(GETNEXT), 87(OPEN)
 |  |
 |  |--F128:PLAN FRAGMENT [RANDOM] hosts=2 instances=2
-|  |  |  Per-Instance Resources: mem-estimate=8.77MB mem-reservation=8.75MB thread-reservation=1 runtime-filters-memory=1.00MB
+|  |  |  Per-Instance Resources: mem-estimate=2.95MB mem-reservation=2.94MB thread-reservation=1 runtime-filters-memory=1.00MB
 |  |  |  max-parallelism=2 segment-costs=[112]
 |  |  JOIN BUILD
 |  |  |  join-table-id=47 plan-id=48 cohort-id=01
 |  |  |  build expressions: d_date_sk
 |  |  |  runtime filters: RF076[bloom] <- d_date_sk, RF077[min_max] <- d_date_sk
-|  |  |  mem-estimate=7.75MB mem-reservation=7.75MB spill-buffer=64.00KB thread-reservation=0 cost=108
+|  |  |  mem-estimate=1.94MB mem-reservation=1.94MB spill-buffer=64.00KB thread-reservation=0 cost=108
 |  |  |
 |  |  186:EXCHANGE [BROADCAST]
 |  |  |  mem-estimate=16.00KB mem-reservation=0B thread-reservation=0
@@ -1069,7 +1069,7 @@ max-parallelism=12 segment-costs=[749813, 429878, 215944, 13294224, 142772] cpu-
 |  |  |
 |  |  F53:PLAN FRAGMENT [RANDOM] hosts=1 instances=1
 |  |  Per-Instance Resources: mem-estimate=16.06MB mem-reservation=512.00KB thread-reservation=1
-|  |  max-parallelism=1 segment-costs=[146957]
+|  |  max-parallelism=1 segment-costs=[196957]
 |  |  87:SCAN HDFS [tpcds_parquet.date_dim, RANDOM]
 |  |     HDFS partitions=1/1 files=1 size=2.15MB
 |  |     predicates: d_year = CAST(2001 AS INT), d_moy = CAST(11 AS INT)
@@ -1080,7 +1080,7 @@ max-parallelism=12 segment-costs=[749813, 429878, 215944, 13294224, 142772] cpu-
 |  |     parquet statistics predicates: d_year = CAST(2001 AS INT), d_moy = CAST(11 AS INT)
 |  |     parquet dictionary predicates: d_year = CAST(2001 AS INT), d_moy = CAST(11 AS INT)
 |  |     mem-estimate=16.00MB mem-reservation=512.00KB thread-reservation=0
-|  |     tuple-ids=70 row-size=12B cardinality=108 cost=146955
+|  |     tuple-ids=70 row-size=12B cardinality=108 cost=196955
 |  |     in pipelines: 87(GETNEXT)
 |  |
 |  85:SCAN HDFS [tpcds_parquet.web_sales, RANDOM]
@@ -1090,8 +1090,8 @@ max-parallelism=12 segment-costs=[749813, 429878, 215944, 13294224, 142772] cpu-
 |       table: rows=719.38K size=45.09MB
 |       columns: all
 |     extrapolated-rows=disabled max-scan-range-rows=644.77K
-|     mem-estimate=32.00MB mem-reservation=4.00MB thread-reservation=0
-|     tuple-ids=68 row-size=20B cardinality=719.38K cost=14051
+|     mem-estimate=16.00MB mem-reservation=4.00MB thread-reservation=0
+|     tuple-ids=68 row-size=20B cardinality=719.38K cost=114051
 |     in pipelines: 85(GETNEXT)
 |
 |--84:NESTED LOOP JOIN [INNER JOIN, BROADCAST]
@@ -1115,7 +1115,7 @@ max-parallelism=12 segment-costs=[749813, 429878, 215944, 13294224, 142772] cpu-
 |  |  |
 |  |  F51:PLAN FRAGMENT [UNPARTITIONED] hosts=1 instances=1
 |  |  Per-Instance Resources: mem-estimate=96.00KB mem-reservation=0B thread-reservation=1
-|  |  max-parallelism=1 segment-costs=[2, 1] cpu-comparison-result=12 [max(2 (self) vs 12 (sum children))]
+|  |  max-parallelism=2 segment-costs=[2, 1] cpu-comparison-result=12 [max(2 (self) vs 12 (sum children))]
 |  |  184:AGGREGATE [FINALIZE]
 |  |  |  output: avg:merge(quantity * list_price)
 |  |  |  mem-estimate=16.00KB mem-reservation=0B spill-buffer=2.00MB thread-reservation=0
@@ -1127,9 +1127,9 @@ max-parallelism=12 segment-costs=[749813, 429878, 215944, 13294224, 142772] cpu-
 |  |  |  tuple-ids=64 row-size=16B cardinality=1 cost=1
 |  |  |  in pipelines: 83(GETNEXT)
 |  |  |
-|  |  F50:PLAN FRAGMENT [RANDOM] hosts=3 instances=12
-|  |  Per-Instance Resources: mem-estimate=48.02MB mem-reservation=4.00MB thread-reservation=1
-|  |  max-parallelism=12 segment-costs=[40389768, 1] cpu-comparison-result=12 [max(12 (self) vs 12 (sum children))]
+|  |  F50:PLAN FRAGMENT [RANDOM] hosts=3 instances=12 (adjusted from 48)
+|  |  Per-Instance Resources: mem-estimate=16.02MB mem-reservation=4.00MB thread-reservation=1
+|  |  max-parallelism=12 segment-costs=[131839765, 1] cpu-comparison-result=12 [max(12 (self) vs 12 (sum children))]
 |  |  83:AGGREGATE
 |  |  |  output: avg(CAST(quantity AS DECIMAL(10,0)) * list_price)
 |  |  |  mem-estimate=16.00KB mem-reservation=0B spill-buffer=2.00MB thread-reservation=0
@@ -1165,7 +1165,7 @@ max-parallelism=12 segment-costs=[749813, 429878, 215944, 13294224, 142772] cpu-
 |  |  |  |  |
 |  |  |  |  F49:PLAN FRAGMENT [RANDOM] hosts=1 instances=1
 |  |  |  |  Per-Instance Resources: mem-estimate=16.05MB mem-reservation=512.00KB thread-reservation=1
-|  |  |  |  max-parallelism=1 segment-costs=[146755]
+|  |  |  |  max-parallelism=1 segment-costs=[196755]
 |  |  |  |  81:SCAN HDFS [tpcds_parquet.date_dim, RANDOM]
 |  |  |  |     HDFS partitions=1/1 files=1 size=2.15MB
 |  |  |  |     predicates: d_year <= CAST(2001 AS INT), d_year >= CAST(1999 AS INT)
@@ -1176,7 +1176,7 @@ max-parallelism=12 segment-costs=[749813, 429878, 215944, 13294224, 142772] cpu-
 |  |  |  |     parquet statistics predicates: d_year <= CAST(2001 AS INT), d_year >= CAST(1999 AS INT)
 |  |  |  |     parquet dictionary predicates: d_year <= CAST(2001 AS INT), d_year >= CAST(1999 AS INT)
 |  |  |  |     mem-estimate=16.00MB mem-reservation=512.00KB thread-reservation=0
-|  |  |  |     tuple-ids=61 row-size=8B cardinality=7.30K cost=146669
+|  |  |  |     tuple-ids=61 row-size=8B cardinality=7.30K cost=196669
 |  |  |  |     in pipelines: 81(GETNEXT)
 |  |  |  |
 |  |  |  80:SCAN HDFS [tpcds_parquet.web_sales, RANDOM]
@@ -1186,8 +1186,8 @@ max-parallelism=12 segment-costs=[749813, 429878, 215944, 13294224, 142772] cpu-
 |  |  |       table: rows=719.38K size=45.09MB
 |  |  |       columns: all
 |  |  |     extrapolated-rows=disabled max-scan-range-rows=644.77K
-|  |  |     mem-estimate=32.00MB mem-reservation=4.00MB thread-reservation=0
-|  |  |     tuple-ids=60 row-size=12B cardinality=719.38K cost=8431
+|  |  |     mem-estimate=16.00MB mem-reservation=4.00MB thread-reservation=0
+|  |  |     tuple-ids=60 row-size=12B cardinality=719.38K cost=108431
 |  |  |     in pipelines: 80(GETNEXT)
 |  |  |
 |  |  |--79:HASH JOIN [INNER JOIN, BROADCAST]
@@ -1214,7 +1214,7 @@ max-parallelism=12 segment-costs=[749813, 429878, 215944, 13294224, 142772] cpu-
 |  |  |  |  |
 |  |  |  |  F47:PLAN FRAGMENT [RANDOM] hosts=1 instances=1
 |  |  |  |  Per-Instance Resources: mem-estimate=16.05MB mem-reservation=512.00KB thread-reservation=1
-|  |  |  |  max-parallelism=1 segment-costs=[146755]
+|  |  |  |  max-parallelism=1 segment-costs=[196755]
 |  |  |  |  78:SCAN HDFS [tpcds_parquet.date_dim, RANDOM]
 |  |  |  |     HDFS partitions=1/1 files=1 size=2.15MB
 |  |  |  |     predicates: d_year <= CAST(2001 AS INT), d_year >= CAST(1999 AS INT)
@@ -1225,7 +1225,7 @@ max-parallelism=12 segment-costs=[749813, 429878, 215944, 13294224, 142772] cpu-
 |  |  |  |     parquet statistics predicates: d_year <= CAST(2001 AS INT), d_year >= CAST(1999 AS INT)
 |  |  |  |     parquet dictionary predicates: d_year <= CAST(2001 AS INT), d_year >= CAST(1999 AS INT)
 |  |  |  |     mem-estimate=16.00MB mem-reservation=512.00KB thread-reservation=0
-|  |  |  |     tuple-ids=59 row-size=8B cardinality=7.30K cost=146669
+|  |  |  |     tuple-ids=59 row-size=8B cardinality=7.30K cost=196669
 |  |  |  |     in pipelines: 78(GETNEXT)
 |  |  |  |
 |  |  |  77:SCAN HDFS [tpcds_parquet.catalog_sales, RANDOM]
@@ -1235,8 +1235,8 @@ max-parallelism=12 segment-costs=[749813, 429878, 215944, 13294224, 142772] cpu-
 |  |  |       table: rows=1.44M size=96.62MB
 |  |  |       columns: all
 |  |  |     extrapolated-rows=disabled max-scan-range-rows=650.14K
-|  |  |     mem-estimate=48.00MB mem-reservation=4.00MB thread-reservation=0
-|  |  |     tuple-ids=58 row-size=12B cardinality=1.44M cost=16894
+|  |  |     mem-estimate=16.00MB mem-reservation=4.00MB thread-reservation=0
+|  |  |     tuple-ids=58 row-size=12B cardinality=1.44M cost=166894
 |  |  |     in pipelines: 77(GETNEXT)
 |  |  |
 |  |  76:HASH JOIN [INNER JOIN, BROADCAST]
@@ -1262,7 +1262,7 @@ max-parallelism=12 segment-costs=[749813, 429878, 215944, 13294224, 142772] cpu-
 |  |  |  |
 |  |  |  F45:PLAN FRAGMENT [RANDOM] hosts=1 instances=1
 |  |  |  Per-Instance Resources: mem-estimate=16.05MB mem-reservation=512.00KB thread-reservation=1
-|  |  |  max-parallelism=1 segment-costs=[146755]
+|  |  |  max-parallelism=1 segment-costs=[196755]
 |  |  |  75:SCAN HDFS [tpcds_parquet.date_dim, RANDOM]
 |  |  |     HDFS partitions=1/1 files=1 size=2.15MB
 |  |  |     predicates: d_year <= CAST(2001 AS INT), d_year >= CAST(1999 AS INT)
@@ -1273,7 +1273,7 @@ max-parallelism=12 segment-costs=[749813, 429878, 215944, 13294224, 142772] cpu-
 |  |  |     parquet statistics predicates: d_year <= CAST(2001 AS INT), d_year >= CAST(1999 AS INT)
 |  |  |     parquet dictionary predicates: d_year <= CAST(2001 AS INT), d_year >= CAST(1999 AS INT)
 |  |  |     mem-estimate=16.00MB mem-reservation=512.00KB thread-reservation=0
-|  |  |     tuple-ids=57 row-size=8B cardinality=7.30K cost=146669
+|  |  |     tuple-ids=57 row-size=8B cardinality=7.30K cost=196669
 |  |  |     in pipelines: 75(GETNEXT)
 |  |  |
 |  |  74:SCAN HDFS [tpcds_parquet.store_sales, RANDOM]
@@ -1284,7 +1284,7 @@ max-parallelism=12 segment-costs=[749813, 429878, 215944, 13294224, 142772] cpu-
 |  |       columns: all
 |  |     extrapolated-rows=disabled max-scan-range-rows=130.09K
 |  |     mem-estimate=16.00MB mem-reservation=512.00KB thread-reservation=0
-|  |     tuple-ids=56 row-size=12B cardinality=2.88M cost=33755
+|  |     tuple-ids=56 row-size=12B cardinality=2.88M cost=91233752
 |  |     in pipelines: 74(GETNEXT)
 |  |
 |  179:AGGREGATE [FINALIZE]
@@ -1301,8 +1301,8 @@ max-parallelism=12 segment-costs=[749813, 429878, 215944, 13294224, 142772] cpu-
 |  |
 |  F26:PLAN FRAGMENT [RANDOM] hosts=3 instances=3
 |  Per-Host Shared Resources: mem-estimate=1.00MB mem-reservation=1.00MB thread-reservation=0 runtime-filters-memory=1.00MB
-|  Per-Instance Resources: mem-estimate=59.88MB mem-reservation=6.00MB thread-reservation=1
-|  max-parallelism=3 segment-costs=[2066867, 3333] cpu-comparison-result=41 [max(3 (self) vs 41 (sum children))]
+|  Per-Instance Resources: mem-estimate=27.88MB mem-reservation=6.00MB thread-reservation=1
+|  max-parallelism=3 segment-costs=[2216867, 3333] cpu-comparison-result=41 [max(3 (self) vs 41 (sum children))]
 |  72:AGGREGATE [STREAMING]
 |  |  output: sum(CAST(cs_quantity AS DECIMAL(10,0)) * cs_list_price), count(*)
 |  |  group by: i_brand_id, i_class_id, i_category_id
@@ -1318,22 +1318,22 @@ max-parallelism=12 segment-costs=[749813, 429878, 215944, 13294224, 142772] cpu-
 |  |  in pipelines: 43(GETNEXT), 176(OPEN)
 |  |
 |  |--F105:PLAN FRAGMENT [RANDOM] hosts=3 instances=3
-|  |  |  Per-Instance Resources: mem-estimate=7.96MB mem-reservation=7.75MB thread-reservation=1
+|  |  |  Per-Instance Resources: mem-estimate=2.14MB mem-reservation=1.94MB thread-reservation=1
 |  |  |  max-parallelism=3 segment-costs=[18608] cpu-comparison-result=33 [max(3 (self) vs 33 (sum children))]
 |  |  JOIN BUILD
 |  |  |  join-table-id=24 plan-id=25 cohort-id=01
 |  |  |  build expressions: tpcds_parquet.item.i_item_sk
 |  |  |  runtime filters: RF037[min_max] <- tpcds_parquet.item.i_item_sk
-|  |  |  mem-estimate=7.75MB mem-reservation=7.75MB spill-buffer=64.00KB thread-reservation=0 cost=17975
+|  |  |  mem-estimate=1.94MB mem-reservation=1.94MB spill-buffer=64.00KB thread-reservation=0 cost=17975
 |  |  |
 |  |  177:EXCHANGE [BROADCAST]
 |  |  |  mem-estimate=212.43KB mem-reservation=0B thread-reservation=0
 |  |  |  tuple-ids=148 row-size=8B cardinality=17.98K cost=633
 |  |  |  in pipelines: 176(GETNEXT)
 |  |  |
-|  |  F42:PLAN FRAGMENT [HASH(tpcds_parquet.item.i_item_sk)] hosts=3 instances=6 (adjusted from 12)
+|  |  F42:PLAN FRAGMENT [HASH(tpcds_parquet.item.i_item_sk)] hosts=3 instances=6 (adjusted from 48)
 |  |  Per-Instance Resources: mem-estimate=10.12MB mem-reservation=1.94MB thread-reservation=1
-|  |  max-parallelism=3 segment-costs=[18186, 211] cpu-comparison-result=33 [max(6 (self) vs 33 (sum children))]
+|  |  max-parallelism=6 segment-costs=[18186, 211] cpu-comparison-result=33 [max(6 (self) vs 33 (sum children))]
 |  |  176:AGGREGATE [FINALIZE]
 |  |  |  group by: tpcds_parquet.item.i_item_sk
 |  |  |  mem-estimate=10.00MB mem-reservation=1.94MB spill-buffer=64.00KB thread-reservation=0
@@ -1345,9 +1345,9 @@ max-parallelism=12 segment-costs=[749813, 429878, 215944, 13294224, 142772] cpu-
 |  |  |  tuple-ids=148 row-size=8B cardinality=17.98K cost=211
 |  |  |  in pipelines: 163(GETNEXT)
 |  |  |
-|  |  F32:PLAN FRAGMENT [HASH(iss.i_brand_id,iss.i_class_id,iss.i_category_id)] hosts=3 instances=6 (adjusted from 12)
+|  |  F32:PLAN FRAGMENT [HASH(iss.i_brand_id,iss.i_class_id,iss.i_category_id)] hosts=3 instances=6 (adjusted from 48)
 |  |  Per-Instance Resources: mem-estimate=20.76MB mem-reservation=3.94MB thread-reservation=1
-|  |  max-parallelism=3 segment-costs=[448725, 1488000, 211] cpu-comparison-result=33 [max(6 (self) vs 33 (sum children))]
+|  |  max-parallelism=6 segment-costs=[448725, 1488000, 211] cpu-comparison-result=33 [max(6 (self) vs 33 (sum children))]
 |  |  70:AGGREGATE [STREAMING]
 |  |  |  group by: tpcds_parquet.item.i_item_sk
 |  |  |  mem-estimate=10.00MB mem-reservation=2.00MB spill-buffer=64.00KB thread-reservation=0
@@ -1362,7 +1362,7 @@ max-parallelism=12 segment-costs=[749813, 429878, 215944, 13294224, 142772] cpu-
 |  |  |  tuple-ids=41,37 row-size=32B cardinality=148.80K cost=446400
 |  |  |  in pipelines: 163(GETNEXT), 46(OPEN)
 |  |  |
-|  |  |--F106:PLAN FRAGMENT [HASH(iss.i_brand_id,iss.i_class_id,iss.i_category_id)] hosts=3 instances=6 (adjusted from 12)
+|  |  |--F106:PLAN FRAGMENT [HASH(iss.i_brand_id,iss.i_class_id,iss.i_category_id)] hosts=3 instances=6 (adjusted from 48)
 |  |  |  |  Per-Instance Resources: mem-estimate=2.30MB mem-reservation=1.94MB thread-reservation=1
 |  |  |  |  max-parallelism=6 segment-costs=[54422]
 |  |  |  JOIN BUILD
@@ -1378,7 +1378,7 @@ max-parallelism=12 segment-costs=[749813, 429878, 215944, 13294224, 142772] cpu-
 |  |  |  |
 |  |  |  F41:PLAN FRAGMENT [RANDOM] hosts=1 instances=1
 |  |  |  Per-Instance Resources: mem-estimate=16.56MB mem-reservation=256.00KB thread-reservation=1
-|  |  |  max-parallelism=1 segment-costs=[774]
+|  |  |  max-parallelism=1 segment-costs=[50774]
 |  |  |  46:SCAN HDFS [tpcds_parquet.item, RANDOM]
 |  |  |     HDFS partitions=1/1 files=1 size=1.73MB
 |  |  |     stored statistics:
@@ -1386,7 +1386,7 @@ max-parallelism=12 segment-costs=[749813, 429878, 215944, 13294224, 142772] cpu-
 |  |  |       columns: all
 |  |  |     extrapolated-rows=disabled max-scan-range-rows=18.00K
 |  |  |     mem-estimate=16.00MB mem-reservation=256.00KB thread-reservation=0
-|  |  |     tuple-ids=37 row-size=20B cardinality=18.00K cost=352
+|  |  |     tuple-ids=37 row-size=20B cardinality=18.00K cost=50352
 |  |  |     in pipelines: 46(GETNEXT)
 |  |  |
 |  |  66:HASH JOIN [LEFT SEMI JOIN, PARTITIONED]
@@ -1396,7 +1396,7 @@ max-parallelism=12 segment-costs=[749813, 429878, 215944, 13294224, 142772] cpu-
 |  |  |  tuple-ids=41 row-size=12B cardinality=148.80K cost=446400
 |  |  |  in pipelines: 163(GETNEXT), 172(OPEN)
 |  |  |
-|  |  |--F107:PLAN FRAGMENT [HASH(iss.i_brand_id,iss.i_class_id,iss.i_category_id)] hosts=3 instances=6 (adjusted from 12)
+|  |  |--F107:PLAN FRAGMENT [HASH(iss.i_brand_id,iss.i_class_id,iss.i_category_id)] hosts=3 instances=6 (adjusted from 48)
 |  |  |  |  Per-Instance Resources: mem-estimate=2.85MB mem-reservation=1.94MB thread-reservation=1
 |  |  |  |  max-parallelism=6 segment-costs=[448725] cpu-comparison-result=6 [max(6 (self) vs 6 (sum children))]
 |  |  |  JOIN BUILD
@@ -1411,7 +1411,7 @@ max-parallelism=12 segment-costs=[749813, 429878, 215944, 13294224, 142772] cpu-
 |  |  |  |
 |  |  |  F40:PLAN FRAGMENT [HASH(iws.i_brand_id,iws.i_class_id,iws.i_category_id)] hosts=2 instances=4 (adjusted from 2)
 |  |  |  Per-Instance Resources: mem-estimate=10.88MB mem-reservation=1.94MB thread-reservation=1
-|  |  |  max-parallelism=2 segment-costs=[448725, 2325] cpu-comparison-result=6 [max(4 (self) vs 6 (sum children))]
+|  |  |  max-parallelism=4 segment-costs=[448725, 2325] cpu-comparison-result=6 [max(4 (self) vs 6 (sum children))]
 |  |  |  172:AGGREGATE [FINALIZE]
 |  |  |  |  group by: iws.i_brand_id, iws.i_class_id, iws.i_category_id
 |  |  |  |  mem-estimate=10.00MB mem-reservation=1.94MB spill-buffer=64.00KB thread-reservation=0
@@ -1424,8 +1424,8 @@ max-parallelism=12 segment-costs=[749813, 429878, 215944, 13294224, 142772] cpu-
 |  |  |  |  in pipelines: 58(GETNEXT)
 |  |  |  |
 |  |  |  F37:PLAN FRAGMENT [RANDOM] hosts=2 instances=2
-|  |  |  Per-Instance Resources: mem-estimate=42.25MB mem-reservation=9.00MB thread-reservation=1
-|  |  |  max-parallelism=2 segment-costs=[3605351, 2325] cpu-comparison-result=6 [max(2 (self) vs 6 (sum children))]
+|  |  |  Per-Instance Resources: mem-estimate=26.25MB mem-reservation=9.00MB thread-reservation=1
+|  |  |  max-parallelism=2 segment-costs=[3705351, 2325] cpu-comparison-result=6 [max(2 (self) vs 6 (sum children))]
 |  |  |  65:AGGREGATE [STREAMING]
 |  |  |  |  group by: iws.i_brand_id, iws.i_class_id, iws.i_category_id
 |  |  |  |  mem-estimate=10.00MB mem-reservation=5.00MB spill-buffer=256.00KB thread-reservation=0
@@ -1441,13 +1441,13 @@ max-parallelism=12 segment-costs=[749813, 429878, 215944, 13294224, 142772] cpu-
 |  |  |  |  in pipelines: 58(GETNEXT), 60(OPEN)
 |  |  |  |
 |  |  |  |--F108:PLAN FRAGMENT [RANDOM] hosts=2 instances=2
-|  |  |  |  |  Per-Instance Resources: mem-estimate=7.82MB mem-reservation=7.75MB thread-reservation=1
+|  |  |  |  |  Per-Instance Resources: mem-estimate=2.00MB mem-reservation=1.94MB thread-reservation=1
 |  |  |  |  |  max-parallelism=2 segment-costs=[7477]
 |  |  |  |  JOIN BUILD
 |  |  |  |  |  join-table-id=27 plan-id=28 cohort-id=09
 |  |  |  |  |  build expressions: d3.d_date_sk
 |  |  |  |  |  runtime filters: RF063[min_max] <- d3.d_date_sk
-|  |  |  |  |  mem-estimate=7.75MB mem-reservation=7.75MB spill-buffer=64.00KB thread-reservation=0 cost=7305
+|  |  |  |  |  mem-estimate=1.94MB mem-reservation=1.94MB spill-buffer=64.00KB thread-reservation=0 cost=7305
 |  |  |  |  |
 |  |  |  |  170:EXCHANGE [BROADCAST]
 |  |  |  |  |  mem-estimate=69.07KB mem-reservation=0B thread-reservation=0
@@ -1456,7 +1456,7 @@ max-parallelism=12 segment-costs=[749813, 429878, 215944, 13294224, 142772] cpu-
 |  |  |  |  |
 |  |  |  |  F39:PLAN FRAGMENT [RANDOM] hosts=1 instances=1
 |  |  |  |  Per-Instance Resources: mem-estimate=16.05MB mem-reservation=512.00KB thread-reservation=1
-|  |  |  |  max-parallelism=1 segment-costs=[146755]
+|  |  |  |  max-parallelism=1 segment-costs=[196755]
 |  |  |  |  60:SCAN HDFS [tpcds_parquet.date_dim d3, RANDOM]
 |  |  |  |     HDFS partitions=1/1 files=1 size=2.15MB
 |  |  |  |     predicates: d3.d_year <= CAST(2001 AS INT), d3.d_year >= CAST(1999 AS INT)
@@ -1467,7 +1467,7 @@ max-parallelism=12 segment-costs=[749813, 429878, 215944, 13294224, 142772] cpu-
 |  |  |  |     parquet statistics predicates: d3.d_year <= CAST(2001 AS INT), d3.d_year >= CAST(1999 AS INT)
 |  |  |  |     parquet dictionary predicates: d3.d_year <= CAST(2001 AS INT), d3.d_year >= CAST(1999 AS INT)
 |  |  |  |     mem-estimate=16.00MB mem-reservation=512.00KB thread-reservation=0
-|  |  |  |     tuple-ids=49 row-size=8B cardinality=7.30K cost=146669
+|  |  |  |     tuple-ids=49 row-size=8B cardinality=7.30K cost=196669
 |  |  |  |     in pipelines: 60(GETNEXT)
 |  |  |  |
 |  |  |  61:HASH JOIN [INNER JOIN, BROADCAST]
@@ -1479,13 +1479,13 @@ max-parallelism=12 segment-costs=[749813, 429878, 215944, 13294224, 142772] cpu-
 |  |  |  |  in pipelines: 58(GETNEXT), 59(OPEN)
 |  |  |  |
 |  |  |  |--F109:PLAN FRAGMENT [RANDOM] hosts=2 instances=2
-|  |  |  |  |  Per-Instance Resources: mem-estimate=8.12MB mem-reservation=7.75MB thread-reservation=1
+|  |  |  |  |  Per-Instance Resources: mem-estimate=2.30MB mem-reservation=1.94MB thread-reservation=1
 |  |  |  |  |  max-parallelism=2 segment-costs=[18844]
 |  |  |  |  JOIN BUILD
 |  |  |  |  |  join-table-id=28 plan-id=29 cohort-id=09
 |  |  |  |  |  build expressions: iws.i_item_sk
 |  |  |  |  |  runtime filters: RF065[min_max] <- iws.i_item_sk
-|  |  |  |  |  mem-estimate=7.75MB mem-reservation=7.75MB spill-buffer=64.00KB thread-reservation=0 cost=18000
+|  |  |  |  |  mem-estimate=1.94MB mem-reservation=1.94MB spill-buffer=64.00KB thread-reservation=0 cost=18000
 |  |  |  |  |
 |  |  |  |  169:EXCHANGE [BROADCAST]
 |  |  |  |  |  mem-estimate=375.56KB mem-reservation=0B thread-reservation=0
@@ -1494,7 +1494,7 @@ max-parallelism=12 segment-costs=[749813, 429878, 215944, 13294224, 142772] cpu-
 |  |  |  |  |
 |  |  |  |  F38:PLAN FRAGMENT [RANDOM] hosts=1 instances=1
 |  |  |  |  Per-Instance Resources: mem-estimate=16.09MB mem-reservation=256.00KB thread-reservation=1
-|  |  |  |  max-parallelism=1 segment-costs=[774]
+|  |  |  |  max-parallelism=1 segment-costs=[50774]
 |  |  |  |  59:SCAN HDFS [tpcds_parquet.item iws, RANDOM]
 |  |  |  |     HDFS partitions=1/1 files=1 size=1.73MB
 |  |  |  |     stored statistics:
@@ -1502,7 +1502,7 @@ max-parallelism=12 segment-costs=[749813, 429878, 215944, 13294224, 142772] cpu-
 |  |  |  |       columns: all
 |  |  |  |     extrapolated-rows=disabled max-scan-range-rows=18.00K
 |  |  |  |     mem-estimate=16.00MB mem-reservation=256.00KB thread-reservation=0
-|  |  |  |     tuple-ids=48 row-size=20B cardinality=18.00K cost=352
+|  |  |  |     tuple-ids=48 row-size=20B cardinality=18.00K cost=50352
 |  |  |  |     in pipelines: 59(GETNEXT)
 |  |  |  |
 |  |  |  58:SCAN HDFS [tpcds_parquet.web_sales, RANDOM]
@@ -1512,8 +1512,8 @@ max-parallelism=12 segment-costs=[749813, 429878, 215944, 13294224, 142772] cpu-
 |  |  |       table: rows=719.38K size=45.09MB
 |  |  |       columns: all
 |  |  |     extrapolated-rows=disabled max-scan-range-rows=644.77K
-|  |  |     mem-estimate=32.00MB mem-reservation=4.00MB thread-reservation=0
-|  |  |     tuple-ids=47 row-size=12B cardinality=719.38K cost=8431
+|  |  |     mem-estimate=16.00MB mem-reservation=4.00MB thread-reservation=0
+|  |  |     tuple-ids=47 row-size=12B cardinality=719.38K cost=108431
 |  |  |     in pipelines: 58(GETNEXT)
 |  |  |
 |  |  64:HASH JOIN [LEFT SEMI JOIN, PARTITIONED]
@@ -1523,7 +1523,7 @@ max-parallelism=12 segment-costs=[749813, 429878, 215944, 13294224, 142772] cpu-
 |  |  |  tuple-ids=41 row-size=12B cardinality=148.80K cost=446400
 |  |  |  in pipelines: 163(GETNEXT), 167(OPEN)
 |  |  |
-|  |  |--F110:PLAN FRAGMENT [HASH(iss.i_brand_id,iss.i_class_id,iss.i_category_id)] hosts=3 instances=6 (adjusted from 12)
+|  |  |--F110:PLAN FRAGMENT [HASH(iss.i_brand_id,iss.i_class_id,iss.i_category_id)] hosts=3 instances=6 (adjusted from 48)
 |  |  |  |  Per-Instance Resources: mem-estimate=2.60MB mem-reservation=1.94MB thread-reservation=1
 |  |  |  |  max-parallelism=6 segment-costs=[448725] cpu-comparison-result=8 [max(6 (self) vs 8 (sum children))]
 |  |  |  JOIN BUILD
@@ -1538,7 +1538,7 @@ max-parallelism=12 segment-costs=[749813, 429878, 215944, 13294224, 142772] cpu-
 |  |  |  |
 |  |  |  F36:PLAN FRAGMENT [HASH(ics.i_brand_id,ics.i_class_id,ics.i_category_id)] hosts=3 instances=6 (adjusted from 3)
 |  |  |  Per-Instance Resources: mem-estimate=10.61MB mem-reservation=1.94MB thread-reservation=1
-|  |  |  max-parallelism=3 segment-costs=[448725, 2325] cpu-comparison-result=8 [max(6 (self) vs 8 (sum children))]
+|  |  |  max-parallelism=6 segment-costs=[448725, 2325] cpu-comparison-result=8 [max(6 (self) vs 8 (sum children))]
 |  |  |  167:AGGREGATE [FINALIZE]
 |  |  |  |  group by: ics.i_brand_id, ics.i_class_id, ics.i_category_id
 |  |  |  |  mem-estimate=10.00MB mem-reservation=1.94MB spill-buffer=64.00KB thread-reservation=0
@@ -1551,8 +1551,8 @@ max-parallelism=12 segment-costs=[749813, 429878, 215944, 13294224, 142772] cpu-
 |  |  |  |  in pipelines: 53(GETNEXT)
 |  |  |  |
 |  |  |  F33:PLAN FRAGMENT [RANDOM] hosts=3 instances=3
-|  |  |  Per-Instance Resources: mem-estimate=58.38MB mem-reservation=9.00MB thread-reservation=1
-|  |  |  max-parallelism=3 segment-costs=[7224634, 2325] cpu-comparison-result=8 [max(3 (self) vs 8 (sum children))]
+|  |  |  Per-Instance Resources: mem-estimate=26.38MB mem-reservation=9.00MB thread-reservation=1
+|  |  |  max-parallelism=3 segment-costs=[7374634, 2325] cpu-comparison-result=8 [max(3 (self) vs 8 (sum children))]
 |  |  |  63:AGGREGATE [STREAMING]
 |  |  |  |  group by: ics.i_brand_id, ics.i_class_id, ics.i_category_id
 |  |  |  |  mem-estimate=10.00MB mem-reservation=5.00MB spill-buffer=256.00KB thread-reservation=0
@@ -1568,13 +1568,13 @@ max-parallelism=12 segment-costs=[749813, 429878, 215944, 13294224, 142772] cpu-
 |  |  |  |  in pipelines: 53(GETNEXT), 55(OPEN)
 |  |  |  |
 |  |  |  |--F111:PLAN FRAGMENT [RANDOM] hosts=3 instances=3
-|  |  |  |  |  Per-Instance Resources: mem-estimate=7.82MB mem-reservation=7.75MB thread-reservation=1
+|  |  |  |  |  Per-Instance Resources: mem-estimate=2.00MB mem-reservation=1.94MB thread-reservation=1
 |  |  |  |  |  max-parallelism=3 segment-costs=[7563]
 |  |  |  |  JOIN BUILD
 |  |  |  |  |  join-table-id=30 plan-id=31 cohort-id=10
 |  |  |  |  |  build expressions: d2.d_date_sk
 |  |  |  |  |  runtime filters: RF059[min_max] <- d2.d_date_sk
-|  |  |  |  |  mem-estimate=7.75MB mem-reservation=7.75MB spill-buffer=64.00KB thread-reservation=0 cost=7305
+|  |  |  |  |  mem-estimate=1.94MB mem-reservation=1.94MB spill-buffer=64.00KB thread-reservation=0 cost=7305
 |  |  |  |  |
 |  |  |  |  165:EXCHANGE [BROADCAST]
 |  |  |  |  |  mem-estimate=69.07KB mem-reservation=0B thread-reservation=0
@@ -1583,7 +1583,7 @@ max-parallelism=12 segment-costs=[749813, 429878, 215944, 13294224, 142772] cpu-
 |  |  |  |  |
 |  |  |  |  F35:PLAN FRAGMENT [RANDOM] hosts=1 instances=1
 |  |  |  |  Per-Instance Resources: mem-estimate=16.05MB mem-reservation=512.00KB thread-reservation=1
-|  |  |  |  max-parallelism=1 segment-costs=[146755]
+|  |  |  |  max-parallelism=1 segment-costs=[196755]
 |  |  |  |  55:SCAN HDFS [tpcds_parquet.date_dim d2, RANDOM]
 |  |  |  |     HDFS partitions=1/1 files=1 size=2.15MB
 |  |  |  |     predicates: d2.d_year <= CAST(2001 AS INT), d2.d_year >= CAST(1999 AS INT)
@@ -1594,7 +1594,7 @@ max-parallelism=12 segment-costs=[749813, 429878, 215944, 13294224, 142772] cpu-
 |  |  |  |     parquet statistics predicates: d2.d_year <= CAST(2001 AS INT), d2.d_year >= CAST(1999 AS INT)
 |  |  |  |     parquet dictionary predicates: d2.d_year <= CAST(2001 AS INT), d2.d_year >= CAST(1999 AS INT)
 |  |  |  |     mem-estimate=16.00MB mem-reservation=512.00KB thread-reservation=0
-|  |  |  |     tuple-ids=45 row-size=8B cardinality=7.30K cost=146669
+|  |  |  |     tuple-ids=45 row-size=8B cardinality=7.30K cost=196669
 |  |  |  |     in pipelines: 55(GETNEXT)
 |  |  |  |
 |  |  |  56:HASH JOIN [INNER JOIN, BROADCAST]
@@ -1606,13 +1606,13 @@ max-parallelism=12 segment-costs=[749813, 429878, 215944, 13294224, 142772] cpu-
 |  |  |  |  in pipelines: 53(GETNEXT), 54(OPEN)
 |  |  |  |
 |  |  |  |--F112:PLAN FRAGMENT [RANDOM] hosts=3 instances=3
-|  |  |  |  |  Per-Instance Resources: mem-estimate=8.12MB mem-reservation=7.75MB thread-reservation=1
+|  |  |  |  |  Per-Instance Resources: mem-estimate=2.30MB mem-reservation=1.94MB thread-reservation=1
 |  |  |  |  |  max-parallelism=3 segment-costs=[19266]
 |  |  |  |  JOIN BUILD
 |  |  |  |  |  join-table-id=31 plan-id=32 cohort-id=10
 |  |  |  |  |  build expressions: ics.i_item_sk
 |  |  |  |  |  runtime filters: RF061[min_max] <- ics.i_item_sk
-|  |  |  |  |  mem-estimate=7.75MB mem-reservation=7.75MB spill-buffer=64.00KB thread-reservation=0 cost=18000
+|  |  |  |  |  mem-estimate=1.94MB mem-reservation=1.94MB spill-buffer=64.00KB thread-reservation=0 cost=18000
 |  |  |  |  |
 |  |  |  |  164:EXCHANGE [BROADCAST]
 |  |  |  |  |  mem-estimate=375.56KB mem-reservation=0B thread-reservation=0
@@ -1621,7 +1621,7 @@ max-parallelism=12 segment-costs=[749813, 429878, 215944, 13294224, 142772] cpu-
 |  |  |  |  |
 |  |  |  |  F34:PLAN FRAGMENT [RANDOM] hosts=1 instances=1
 |  |  |  |  Per-Instance Resources: mem-estimate=16.09MB mem-reservation=256.00KB thread-reservation=1
-|  |  |  |  max-parallelism=1 segment-costs=[774]
+|  |  |  |  max-parallelism=1 segment-costs=[50774]
 |  |  |  |  54:SCAN HDFS [tpcds_parquet.item ics, RANDOM]
 |  |  |  |     HDFS partitions=1/1 files=1 size=1.73MB
 |  |  |  |     stored statistics:
@@ -1629,7 +1629,7 @@ max-parallelism=12 segment-costs=[749813, 429878, 215944, 13294224, 142772] cpu-
 |  |  |  |       columns: all
 |  |  |  |     extrapolated-rows=disabled max-scan-range-rows=18.00K
 |  |  |  |     mem-estimate=16.00MB mem-reservation=256.00KB thread-reservation=0
-|  |  |  |     tuple-ids=44 row-size=20B cardinality=18.00K cost=352
+|  |  |  |     tuple-ids=44 row-size=20B cardinality=18.00K cost=50352
 |  |  |  |     in pipelines: 54(GETNEXT)
 |  |  |  |
 |  |  |  53:SCAN HDFS [tpcds_parquet.catalog_sales, RANDOM]
@@ -1639,8 +1639,8 @@ max-parallelism=12 segment-costs=[749813, 429878, 215944, 13294224, 142772] cpu-
 |  |  |       table: rows=1.44M size=96.62MB
 |  |  |       columns: all
 |  |  |     extrapolated-rows=disabled max-scan-range-rows=650.14K
-|  |  |     mem-estimate=48.00MB mem-reservation=4.00MB thread-reservation=0
-|  |  |     tuple-ids=43 row-size=12B cardinality=1.44M cost=16894
+|  |  |     mem-estimate=16.00MB mem-reservation=4.00MB thread-reservation=0
+|  |  |     tuple-ids=43 row-size=12B cardinality=1.44M cost=166894
 |  |  |     in pipelines: 53(GETNEXT)
 |  |  |
 |  |  163:AGGREGATE [FINALIZE]
@@ -1654,9 +1654,9 @@ max-parallelism=12 segment-costs=[749813, 429878, 215944, 13294224, 142772] cpu-
 |  |  |  tuple-ids=41 row-size=12B cardinality=148.80K cost=2325
 |  |  |  in pipelines: 47(GETNEXT)
 |  |  |
-|  |  F29:PLAN FRAGMENT [RANDOM] hosts=3 instances=12
+|  |  F29:PLAN FRAGMENT [RANDOM] hosts=3 instances=12 (adjusted from 48)
 |  |  Per-Instance Resources: mem-estimate=26.38MB mem-reservation=5.50MB thread-reservation=1
-|  |  max-parallelism=12 segment-costs=[14435775, 2325] cpu-comparison-result=12 [max(12 (self) vs 8 (sum children))]
+|  |  max-parallelism=12 segment-costs=[105635772, 2325] cpu-comparison-result=12 [max(12 (self) vs 8 (sum children))]
 |  |  52:AGGREGATE [STREAMING]
 |  |  |  group by: iss.i_brand_id, iss.i_class_id, iss.i_category_id
 |  |  |  mem-estimate=10.00MB mem-reservation=5.00MB spill-buffer=256.00KB thread-reservation=0
@@ -1686,7 +1686,7 @@ max-parallelism=12 segment-costs=[749813, 429878, 215944, 13294224, 142772] cpu-
 |  |  |  |
 |  |  |  F31:PLAN FRAGMENT [RANDOM] hosts=1 instances=1
 |  |  |  Per-Instance Resources: mem-estimate=16.05MB mem-reservation=512.00KB thread-reservation=1
-|  |  |  max-parallelism=1 segment-costs=[146755]
+|  |  |  max-parallelism=1 segment-costs=[196755]
 |  |  |  49:SCAN HDFS [tpcds_parquet.date_dim d1, RANDOM]
 |  |  |     HDFS partitions=1/1 files=1 size=2.15MB
 |  |  |     predicates: d1.d_year <= CAST(2001 AS INT), d1.d_year >= CAST(1999 AS INT)
@@ -1697,7 +1697,7 @@ max-parallelism=12 segment-costs=[749813, 429878, 215944, 13294224, 142772] cpu-
 |  |  |     parquet statistics predicates: d1.d_year <= CAST(2001 AS INT), d1.d_year >= CAST(1999 AS INT)
 |  |  |     parquet dictionary predicates: d1.d_year <= CAST(2001 AS INT), d1.d_year >= CAST(1999 AS INT)
 |  |  |     mem-estimate=16.00MB mem-reservation=512.00KB thread-reservation=0
-|  |  |     tuple-ids=40 row-size=8B cardinality=7.30K cost=146669
+|  |  |     tuple-ids=40 row-size=8B cardinality=7.30K cost=196669
 |  |  |     in pipelines: 49(GETNEXT)
 |  |  |
 |  |  50:HASH JOIN [INNER JOIN, BROADCAST]
@@ -1724,7 +1724,7 @@ max-parallelism=12 segment-costs=[749813, 429878, 215944, 13294224, 142772] cpu-
 |  |  |  |
 |  |  |  F30:PLAN FRAGMENT [RANDOM] hosts=1 instances=1
 |  |  |  Per-Instance Resources: mem-estimate=16.09MB mem-reservation=256.00KB thread-reservation=1
-|  |  |  max-parallelism=1 segment-costs=[774]
+|  |  |  max-parallelism=1 segment-costs=[50774]
 |  |  |  48:SCAN HDFS [tpcds_parquet.item iss, RANDOM]
 |  |  |     HDFS partitions=1/1 files=1 size=1.73MB
 |  |  |     runtime filters: RF045[min_max] -> iss.i_brand_id, RF046[min_max] -> iss.i_category_id, RF047[min_max] -> iss.i_class_id
@@ -1733,7 +1733,7 @@ max-parallelism=12 segment-costs=[749813, 429878, 215944, 13294224, 142772] cpu-
 |  |  |       columns: all
 |  |  |     extrapolated-rows=disabled max-scan-range-rows=18.00K
 |  |  |     mem-estimate=16.00MB mem-reservation=256.00KB thread-reservation=0
-|  |  |     tuple-ids=39 row-size=20B cardinality=18.00K cost=352
+|  |  |     tuple-ids=39 row-size=20B cardinality=18.00K cost=50352
 |  |  |     in pipelines: 48(GETNEXT)
 |  |  |
 |  |  47:SCAN HDFS [tpcds_parquet.store_sales, RANDOM]
@@ -1745,7 +1745,7 @@ max-parallelism=12 segment-costs=[749813, 429878, 215944, 13294224, 142772] cpu-
 |  |       columns: all
 |  |     extrapolated-rows=disabled max-scan-range-rows=130.09K
 |  |     mem-estimate=16.00MB mem-reservation=512.00KB thread-reservation=0
-|  |     tuple-ids=38 row-size=12B cardinality=2.88M cost=33755
+|  |     tuple-ids=38 row-size=12B cardinality=2.88M cost=91233752
 |  |     in pipelines: 47(GETNEXT)
 |  |
 |  69:HASH JOIN [INNER JOIN, BROADCAST]
@@ -1757,13 +1757,13 @@ max-parallelism=12 segment-costs=[749813, 429878, 215944, 13294224, 142772] cpu-
 |  |  in pipelines: 43(GETNEXT), 44(OPEN)
 |  |
 |  |--F115:PLAN FRAGMENT [RANDOM] hosts=3 instances=3
-|  |  |  Per-Instance Resources: mem-estimate=8.12MB mem-reservation=7.75MB thread-reservation=1
+|  |  |  Per-Instance Resources: mem-estimate=2.30MB mem-reservation=1.94MB thread-reservation=1
 |  |  |  max-parallelism=3 segment-costs=[19266]
 |  |  JOIN BUILD
 |  |  |  join-table-id=34 plan-id=35 cohort-id=01
 |  |  |  build expressions: i_item_sk
 |  |  |  runtime filters: RF039[min_max] <- i_item_sk
-|  |  |  mem-estimate=7.75MB mem-reservation=7.75MB spill-buffer=64.00KB thread-reservation=0 cost=18000
+|  |  |  mem-estimate=1.94MB mem-reservation=1.94MB spill-buffer=64.00KB thread-reservation=0 cost=18000
 |  |  |
 |  |  159:EXCHANGE [BROADCAST]
 |  |  |  mem-estimate=375.56KB mem-reservation=0B thread-reservation=0
@@ -1772,7 +1772,7 @@ max-parallelism=12 segment-costs=[749813, 429878, 215944, 13294224, 142772] cpu-
 |  |  |
 |  |  F28:PLAN FRAGMENT [RANDOM] hosts=1 instances=1
 |  |  Per-Instance Resources: mem-estimate=16.09MB mem-reservation=256.00KB thread-reservation=1
-|  |  max-parallelism=1 segment-costs=[774]
+|  |  max-parallelism=1 segment-costs=[50774]
 |  |  44:SCAN HDFS [tpcds_parquet.item, RANDOM]
 |  |     HDFS partitions=1/1 files=1 size=1.73MB
 |  |     runtime filters: RF037[min_max] -> tpcds_parquet.item.i_item_sk
@@ -1781,7 +1781,7 @@ max-parallelism=12 segment-costs=[749813, 429878, 215944, 13294224, 142772] cpu-
 |  |       columns: all
 |  |     extrapolated-rows=disabled max-scan-range-rows=18.00K
 |  |     mem-estimate=16.00MB mem-reservation=256.00KB thread-reservation=0
-|  |     tuple-ids=35 row-size=20B cardinality=18.00K cost=352
+|  |     tuple-ids=35 row-size=20B cardinality=18.00K cost=50352
 |  |     in pipelines: 44(GETNEXT)
 |  |
 |  68:HASH JOIN [INNER JOIN, BROADCAST]
@@ -1793,13 +1793,13 @@ max-parallelism=12 segment-costs=[749813, 429878, 215944, 13294224, 142772] cpu-
 |  |  in pipelines: 43(GETNEXT), 45(OPEN)
 |  |
 |  |--F116:PLAN FRAGMENT [RANDOM] hosts=3 instances=3
-|  |  |  Per-Instance Resources: mem-estimate=8.77MB mem-reservation=8.75MB thread-reservation=1 runtime-filters-memory=1.00MB
+|  |  |  Per-Instance Resources: mem-estimate=2.95MB mem-reservation=2.94MB thread-reservation=1 runtime-filters-memory=1.00MB
 |  |  |  max-parallelism=3 segment-costs=[114]
 |  |  JOIN BUILD
 |  |  |  join-table-id=35 plan-id=36 cohort-id=01
 |  |  |  build expressions: d_date_sk
 |  |  |  runtime filters: RF040[bloom] <- d_date_sk, RF041[min_max] <- d_date_sk
-|  |  |  mem-estimate=7.75MB mem-reservation=7.75MB spill-buffer=64.00KB thread-reservation=0 cost=108
+|  |  |  mem-estimate=1.94MB mem-reservation=1.94MB spill-buffer=64.00KB thread-reservation=0 cost=108
 |  |  |
 |  |  158:EXCHANGE [BROADCAST]
 |  |  |  mem-estimate=16.00KB mem-reservation=0B thread-reservation=0
@@ -1808,7 +1808,7 @@ max-parallelism=12 segment-costs=[749813, 429878, 215944, 13294224, 142772] cpu-
 |  |  |
 |  |  F27:PLAN FRAGMENT [RANDOM] hosts=1 instances=1
 |  |  Per-Instance Resources: mem-estimate=16.06MB mem-reservation=512.00KB thread-reservation=1
-|  |  max-parallelism=1 segment-costs=[146957]
+|  |  max-parallelism=1 segment-costs=[196957]
 |  |  45:SCAN HDFS [tpcds_parquet.date_dim, RANDOM]
 |  |     HDFS partitions=1/1 files=1 size=2.15MB
 |  |     predicates: d_year = CAST(2001 AS INT), d_moy = CAST(11 AS INT)
@@ -1819,7 +1819,7 @@ max-parallelism=12 segment-costs=[749813, 429878, 215944, 13294224, 142772] cpu-
 |  |     parquet statistics predicates: d_year = CAST(2001 AS INT), d_moy = CAST(11 AS INT)
 |  |     parquet dictionary predicates: d_year = CAST(2001 AS INT), d_moy = CAST(11 AS INT)
 |  |     mem-estimate=16.00MB mem-reservation=512.00KB thread-reservation=0
-|  |     tuple-ids=36 row-size=12B cardinality=108 cost=146955
+|  |     tuple-ids=36 row-size=12B cardinality=108 cost=196955
 |  |     in pipelines: 45(GETNEXT)
 |  |
 |  43:SCAN HDFS [tpcds_parquet.catalog_sales, RANDOM]
@@ -1829,8 +1829,8 @@ max-parallelism=12 segment-costs=[749813, 429878, 215944, 13294224, 142772] cpu-
 |       table: rows=1.44M size=96.62MB
 |       columns: all
 |     extrapolated-rows=disabled max-scan-range-rows=650.14K
-|     mem-estimate=48.00MB mem-reservation=4.00MB thread-reservation=0
-|     tuple-ids=34 row-size=20B cardinality=1.44M cost=28156
+|     mem-estimate=16.00MB mem-reservation=4.00MB thread-reservation=0
+|     tuple-ids=34 row-size=20B cardinality=1.44M cost=178156
 |     in pipelines: 43(GETNEXT)
 |
 42:NESTED LOOP JOIN [INNER JOIN, BROADCAST]
@@ -1854,7 +1854,7 @@ max-parallelism=12 segment-costs=[749813, 429878, 215944, 13294224, 142772] cpu-
 |  |
 |  F25:PLAN FRAGMENT [UNPARTITIONED] hosts=1 instances=1
 |  Per-Instance Resources: mem-estimate=96.00KB mem-reservation=0B thread-reservation=1
-|  max-parallelism=1 segment-costs=[2, 1] cpu-comparison-result=12 [max(2 (self) vs 12 (sum children))]
+|  max-parallelism=2 segment-costs=[2, 1] cpu-comparison-result=12 [max(2 (self) vs 12 (sum children))]
 |  156:AGGREGATE [FINALIZE]
 |  |  output: avg:merge(quantity * list_price)
 |  |  mem-estimate=16.00KB mem-reservation=0B spill-buffer=2.00MB thread-reservation=0
@@ -1866,9 +1866,9 @@ max-parallelism=12 segment-costs=[749813, 429878, 215944, 13294224, 142772] cpu-
 |  |  tuple-ids=30 row-size=16B cardinality=1 cost=1
 |  |  in pipelines: 41(GETNEXT)
 |  |
-|  F24:PLAN FRAGMENT [RANDOM] hosts=3 instances=12
-|  Per-Instance Resources: mem-estimate=48.02MB mem-reservation=4.00MB thread-reservation=1
-|  max-parallelism=12 segment-costs=[40389768, 1] cpu-comparison-result=12 [max(12 (self) vs 12 (sum children))]
+|  F24:PLAN FRAGMENT [RANDOM] hosts=3 instances=12 (adjusted from 48)
+|  Per-Instance Resources: mem-estimate=16.02MB mem-reservation=4.00MB thread-reservation=1
+|  max-parallelism=12 segment-costs=[131839765, 1] cpu-comparison-result=12 [max(12 (self) vs 12 (sum children))]
 |  41:AGGREGATE
 |  |  output: avg(CAST(quantity AS DECIMAL(10,0)) * list_price)
 |  |  mem-estimate=16.00KB mem-reservation=0B spill-buffer=2.00MB thread-reservation=0
@@ -1904,7 +1904,7 @@ max-parallelism=12 segment-costs=[749813, 429878, 215944, 13294224, 142772] cpu-
 |  |  |  |
 |  |  |  F23:PLAN FRAGMENT [RANDOM] hosts=1 instances=1
 |  |  |  Per-Instance Resources: mem-estimate=16.05MB mem-reservation=512.00KB thread-reservation=1
-|  |  |  max-parallelism=1 segment-costs=[146755]
+|  |  |  max-parallelism=1 segment-costs=[196755]
 |  |  |  39:SCAN HDFS [tpcds_parquet.date_dim, RANDOM]
 |  |  |     HDFS partitions=1/1 files=1 size=2.15MB
 |  |  |     predicates: d_year <= CAST(2001 AS INT), d_year >= CAST(1999 AS INT)
@@ -1915,7 +1915,7 @@ max-parallelism=12 segment-costs=[749813, 429878, 215944, 13294224, 142772] cpu-
 |  |  |     parquet statistics predicates: d_year <= CAST(2001 AS INT), d_year >= CAST(1999 AS INT)
 |  |  |     parquet dictionary predicates: d_year <= CAST(2001 AS INT), d_year >= CAST(1999 AS INT)
 |  |  |     mem-estimate=16.00MB mem-reservation=512.00KB thread-reservation=0
-|  |  |     tuple-ids=27 row-size=8B cardinality=7.30K cost=146669
+|  |  |     tuple-ids=27 row-size=8B cardinality=7.30K cost=196669
 |  |  |     in pipelines: 39(GETNEXT)
 |  |  |
 |  |  38:SCAN HDFS [tpcds_parquet.web_sales, RANDOM]
@@ -1925,8 +1925,8 @@ max-parallelism=12 segment-costs=[749813, 429878, 215944, 13294224, 142772] cpu-
 |  |       table: rows=719.38K size=45.09MB
 |  |       columns: all
 |  |     extrapolated-rows=disabled max-scan-range-rows=644.77K
-|  |     mem-estimate=32.00MB mem-reservation=4.00MB thread-reservation=0
-|  |     tuple-ids=26 row-size=12B cardinality=719.38K cost=8431
+|  |     mem-estimate=16.00MB mem-reservation=4.00MB thread-reservation=0
+|  |     tuple-ids=26 row-size=12B cardinality=719.38K cost=108431
 |  |     in pipelines: 38(GETNEXT)
 |  |
 |  |--37:HASH JOIN [INNER JOIN, BROADCAST]
@@ -1953,7 +1953,7 @@ max-parallelism=12 segment-costs=[749813, 429878, 215944, 13294224, 142772] cpu-
 |  |  |  |
 |  |  |  F21:PLAN FRAGMENT [RANDOM] hosts=1 instances=1
 |  |  |  Per-Instance Resources: mem-estimate=16.05MB mem-reservation=512.00KB thread-reservation=1
-|  |  |  max-parallelism=1 segment-costs=[146755]
+|  |  |  max-parallelism=1 segment-costs=[196755]
 |  |  |  36:SCAN HDFS [tpcds_parquet.date_dim, RANDOM]
 |  |  |     HDFS partitions=1/1 files=1 size=2.15MB
 |  |  |     predicates: d_year <= CAST(2001 AS INT), d_year >= CAST(1999 AS INT)
@@ -1964,7 +1964,7 @@ max-parallelism=12 segment-costs=[749813, 429878, 215944, 13294224, 142772] cpu-
 |  |  |     parquet statistics predicates: d_year <= CAST(2001 AS INT), d_year >= CAST(1999 AS INT)
 |  |  |     parquet dictionary predicates: d_year <= CAST(2001 AS INT), d_year >= CAST(1999 AS INT)
 |  |  |     mem-estimate=16.00MB mem-reservation=512.00KB thread-reservation=0
-|  |  |     tuple-ids=25 row-size=8B cardinality=7.30K cost=146669
+|  |  |     tuple-ids=25 row-size=8B cardinality=7.30K cost=196669
 |  |  |     in pipelines: 36(GETNEXT)
 |  |  |
 |  |  35:SCAN HDFS [tpcds_parquet.catalog_sales, RANDOM]
@@ -1974,8 +1974,8 @@ max-parallelism=12 segment-costs=[749813, 429878, 215944, 13294224, 142772] cpu-
 |  |       table: rows=1.44M size=96.62MB
 |  |       columns: all
 |  |     extrapolated-rows=disabled max-scan-range-rows=650.14K
-|  |     mem-estimate=48.00MB mem-reservation=4.00MB thread-reservation=0
-|  |     tuple-ids=24 row-size=12B cardinality=1.44M cost=16894
+|  |     mem-estimate=16.00MB mem-reservation=4.00MB thread-reservation=0
+|  |     tuple-ids=24 row-size=12B cardinality=1.44M cost=166894
 |  |     in pipelines: 35(GETNEXT)
 |  |
 |  34:HASH JOIN [INNER JOIN, BROADCAST]
@@ -2001,7 +2001,7 @@ max-parallelism=12 segment-costs=[749813, 429878, 215944, 13294224, 142772] cpu-
 |  |  |
 |  |  F19:PLAN FRAGMENT [RANDOM] hosts=1 instances=1
 |  |  Per-Instance Resources: mem-estimate=16.05MB mem-reservation=512.00KB thread-reservation=1
-|  |  max-parallelism=1 segment-costs=[146755]
+|  |  max-parallelism=1 segment-costs=[196755]
 |  |  33:SCAN HDFS [tpcds_parquet.date_dim, RANDOM]
 |  |     HDFS partitions=1/1 files=1 size=2.15MB
 |  |     predicates: d_year <= CAST(2001 AS INT), d_year >= CAST(1999 AS INT)
@@ -2012,7 +2012,7 @@ max-parallelism=12 segment-costs=[749813, 429878, 215944, 13294224, 142772] cpu-
 |  |     parquet statistics predicates: d_year <= CAST(2001 AS INT), d_year >= CAST(1999 AS INT)
 |  |     parquet dictionary predicates: d_year <= CAST(2001 AS INT), d_year >= CAST(1999 AS INT)
 |  |     mem-estimate=16.00MB mem-reservation=512.00KB thread-reservation=0
-|  |     tuple-ids=23 row-size=8B cardinality=7.30K cost=146669
+|  |     tuple-ids=23 row-size=8B cardinality=7.30K cost=196669
 |  |     in pipelines: 33(GETNEXT)
 |  |
 |  32:SCAN HDFS [tpcds_parquet.store_sales, RANDOM]
@@ -2023,7 +2023,7 @@ max-parallelism=12 segment-costs=[749813, 429878, 215944, 13294224, 142772] cpu-
 |       columns: all
 |     extrapolated-rows=disabled max-scan-range-rows=130.09K
 |     mem-estimate=16.00MB mem-reservation=512.00KB thread-reservation=0
-|     tuple-ids=22 row-size=12B cardinality=2.88M cost=33755
+|     tuple-ids=22 row-size=12B cardinality=2.88M cost=91233752
 |     in pipelines: 32(GETNEXT)
 |
 151:AGGREGATE [FINALIZE]
@@ -2038,10 +2038,10 @@ max-parallelism=12 segment-costs=[749813, 429878, 215944, 13294224, 142772] cpu-
 |  tuple-ids=20 row-size=36B cardinality=148.80K cost=5813
 |  in pipelines: 01(GETNEXT)
 |
-F00:PLAN FRAGMENT [RANDOM] hosts=3 instances=12
+F00:PLAN FRAGMENT [RANDOM] hosts=3 instances=12 (adjusted from 48)
 Per-Host Shared Resources: mem-estimate=3.00MB mem-reservation=3.00MB thread-reservation=0 runtime-filters-memory=3.00MB
 Per-Instance Resources: mem-estimate=27.88MB mem-reservation=3.00MB thread-reservation=1
-max-parallelism=12 segment-costs=[4130519, 5813] cpu-comparison-result=41 [max(12 (self) vs 41 (sum children))]
+max-parallelism=12 segment-costs=[95330517, 5813] cpu-comparison-result=41 [max(12 (self) vs 41 (sum children))]
 30:AGGREGATE [STREAMING]
 |  output: sum(CAST(ss_quantity AS DECIMAL(10,0)) * ss_list_price), count(*)
 |  group by: i_brand_id, i_class_id, i_category_id
@@ -2070,9 +2070,9 @@ max-parallelism=12 segment-costs=[4130519, 5813] cpu-comparison-result=41 [max(1
 |  |  tuple-ids=126 row-size=8B cardinality=17.98K cost=633
 |  |  in pipelines: 148(GETNEXT)
 |  |
-|  F16:PLAN FRAGMENT [HASH(tpcds_parquet.item.i_item_sk)] hosts=3 instances=6 (adjusted from 12)
+|  F16:PLAN FRAGMENT [HASH(tpcds_parquet.item.i_item_sk)] hosts=3 instances=6 (adjusted from 48)
 |  Per-Instance Resources: mem-estimate=10.12MB mem-reservation=1.94MB thread-reservation=1
-|  max-parallelism=3 segment-costs=[18186, 211] cpu-comparison-result=33 [max(6 (self) vs 33 (sum children))]
+|  max-parallelism=6 segment-costs=[18186, 211] cpu-comparison-result=33 [max(6 (self) vs 33 (sum children))]
 |  148:AGGREGATE [FINALIZE]
 |  |  group by: tpcds_parquet.item.i_item_sk
 |  |  mem-estimate=10.00MB mem-reservation=1.94MB spill-buffer=64.00KB thread-reservation=0
@@ -2084,9 +2084,9 @@ max-parallelism=12 segment-costs=[4130519, 5813] cpu-comparison-result=41 [max(1
 |  |  tuple-ids=126 row-size=8B cardinality=17.98K cost=211
 |  |  in pipelines: 135(GETNEXT)
 |  |
-|  F06:PLAN FRAGMENT [HASH(iss.i_brand_id,iss.i_class_id,iss.i_category_id)] hosts=3 instances=6 (adjusted from 12)
+|  F06:PLAN FRAGMENT [HASH(iss.i_brand_id,iss.i_class_id,iss.i_category_id)] hosts=3 instances=6 (adjusted from 48)
 |  Per-Instance Resources: mem-estimate=20.76MB mem-reservation=3.94MB thread-reservation=1
-|  max-parallelism=3 segment-costs=[448725, 1488000, 211] cpu-comparison-result=33 [max(6 (self) vs 33 (sum children))]
+|  max-parallelism=6 segment-costs=[448725, 1488000, 211] cpu-comparison-result=33 [max(6 (self) vs 33 (sum children))]
 |  28:AGGREGATE [STREAMING]
 |  |  group by: tpcds_parquet.item.i_item_sk
 |  |  mem-estimate=10.00MB mem-reservation=2.00MB spill-buffer=64.00KB thread-reservation=0
@@ -2101,7 +2101,7 @@ max-parallelism=12 segment-costs=[4130519, 5813] cpu-comparison-result=41 [max(1
 |  |  tuple-ids=7,3 row-size=32B cardinality=148.80K cost=446400
 |  |  in pipelines: 135(GETNEXT), 04(OPEN)
 |  |
-|  |--F94:PLAN FRAGMENT [HASH(iss.i_brand_id,iss.i_class_id,iss.i_category_id)] hosts=3 instances=6 (adjusted from 12)
+|  |--F94:PLAN FRAGMENT [HASH(iss.i_brand_id,iss.i_class_id,iss.i_category_id)] hosts=3 instances=6 (adjusted from 48)
 |  |  |  Per-Instance Resources: mem-estimate=5.30MB mem-reservation=4.94MB thread-reservation=1 runtime-filters-memory=3.00MB
 |  |  |  max-parallelism=6 segment-costs=[54422]
 |  |  JOIN BUILD
@@ -2117,7 +2117,7 @@ max-parallelism=12 segment-costs=[4130519, 5813] cpu-comparison-result=41 [max(1
 |  |  |
 |  |  F15:PLAN FRAGMENT [RANDOM] hosts=1 instances=1
 |  |  Per-Instance Resources: mem-estimate=16.56MB mem-reservation=256.00KB thread-reservation=1
-|  |  max-parallelism=1 segment-costs=[774]
+|  |  max-parallelism=1 segment-costs=[50774]
 |  |  04:SCAN HDFS [tpcds_parquet.item, RANDOM]
 |  |     HDFS partitions=1/1 files=1 size=1.73MB
 |  |     stored statistics:
@@ -2125,7 +2125,7 @@ max-parallelism=12 segment-costs=[4130519, 5813] cpu-comparison-result=41 [max(1
 |  |       columns: all
 |  |     extrapolated-rows=disabled max-scan-range-rows=18.00K
 |  |     mem-estimate=16.00MB mem-reservation=256.00KB thread-reservation=0
-|  |     tuple-ids=3 row-size=20B cardinality=18.00K cost=352
+|  |     tuple-ids=3 row-size=20B cardinality=18.00K cost=50352
 |  |     in pipelines: 04(GETNEXT)
 |  |
 |  24:HASH JOIN [LEFT SEMI JOIN, PARTITIONED]
@@ -2135,7 +2135,7 @@ max-parallelism=12 segment-costs=[4130519, 5813] cpu-comparison-result=41 [max(1
 |  |  tuple-ids=7 row-size=12B cardinality=148.80K cost=446400
 |  |  in pipelines: 135(GETNEXT), 144(OPEN)
 |  |
-|  |--F95:PLAN FRAGMENT [HASH(iss.i_brand_id,iss.i_class_id,iss.i_category_id)] hosts=3 instances=6 (adjusted from 12)
+|  |--F95:PLAN FRAGMENT [HASH(iss.i_brand_id,iss.i_class_id,iss.i_category_id)] hosts=3 instances=6 (adjusted from 48)
 |  |  |  Per-Instance Resources: mem-estimate=4.85MB mem-reservation=3.94MB thread-reservation=1 runtime-filters-memory=2.00MB
 |  |  |  max-parallelism=6 segment-costs=[448725] cpu-comparison-result=6 [max(6 (self) vs 6 (sum children))]
 |  |  JOIN BUILD
@@ -2151,7 +2151,7 @@ max-parallelism=12 segment-costs=[4130519, 5813] cpu-comparison-result=41 [max(1
 |  |  |
 |  |  F14:PLAN FRAGMENT [HASH(iws.i_brand_id,iws.i_class_id,iws.i_category_id)] hosts=2 instances=4 (adjusted from 2)
 |  |  Per-Instance Resources: mem-estimate=10.88MB mem-reservation=1.94MB thread-reservation=1
-|  |  max-parallelism=2 segment-costs=[448725, 2325] cpu-comparison-result=6 [max(4 (self) vs 6 (sum children))]
+|  |  max-parallelism=4 segment-costs=[448725, 2325] cpu-comparison-result=6 [max(4 (self) vs 6 (sum children))]
 |  |  144:AGGREGATE [FINALIZE]
 |  |  |  group by: iws.i_brand_id, iws.i_class_id, iws.i_category_id
 |  |  |  mem-estimate=10.00MB mem-reservation=1.94MB spill-buffer=64.00KB thread-reservation=0
@@ -2164,8 +2164,8 @@ max-parallelism=12 segment-costs=[4130519, 5813] cpu-comparison-result=41 [max(1
 |  |  |  in pipelines: 16(GETNEXT)
 |  |  |
 |  |  F11:PLAN FRAGMENT [RANDOM] hosts=2 instances=2
-|  |  Per-Instance Resources: mem-estimate=42.25MB mem-reservation=9.00MB thread-reservation=1
-|  |  max-parallelism=2 segment-costs=[3605351, 2325] cpu-comparison-result=6 [max(2 (self) vs 6 (sum children))]
+|  |  Per-Instance Resources: mem-estimate=26.25MB mem-reservation=9.00MB thread-reservation=1
+|  |  max-parallelism=2 segment-costs=[3705351, 2325] cpu-comparison-result=6 [max(2 (self) vs 6 (sum children))]
 |  |  23:AGGREGATE [STREAMING]
 |  |  |  group by: iws.i_brand_id, iws.i_class_id, iws.i_category_id
 |  |  |  mem-estimate=10.00MB mem-reservation=5.00MB spill-buffer=256.00KB thread-reservation=0
@@ -2181,13 +2181,13 @@ max-parallelism=12 segment-costs=[4130519, 5813] cpu-comparison-result=41 [max(1
 |  |  |  in pipelines: 16(GETNEXT), 18(OPEN)
 |  |  |
 |  |  |--F96:PLAN FRAGMENT [RANDOM] hosts=2 instances=2
-|  |  |  |  Per-Instance Resources: mem-estimate=7.82MB mem-reservation=7.75MB thread-reservation=1
+|  |  |  |  Per-Instance Resources: mem-estimate=2.00MB mem-reservation=1.94MB thread-reservation=1
 |  |  |  |  max-parallelism=2 segment-costs=[7477]
 |  |  |  JOIN BUILD
 |  |  |  |  join-table-id=15 plan-id=16 cohort-id=06
 |  |  |  |  build expressions: d3.d_date_sk
 |  |  |  |  runtime filters: RF027[min_max] <- d3.d_date_sk
-|  |  |  |  mem-estimate=7.75MB mem-reservation=7.75MB spill-buffer=64.00KB thread-reservation=0 cost=7305
+|  |  |  |  mem-estimate=1.94MB mem-reservation=1.94MB spill-buffer=64.00KB thread-reservation=0 cost=7305
 |  |  |  |
 |  |  |  142:EXCHANGE [BROADCAST]
 |  |  |  |  mem-estimate=69.07KB mem-reservation=0B thread-reservation=0
@@ -2196,7 +2196,7 @@ max-parallelism=12 segment-costs=[4130519, 5813] cpu-comparison-result=41 [max(1
 |  |  |  |
 |  |  |  F13:PLAN FRAGMENT [RANDOM] hosts=1 instances=1
 |  |  |  Per-Instance Resources: mem-estimate=16.05MB mem-reservation=512.00KB thread-reservation=1
-|  |  |  max-parallelism=1 segment-costs=[146755]
+|  |  |  max-parallelism=1 segment-costs=[196755]
 |  |  |  18:SCAN HDFS [tpcds_parquet.date_dim d3, RANDOM]
 |  |  |     HDFS partitions=1/1 files=1 size=2.15MB
 |  |  |     predicates: d3.d_year <= CAST(2001 AS INT), d3.d_year >= CAST(1999 AS INT)
@@ -2207,7 +2207,7 @@ max-parallelism=12 segment-costs=[4130519, 5813] cpu-comparison-result=41 [max(1
 |  |  |     parquet statistics predicates: d3.d_year <= CAST(2001 AS INT), d3.d_year >= CAST(1999 AS INT)
 |  |  |     parquet dictionary predicates: d3.d_year <= CAST(2001 AS INT), d3.d_year >= CAST(1999 AS INT)
 |  |  |     mem-estimate=16.00MB mem-reservation=512.00KB thread-reservation=0
-|  |  |     tuple-ids=15 row-size=8B cardinality=7.30K cost=146669
+|  |  |     tuple-ids=15 row-size=8B cardinality=7.30K cost=196669
 |  |  |     in pipelines: 18(GETNEXT)
 |  |  |
 |  |  19:HASH JOIN [INNER JOIN, BROADCAST]
@@ -2219,13 +2219,13 @@ max-parallelism=12 segment-costs=[4130519, 5813] cpu-comparison-result=41 [max(1
 |  |  |  in pipelines: 16(GETNEXT), 17(OPEN)
 |  |  |
 |  |  |--F97:PLAN FRAGMENT [RANDOM] hosts=2 instances=2
-|  |  |  |  Per-Instance Resources: mem-estimate=8.12MB mem-reservation=7.75MB thread-reservation=1
+|  |  |  |  Per-Instance Resources: mem-estimate=2.30MB mem-reservation=1.94MB thread-reservation=1
 |  |  |  |  max-parallelism=2 segment-costs=[18844]
 |  |  |  JOIN BUILD
 |  |  |  |  join-table-id=16 plan-id=17 cohort-id=06
 |  |  |  |  build expressions: iws.i_item_sk
 |  |  |  |  runtime filters: RF029[min_max] <- iws.i_item_sk
-|  |  |  |  mem-estimate=7.75MB mem-reservation=7.75MB spill-buffer=64.00KB thread-reservation=0 cost=18000
+|  |  |  |  mem-estimate=1.94MB mem-reservation=1.94MB spill-buffer=64.00KB thread-reservation=0 cost=18000
 |  |  |  |
 |  |  |  141:EXCHANGE [BROADCAST]
 |  |  |  |  mem-estimate=375.56KB mem-reservation=0B thread-reservation=0
@@ -2234,7 +2234,7 @@ max-parallelism=12 segment-costs=[4130519, 5813] cpu-comparison-result=41 [max(1
 |  |  |  |
 |  |  |  F12:PLAN FRAGMENT [RANDOM] hosts=1 instances=1
 |  |  |  Per-Instance Resources: mem-estimate=16.09MB mem-reservation=256.00KB thread-reservation=1
-|  |  |  max-parallelism=1 segment-costs=[774]
+|  |  |  max-parallelism=1 segment-costs=[50774]
 |  |  |  17:SCAN HDFS [tpcds_parquet.item iws, RANDOM]
 |  |  |     HDFS partitions=1/1 files=1 size=1.73MB
 |  |  |     stored statistics:
@@ -2242,7 +2242,7 @@ max-parallelism=12 segment-costs=[4130519, 5813] cpu-comparison-result=41 [max(1
 |  |  |       columns: all
 |  |  |     extrapolated-rows=disabled max-scan-range-rows=18.00K
 |  |  |     mem-estimate=16.00MB mem-reservation=256.00KB thread-reservation=0
-|  |  |     tuple-ids=14 row-size=20B cardinality=18.00K cost=352
+|  |  |     tuple-ids=14 row-size=20B cardinality=18.00K cost=50352
 |  |  |     in pipelines: 17(GETNEXT)
 |  |  |
 |  |  16:SCAN HDFS [tpcds_parquet.web_sales, RANDOM]
@@ -2252,8 +2252,8 @@ max-parallelism=12 segment-costs=[4130519, 5813] cpu-comparison-result=41 [max(1
 |  |       table: rows=719.38K size=45.09MB
 |  |       columns: all
 |  |     extrapolated-rows=disabled max-scan-range-rows=644.77K
-|  |     mem-estimate=32.00MB mem-reservation=4.00MB thread-reservation=0
-|  |     tuple-ids=13 row-size=12B cardinality=719.38K cost=8431
+|  |     mem-estimate=16.00MB mem-reservation=4.00MB thread-reservation=0
+|  |     tuple-ids=13 row-size=12B cardinality=719.38K cost=108431
 |  |     in pipelines: 16(GETNEXT)
 |  |
 |  22:HASH JOIN [LEFT SEMI JOIN, PARTITIONED]
@@ -2263,7 +2263,7 @@ max-parallelism=12 segment-costs=[4130519, 5813] cpu-comparison-result=41 [max(1
 |  |  tuple-ids=7 row-size=12B cardinality=148.80K cost=446400
 |  |  in pipelines: 135(GETNEXT), 139(OPEN)
 |  |
-|  |--F98:PLAN FRAGMENT [HASH(iss.i_brand_id,iss.i_class_id,iss.i_category_id)] hosts=3 instances=6 (adjusted from 12)
+|  |--F98:PLAN FRAGMENT [HASH(iss.i_brand_id,iss.i_class_id,iss.i_category_id)] hosts=3 instances=6 (adjusted from 48)
 |  |  |  Per-Instance Resources: mem-estimate=2.60MB mem-reservation=1.94MB thread-reservation=1
 |  |  |  max-parallelism=6 segment-costs=[448725] cpu-comparison-result=8 [max(6 (self) vs 8 (sum children))]
 |  |  JOIN BUILD
@@ -2278,7 +2278,7 @@ max-parallelism=12 segment-costs=[4130519, 5813] cpu-comparison-result=41 [max(1
 |  |  |
 |  |  F10:PLAN FRAGMENT [HASH(ics.i_brand_id,ics.i_class_id,ics.i_category_id)] hosts=3 instances=6 (adjusted from 3)
 |  |  Per-Instance Resources: mem-estimate=10.61MB mem-reservation=1.94MB thread-reservation=1
-|  |  max-parallelism=3 segment-costs=[448725, 2325] cpu-comparison-result=8 [max(6 (self) vs 8 (sum children))]
+|  |  max-parallelism=6 segment-costs=[448725, 2325] cpu-comparison-result=8 [max(6 (self) vs 8 (sum children))]
 |  |  139:AGGREGATE [FINALIZE]
 |  |  |  group by: ics.i_brand_id, ics.i_class_id, ics.i_category_id
 |  |  |  mem-estimate=10.00MB mem-reservation=1.94MB spill-buffer=64.00KB thread-reservation=0
@@ -2291,8 +2291,8 @@ max-parallelism=12 segment-costs=[4130519, 5813] cpu-comparison-result=41 [max(1
 |  |  |  in pipelines: 11(GETNEXT)
 |  |  |
 |  |  F07:PLAN FRAGMENT [RANDOM] hosts=3 instances=3
-|  |  Per-Instance Resources: mem-estimate=58.38MB mem-reservation=9.00MB thread-reservation=1
-|  |  max-parallelism=3 segment-costs=[7224634, 2325] cpu-comparison-result=8 [max(3 (self) vs 8 (sum children))]
+|  |  Per-Instance Resources: mem-estimate=26.38MB mem-reservation=9.00MB thread-reservation=1
+|  |  max-parallelism=3 segment-costs=[7374634, 2325] cpu-comparison-result=8 [max(3 (self) vs 8 (sum children))]
 |  |  21:AGGREGATE [STREAMING]
 |  |  |  group by: ics.i_brand_id, ics.i_class_id, ics.i_category_id
 |  |  |  mem-estimate=10.00MB mem-reservation=5.00MB spill-buffer=256.00KB thread-reservation=0
@@ -2308,13 +2308,13 @@ max-parallelism=12 segment-costs=[4130519, 5813] cpu-comparison-result=41 [max(1
 |  |  |  in pipelines: 11(GETNEXT), 13(OPEN)
 |  |  |
 |  |  |--F99:PLAN FRAGMENT [RANDOM] hosts=3 instances=3
-|  |  |  |  Per-Instance Resources: mem-estimate=7.82MB mem-reservation=7.75MB thread-reservation=1
+|  |  |  |  Per-Instance Resources: mem-estimate=2.00MB mem-reservation=1.94MB thread-reservation=1
 |  |  |  |  max-parallelism=3 segment-costs=[7563]
 |  |  |  JOIN BUILD
 |  |  |  |  join-table-id=18 plan-id=19 cohort-id=07
 |  |  |  |  build expressions: d2.d_date_sk
 |  |  |  |  runtime filters: RF023[min_max] <- d2.d_date_sk
-|  |  |  |  mem-estimate=7.75MB mem-reservation=7.75MB spill-buffer=64.00KB thread-reservation=0 cost=7305
+|  |  |  |  mem-estimate=1.94MB mem-reservation=1.94MB spill-buffer=64.00KB thread-reservation=0 cost=7305
 |  |  |  |
 |  |  |  137:EXCHANGE [BROADCAST]
 |  |  |  |  mem-estimate=69.07KB mem-reservation=0B thread-reservation=0
@@ -2323,7 +2323,7 @@ max-parallelism=12 segment-costs=[4130519, 5813] cpu-comparison-result=41 [max(1
 |  |  |  |
 |  |  |  F09:PLAN FRAGMENT [RANDOM] hosts=1 instances=1
 |  |  |  Per-Instance Resources: mem-estimate=16.05MB mem-reservation=512.00KB thread-reservation=1
-|  |  |  max-parallelism=1 segment-costs=[146755]
+|  |  |  max-parallelism=1 segment-costs=[196755]
 |  |  |  13:SCAN HDFS [tpcds_parquet.date_dim d2, RANDOM]
 |  |  |     HDFS partitions=1/1 files=1 size=2.15MB
 |  |  |     predicates: d2.d_year <= CAST(2001 AS INT), d2.d_year >= CAST(1999 AS INT)
@@ -2334,7 +2334,7 @@ max-parallelism=12 segment-costs=[4130519, 5813] cpu-comparison-result=41 [max(1
 |  |  |     parquet statistics predicates: d2.d_year <= CAST(2001 AS INT), d2.d_year >= CAST(1999 AS INT)
 |  |  |     parquet dictionary predicates: d2.d_year <= CAST(2001 AS INT), d2.d_year >= CAST(1999 AS INT)
 |  |  |     mem-estimate=16.00MB mem-reservation=512.00KB thread-reservation=0
-|  |  |     tuple-ids=11 row-size=8B cardinality=7.30K cost=146669
+|  |  |     tuple-ids=11 row-size=8B cardinality=7.30K cost=196669
 |  |  |     in pipelines: 13(GETNEXT)
 |  |  |
 |  |  14:HASH JOIN [INNER JOIN, BROADCAST]
@@ -2346,13 +2346,13 @@ max-parallelism=12 segment-costs=[4130519, 5813] cpu-comparison-result=41 [max(1
 |  |  |  in pipelines: 11(GETNEXT), 12(OPEN)
 |  |  |
 |  |  |--F100:PLAN FRAGMENT [RANDOM] hosts=3 instances=3
-|  |  |  |  Per-Instance Resources: mem-estimate=8.12MB mem-reservation=7.75MB thread-reservation=1
+|  |  |  |  Per-Instance Resources: mem-estimate=2.30MB mem-reservation=1.94MB thread-reservation=1
 |  |  |  |  max-parallelism=3 segment-costs=[19266]
 |  |  |  JOIN BUILD
 |  |  |  |  join-table-id=19 plan-id=20 cohort-id=07
 |  |  |  |  build expressions: ics.i_item_sk
 |  |  |  |  runtime filters: RF025[min_max] <- ics.i_item_sk
-|  |  |  |  mem-estimate=7.75MB mem-reservation=7.75MB spill-buffer=64.00KB thread-reservation=0 cost=18000
+|  |  |  |  mem-estimate=1.94MB mem-reservation=1.94MB spill-buffer=64.00KB thread-reservation=0 cost=18000
 |  |  |  |
 |  |  |  136:EXCHANGE [BROADCAST]
 |  |  |  |  mem-estimate=375.56KB mem-reservation=0B thread-reservation=0
@@ -2361,7 +2361,7 @@ max-parallelism=12 segment-costs=[4130519, 5813] cpu-comparison-result=41 [max(1
 |  |  |  |
 |  |  |  F08:PLAN FRAGMENT [RANDOM] hosts=1 instances=1
 |  |  |  Per-Instance Resources: mem-estimate=16.09MB mem-reservation=256.00KB thread-reservation=1
-|  |  |  max-parallelism=1 segment-costs=[774]
+|  |  |  max-parallelism=1 segment-costs=[50774]
 |  |  |  12:SCAN HDFS [tpcds_parquet.item ics, RANDOM]
 |  |  |     HDFS partitions=1/1 files=1 size=1.73MB
 |  |  |     stored statistics:
@@ -2369,7 +2369,7 @@ max-parallelism=12 segment-costs=[4130519, 5813] cpu-comparison-result=41 [max(1
 |  |  |       columns: all
 |  |  |     extrapolated-rows=disabled max-scan-range-rows=18.00K
 |  |  |     mem-estimate=16.00MB mem-reservation=256.00KB thread-reservation=0
-|  |  |     tuple-ids=10 row-size=20B cardinality=18.00K cost=352
+|  |  |     tuple-ids=10 row-size=20B cardinality=18.00K cost=50352
 |  |  |     in pipelines: 12(GETNEXT)
 |  |  |
 |  |  11:SCAN HDFS [tpcds_parquet.catalog_sales, RANDOM]
@@ -2379,8 +2379,8 @@ max-parallelism=12 segment-costs=[4130519, 5813] cpu-comparison-result=41 [max(1
 |  |       table: rows=1.44M size=96.62MB
 |  |       columns: all
 |  |     extrapolated-rows=disabled max-scan-range-rows=650.14K
-|  |     mem-estimate=48.00MB mem-reservation=4.00MB thread-reservation=0
-|  |     tuple-ids=9 row-size=12B cardinality=1.44M cost=16894
+|  |     mem-estimate=16.00MB mem-reservation=4.00MB thread-reservation=0
+|  |     tuple-ids=9 row-size=12B cardinality=1.44M cost=166894
 |  |     in pipelines: 11(GETNEXT)
 |  |
 |  135:AGGREGATE [FINALIZE]
@@ -2394,9 +2394,9 @@ max-parallelism=12 segment-costs=[4130519, 5813] cpu-comparison-result=41 [max(1
 |  |  tuple-ids=7 row-size=12B cardinality=148.80K cost=2325
 |  |  in pipelines: 05(GETNEXT)
 |  |
-|  F03:PLAN FRAGMENT [RANDOM] hosts=3 instances=12
+|  F03:PLAN FRAGMENT [RANDOM] hosts=3 instances=12 (adjusted from 48)
 |  Per-Instance Resources: mem-estimate=26.38MB mem-reservation=5.50MB thread-reservation=1
-|  max-parallelism=12 segment-costs=[14435775, 2325] cpu-comparison-result=12 [max(12 (self) vs 8 (sum children))]
+|  max-parallelism=12 segment-costs=[105635772, 2325] cpu-comparison-result=12 [max(12 (self) vs 8 (sum children))]
 |  10:AGGREGATE [STREAMING]
 |  |  group by: iss.i_brand_id, iss.i_class_id, iss.i_category_id
 |  |  mem-estimate=10.00MB mem-reservation=5.00MB spill-buffer=256.00KB thread-reservation=0
@@ -2426,7 +2426,7 @@ max-parallelism=12 segment-costs=[4130519, 5813] cpu-comparison-result=41 [max(1
 |  |  |
 |  |  F05:PLAN FRAGMENT [RANDOM] hosts=1 instances=1
 |  |  Per-Instance Resources: mem-estimate=16.05MB mem-reservation=512.00KB thread-reservation=1
-|  |  max-parallelism=1 segment-costs=[146755]
+|  |  max-parallelism=1 segment-costs=[196755]
 |  |  07:SCAN HDFS [tpcds_parquet.date_dim d1, RANDOM]
 |  |     HDFS partitions=1/1 files=1 size=2.15MB
 |  |     predicates: d1.d_year <= CAST(2001 AS INT), d1.d_year >= CAST(1999 AS INT)
@@ -2437,7 +2437,7 @@ max-parallelism=12 segment-costs=[4130519, 5813] cpu-comparison-result=41 [max(1
 |  |     parquet statistics predicates: d1.d_year <= CAST(2001 AS INT), d1.d_year >= CAST(1999 AS INT)
 |  |     parquet dictionary predicates: d1.d_year <= CAST(2001 AS INT), d1.d_year >= CAST(1999 AS INT)
 |  |     mem-estimate=16.00MB mem-reservation=512.00KB thread-reservation=0
-|  |     tuple-ids=6 row-size=8B cardinality=7.30K cost=146669
+|  |     tuple-ids=6 row-size=8B cardinality=7.30K cost=196669
 |  |     in pipelines: 07(GETNEXT)
 |  |
 |  08:HASH JOIN [INNER JOIN, BROADCAST]
@@ -2465,7 +2465,7 @@ max-parallelism=12 segment-costs=[4130519, 5813] cpu-comparison-result=41 [max(1
 |  |  F04:PLAN FRAGMENT [RANDOM] hosts=1 instances=1
 |  |  Per-Host Shared Resources: mem-estimate=5.00MB mem-reservation=5.00MB thread-reservation=0 runtime-filters-memory=5.00MB
 |  |  Per-Instance Resources: mem-estimate=16.09MB mem-reservation=256.00KB thread-reservation=1
-|  |  max-parallelism=1 segment-costs=[774]
+|  |  max-parallelism=1 segment-costs=[50774]
 |  |  06:SCAN HDFS [tpcds_parquet.item iss, RANDOM]
 |  |     HDFS partitions=1/1 files=1 size=1.73MB
 |  |     runtime filters: RF009[min_max] -> iss.i_brand_id, RF010[min_max] -> iss.i_category_id, RF011[min_max] -> iss.i_class_id, RF006[bloom] -> iss.i_brand_id, RF007[bloom] -> iss.i_category_id, RF008[bloom] -> iss.i_class_id, RF012[bloom] -> iss.i_brand_id, RF013[bloom] -> iss.i_category_id
@@ -2474,7 +2474,7 @@ max-parallelism=12 segment-costs=[4130519, 5813] cpu-comparison-result=41 [max(1
 |  |       columns: all
 |  |     extrapolated-rows=disabled max-scan-range-rows=18.00K
 |  |     mem-estimate=16.00MB mem-reservation=256.00KB thread-reservation=0
-|  |     tuple-ids=5 row-size=20B cardinality=18.00K cost=352
+|  |     tuple-ids=5 row-size=20B cardinality=18.00K cost=50352
 |  |     in pipelines: 06(GETNEXT)
 |  |
 |  05:SCAN HDFS [tpcds_parquet.store_sales, RANDOM]
@@ -2486,7 +2486,7 @@ max-parallelism=12 segment-costs=[4130519, 5813] cpu-comparison-result=41 [max(1
 |       columns: all
 |     extrapolated-rows=disabled max-scan-range-rows=130.09K
 |     mem-estimate=16.00MB mem-reservation=512.00KB thread-reservation=0
-|     tuple-ids=4 row-size=12B cardinality=2.88M cost=33755
+|     tuple-ids=4 row-size=12B cardinality=2.88M cost=91233752
 |     in pipelines: 05(GETNEXT)
 |
 27:HASH JOIN [INNER JOIN, BROADCAST]
@@ -2514,7 +2514,7 @@ max-parallelism=12 segment-costs=[4130519, 5813] cpu-comparison-result=41 [max(1
 |  F02:PLAN FRAGMENT [RANDOM] hosts=1 instances=1
 |  Per-Host Shared Resources: mem-estimate=1.00MB mem-reservation=1.00MB thread-reservation=0 runtime-filters-memory=1.00MB
 |  Per-Instance Resources: mem-estimate=16.09MB mem-reservation=256.00KB thread-reservation=1
-|  max-parallelism=1 segment-costs=[774]
+|  max-parallelism=1 segment-costs=[50774]
 |  02:SCAN HDFS [tpcds_parquet.item, RANDOM]
 |     HDFS partitions=1/1 files=1 size=1.73MB
 |     runtime filters: RF001[min_max] -> tpcds_parquet.item.i_item_sk, RF000[bloom] -> tpcds_parquet.item.i_item_sk
@@ -2523,7 +2523,7 @@ max-parallelism=12 segment-costs=[4130519, 5813] cpu-comparison-result=41 [max(1
 |       columns: all
 |     extrapolated-rows=disabled max-scan-range-rows=18.00K
 |     mem-estimate=16.00MB mem-reservation=256.00KB thread-reservation=0
-|     tuple-ids=1 row-size=20B cardinality=18.00K cost=352
+|     tuple-ids=1 row-size=20B cardinality=18.00K cost=50352
 |     in pipelines: 02(GETNEXT)
 |
 26:HASH JOIN [INNER JOIN, BROADCAST]
@@ -2550,7 +2550,7 @@ max-parallelism=12 segment-costs=[4130519, 5813] cpu-comparison-result=41 [max(1
 |  |
 |  F01:PLAN FRAGMENT [RANDOM] hosts=1 instances=1
 |  Per-Instance Resources: mem-estimate=16.06MB mem-reservation=512.00KB thread-reservation=1
-|  max-parallelism=1 segment-costs=[146957]
+|  max-parallelism=1 segment-costs=[196957]
 |  03:SCAN HDFS [tpcds_parquet.date_dim, RANDOM]
 |     HDFS partitions=1/1 files=1 size=2.15MB
 |     predicates: d_year = CAST(2001 AS INT), d_moy = CAST(11 AS INT)
@@ -2561,7 +2561,7 @@ max-parallelism=12 segment-costs=[4130519, 5813] cpu-comparison-result=41 [max(1
 |     parquet statistics predicates: d_year = CAST(2001 AS INT), d_moy = CAST(11 AS INT)
 |     parquet dictionary predicates: d_year = CAST(2001 AS INT), d_moy = CAST(11 AS INT)
 |     mem-estimate=16.00MB mem-reservation=512.00KB thread-reservation=0
-|     tuple-ids=2 row-size=12B cardinality=108 cost=146955
+|     tuple-ids=2 row-size=12B cardinality=108 cost=196955
 |     in pipelines: 03(GETNEXT)
 |
 01:SCAN HDFS [tpcds_parquet.store_sales, RANDOM]
@@ -2573,7 +2573,7 @@ max-parallelism=12 segment-costs=[4130519, 5813] cpu-comparison-result=41 [max(1
      columns: all
    extrapolated-rows=disabled max-scan-range-rows=130.09K
    mem-estimate=16.00MB mem-reservation=1.00MB thread-reservation=0
-   tuple-ids=0 row-size=20B cardinality=2.88M cost=56258
+   tuple-ids=0 row-size=20B cardinality=2.88M cost=91256256
    in pipelines: 01(GETNEXT)
 ====
 # TPCDS-Q14b second of two queries
@@ -2707,8 +2707,8 @@ ORDER BY this_year.channel,
          this_year.i_category_id
 LIMIT 100
 ---- PARALLELPLANS
-Max Per-Host Resource Reservation: Memory=474.38MB Threads=119
-Per-Host Resource Estimates: Memory=1.93GB
+Max Per-Host Resource Reservation: Memory=427.88MB Threads=119
+Per-Host Resource Estimates: Memory=1.54GB
 F56:PLAN FRAGMENT [UNPARTITIONED] hosts=1 instances=1
 |  Per-Instance Resources: mem-estimate=4.02MB mem-reservation=4.00MB thread-reservation=1
 |  max-parallelism=1 segment-costs=[61] cpu-comparison-result=112 [max(1 (self) vs 112 (sum children))]
@@ -2723,9 +2723,9 @@ PLAN-ROOT SINK
 |  tuple-ids=74 row-size=96B cardinality=5 cost=1
 |  in pipelines: 91(GETNEXT)
 |
-F19:PLAN FRAGMENT [HASH(i_brand_id,i_class_id,i_category_id)] hosts=3 instances=6 (adjusted from 12)
+F19:PLAN FRAGMENT [HASH(i_brand_id,i_class_id,i_category_id)] hosts=3 instances=6 (adjusted from 48)
 Per-Instance Resources: mem-estimate=10.13MB mem-reservation=1.94MB thread-reservation=1
-max-parallelism=3 segment-costs=[1366, 833, 1] cpu-comparison-result=112 [max(6 (self) vs 112 (sum children))]
+max-parallelism=6 segment-costs=[1366, 833, 1] cpu-comparison-result=112 [max(6 (self) vs 112 (sum children))]
 91:TOP-N [LIMIT=100]
 |  order by: channel ASC, i_brand_id ASC, i_class_id ASC, i_category_id ASC
 |  mem-estimate=480B mem-reservation=0B thread-reservation=0
@@ -2740,7 +2740,7 @@ max-parallelism=3 segment-costs=[1366, 833, 1] cpu-comparison-result=112 [max(6
 |  tuple-ids=22,33,59,70 row-size=104B cardinality=5 cost=813
 |  in pipelines: 115(GETNEXT), 145(OPEN)
 |
-|--F57:PLAN FRAGMENT [HASH(i_brand_id,i_class_id,i_category_id)] hosts=3 instances=6 (adjusted from 12)
+|--F57:PLAN FRAGMENT [HASH(i_brand_id,i_class_id,i_category_id)] hosts=3 instances=6 (adjusted from 48)
 |  |  Per-Instance Resources: mem-estimate=14.94MB mem-reservation=6.88MB thread-reservation=1 runtime-filters-memory=3.00MB
 |  |  max-parallelism=6 segment-costs=[1366, 813] cpu-comparison-result=56 [max(6 (self) vs 56 (sum children))]
 |  JOIN BUILD
@@ -2770,7 +2770,7 @@ max-parallelism=3 segment-costs=[1366, 833, 1] cpu-comparison-result=112 [max(6
 |  |  |
 |  |  F55:PLAN FRAGMENT [UNPARTITIONED] hosts=1 instances=1
 |  |  Per-Instance Resources: mem-estimate=96.00KB mem-reservation=0B thread-reservation=1
-|  |  max-parallelism=1 segment-costs=[2, 1] cpu-comparison-result=12 [max(2 (self) vs 12 (sum children))]
+|  |  max-parallelism=2 segment-costs=[2, 1] cpu-comparison-result=12 [max(2 (self) vs 12 (sum children))]
 |  |  150:AGGREGATE [FINALIZE]
 |  |  |  output: avg:merge(quantity * list_price)
 |  |  |  mem-estimate=16.00KB mem-reservation=0B spill-buffer=2.00MB thread-reservation=0
@@ -2782,9 +2782,9 @@ max-parallelism=3 segment-costs=[1366, 833, 1] cpu-comparison-result=112 [max(6
 |  |  |  tuple-ids=69 row-size=16B cardinality=1 cost=1
 |  |  |  in pipelines: 88(GETNEXT)
 |  |  |
-|  |  F54:PLAN FRAGMENT [RANDOM] hosts=3 instances=12
-|  |  Per-Instance Resources: mem-estimate=48.02MB mem-reservation=4.00MB thread-reservation=1
-|  |  max-parallelism=12 segment-costs=[40389768, 1] cpu-comparison-result=12 [max(12 (self) vs 12 (sum children))]
+|  |  F54:PLAN FRAGMENT [RANDOM] hosts=3 instances=12 (adjusted from 48)
+|  |  Per-Instance Resources: mem-estimate=16.02MB mem-reservation=4.00MB thread-reservation=1
+|  |  max-parallelism=12 segment-costs=[131839765, 1] cpu-comparison-result=12 [max(12 (self) vs 12 (sum children))]
 |  |  88:AGGREGATE
 |  |  |  output: avg(CAST(quantity AS DECIMAL(10,0)) * list_price)
 |  |  |  mem-estimate=16.00KB mem-reservation=0B spill-buffer=2.00MB thread-reservation=0
@@ -2820,7 +2820,7 @@ max-parallelism=3 segment-costs=[1366, 833, 1] cpu-comparison-result=112 [max(6
 |  |  |  |  |
 |  |  |  |  F53:PLAN FRAGMENT [RANDOM] hosts=1 instances=1
 |  |  |  |  Per-Instance Resources: mem-estimate=16.05MB mem-reservation=512.00KB thread-reservation=1
-|  |  |  |  max-parallelism=1 segment-costs=[146755]
+|  |  |  |  max-parallelism=1 segment-costs=[196755]
 |  |  |  |  86:SCAN HDFS [tpcds_parquet.date_dim, RANDOM]
 |  |  |  |     HDFS partitions=1/1 files=1 size=2.15MB
 |  |  |  |     predicates: d_year <= CAST(2001 AS INT), d_year >= CAST(1999 AS INT)
@@ -2831,7 +2831,7 @@ max-parallelism=3 segment-costs=[1366, 833, 1] cpu-comparison-result=112 [max(6
 |  |  |  |     parquet statistics predicates: d_year <= CAST(2001 AS INT), d_year >= CAST(1999 AS INT)
 |  |  |  |     parquet dictionary predicates: d_year <= CAST(2001 AS INT), d_year >= CAST(1999 AS INT)
 |  |  |  |     mem-estimate=16.00MB mem-reservation=512.00KB thread-reservation=0
-|  |  |  |     tuple-ids=66 row-size=8B cardinality=7.30K cost=146669
+|  |  |  |     tuple-ids=66 row-size=8B cardinality=7.30K cost=196669
 |  |  |  |     in pipelines: 86(GETNEXT)
 |  |  |  |
 |  |  |  85:SCAN HDFS [tpcds_parquet.web_sales, RANDOM]
@@ -2841,8 +2841,8 @@ max-parallelism=3 segment-costs=[1366, 833, 1] cpu-comparison-result=112 [max(6
 |  |  |       table: rows=719.38K size=45.09MB
 |  |  |       columns: all
 |  |  |     extrapolated-rows=disabled max-scan-range-rows=644.77K
-|  |  |     mem-estimate=32.00MB mem-reservation=4.00MB thread-reservation=0
-|  |  |     tuple-ids=65 row-size=12B cardinality=719.38K cost=8431
+|  |  |     mem-estimate=16.00MB mem-reservation=4.00MB thread-reservation=0
+|  |  |     tuple-ids=65 row-size=12B cardinality=719.38K cost=108431
 |  |  |     in pipelines: 85(GETNEXT)
 |  |  |
 |  |  |--84:HASH JOIN [INNER JOIN, BROADCAST]
@@ -2869,7 +2869,7 @@ max-parallelism=3 segment-costs=[1366, 833, 1] cpu-comparison-result=112 [max(6
 |  |  |  |  |
 |  |  |  |  F51:PLAN FRAGMENT [RANDOM] hosts=1 instances=1
 |  |  |  |  Per-Instance Resources: mem-estimate=16.05MB mem-reservation=512.00KB thread-reservation=1
-|  |  |  |  max-parallelism=1 segment-costs=[146755]
+|  |  |  |  max-parallelism=1 segment-costs=[196755]
 |  |  |  |  83:SCAN HDFS [tpcds_parquet.date_dim, RANDOM]
 |  |  |  |     HDFS partitions=1/1 files=1 size=2.15MB
 |  |  |  |     predicates: d_year <= CAST(2001 AS INT), d_year >= CAST(1999 AS INT)
@@ -2880,7 +2880,7 @@ max-parallelism=3 segment-costs=[1366, 833, 1] cpu-comparison-result=112 [max(6
 |  |  |  |     parquet statistics predicates: d_year <= CAST(2001 AS INT), d_year >= CAST(1999 AS INT)
 |  |  |  |     parquet dictionary predicates: d_year <= CAST(2001 AS INT), d_year >= CAST(1999 AS INT)
 |  |  |  |     mem-estimate=16.00MB mem-reservation=512.00KB thread-reservation=0
-|  |  |  |     tuple-ids=64 row-size=8B cardinality=7.30K cost=146669
+|  |  |  |     tuple-ids=64 row-size=8B cardinality=7.30K cost=196669
 |  |  |  |     in pipelines: 83(GETNEXT)
 |  |  |  |
 |  |  |  82:SCAN HDFS [tpcds_parquet.catalog_sales, RANDOM]
@@ -2890,8 +2890,8 @@ max-parallelism=3 segment-costs=[1366, 833, 1] cpu-comparison-result=112 [max(6
 |  |  |       table: rows=1.44M size=96.62MB
 |  |  |       columns: all
 |  |  |     extrapolated-rows=disabled max-scan-range-rows=650.14K
-|  |  |     mem-estimate=48.00MB mem-reservation=4.00MB thread-reservation=0
-|  |  |     tuple-ids=63 row-size=12B cardinality=1.44M cost=16894
+|  |  |     mem-estimate=16.00MB mem-reservation=4.00MB thread-reservation=0
+|  |  |     tuple-ids=63 row-size=12B cardinality=1.44M cost=166894
 |  |  |     in pipelines: 82(GETNEXT)
 |  |  |
 |  |  81:HASH JOIN [INNER JOIN, BROADCAST]
@@ -2917,7 +2917,7 @@ max-parallelism=3 segment-costs=[1366, 833, 1] cpu-comparison-result=112 [max(6
 |  |  |  |
 |  |  |  F49:PLAN FRAGMENT [RANDOM] hosts=1 instances=1
 |  |  |  Per-Instance Resources: mem-estimate=16.05MB mem-reservation=512.00KB thread-reservation=1
-|  |  |  max-parallelism=1 segment-costs=[146755]
+|  |  |  max-parallelism=1 segment-costs=[196755]
 |  |  |  80:SCAN HDFS [tpcds_parquet.date_dim, RANDOM]
 |  |  |     HDFS partitions=1/1 files=1 size=2.15MB
 |  |  |     predicates: d_year <= CAST(2001 AS INT), d_year >= CAST(1999 AS INT)
@@ -2928,7 +2928,7 @@ max-parallelism=3 segment-costs=[1366, 833, 1] cpu-comparison-result=112 [max(6
 |  |  |     parquet statistics predicates: d_year <= CAST(2001 AS INT), d_year >= CAST(1999 AS INT)
 |  |  |     parquet dictionary predicates: d_year <= CAST(2001 AS INT), d_year >= CAST(1999 AS INT)
 |  |  |     mem-estimate=16.00MB mem-reservation=512.00KB thread-reservation=0
-|  |  |     tuple-ids=62 row-size=8B cardinality=7.30K cost=146669
+|  |  |     tuple-ids=62 row-size=8B cardinality=7.30K cost=196669
 |  |  |     in pipelines: 80(GETNEXT)
 |  |  |
 |  |  79:SCAN HDFS [tpcds_parquet.store_sales, RANDOM]
@@ -2939,7 +2939,7 @@ max-parallelism=3 segment-costs=[1366, 833, 1] cpu-comparison-result=112 [max(6
 |  |       columns: all
 |  |     extrapolated-rows=disabled max-scan-range-rows=130.09K
 |  |     mem-estimate=16.00MB mem-reservation=512.00KB thread-reservation=0
-|  |     tuple-ids=61 row-size=12B cardinality=2.88M cost=33755
+|  |     tuple-ids=61 row-size=12B cardinality=2.88M cost=91233752
 |  |     in pipelines: 79(GETNEXT)
 |  |
 |  145:AGGREGATE [FINALIZE]
@@ -2954,9 +2954,9 @@ max-parallelism=3 segment-costs=[1366, 833, 1] cpu-comparison-result=112 [max(6
 |  |  tuple-ids=59 row-size=36B cardinality=271 cost=11
 |  |  in pipelines: 45(GETNEXT)
 |  |
-|  F28:PLAN FRAGMENT [RANDOM] hosts=3 instances=12
+|  F28:PLAN FRAGMENT [RANDOM] hosts=3 instances=12 (adjusted from 48)
 |  Per-Instance Resources: mem-estimate=26.94MB mem-reservation=3.00MB thread-reservation=1
-|  max-parallelism=12 segment-costs=[11579229, 11] cpu-comparison-result=44 [max(12 (self) vs 44 (sum children))]
+|  max-parallelism=12 segment-costs=[102779227, 11] cpu-comparison-result=44 [max(12 (self) vs 44 (sum children))]
 |  77:AGGREGATE [STREAMING]
 |  |  output: sum(CAST(ss_quantity AS DECIMAL(10,0)) * ss_list_price), count(*)
 |  |  group by: i_brand_id, i_class_id, i_category_id
@@ -2987,7 +2987,7 @@ max-parallelism=3 segment-costs=[1366, 833, 1] cpu-comparison-result=112 [max(6
 |  |  |
 |  |  F46:PLAN FRAGMENT [UNPARTITIONED] hosts=1 instances=1
 |  |  Per-Instance Resources: mem-estimate=80.00KB mem-reservation=0B thread-reservation=1
-|  |  max-parallelism=1 segment-costs=[1, 1]
+|  |  max-parallelism=2 segment-costs=[1, 1]
 |  |  71:CARDINALITY CHECK
 |  |  |  limit: 1
 |  |  |  mem-estimate=0B mem-reservation=0B thread-reservation=0
@@ -3002,7 +3002,7 @@ max-parallelism=3 segment-costs=[1366, 833, 1] cpu-comparison-result=112 [max(6
 |  |  |
 |  |  F45:PLAN FRAGMENT [RANDOM] hosts=1 instances=1
 |  |  Per-Instance Resources: mem-estimate=16.08MB mem-reservation=512.00KB thread-reservation=1
-|  |  max-parallelism=1 segment-costs=[220290]
+|  |  max-parallelism=1 segment-costs=[270290]
 |  |  70:SCAN HDFS [tpcds_parquet.date_dim, RANDOM]
 |  |     HDFS partitions=1/1 files=1 size=2.15MB
 |  |     predicates: d_year = CAST(1999 AS INT), d_dom = CAST(11 AS INT), d_moy = CAST(12 AS INT)
@@ -3014,7 +3014,7 @@ max-parallelism=3 segment-costs=[1366, 833, 1] cpu-comparison-result=112 [max(6
 |  |     parquet dictionary predicates: d_year = CAST(1999 AS INT), d_dom = CAST(11 AS INT), d_moy = CAST(12 AS INT)
 |  |     limit: 2
 |  |     mem-estimate=16.00MB mem-reservation=512.00KB thread-reservation=0
-|  |     tuple-ids=57 row-size=16B cardinality=2 cost=220289
+|  |     tuple-ids=57 row-size=16B cardinality=2 cost=270289
 |  |     in pipelines: 70(GETNEXT)
 |  |
 |  75:HASH JOIN [LEFT SEMI JOIN, BROADCAST]
@@ -3038,9 +3038,9 @@ max-parallelism=3 segment-costs=[1366, 833, 1] cpu-comparison-result=112 [max(6
 |  |  |  tuple-ids=114 row-size=8B cardinality=17.98K cost=633
 |  |  |  in pipelines: 140(GETNEXT)
 |  |  |
-|  |  F44:PLAN FRAGMENT [HASH(tpcds_parquet.item.i_item_sk)] hosts=3 instances=6 (adjusted from 12)
+|  |  F44:PLAN FRAGMENT [HASH(tpcds_parquet.item.i_item_sk)] hosts=3 instances=6 (adjusted from 48)
 |  |  Per-Instance Resources: mem-estimate=10.12MB mem-reservation=1.94MB thread-reservation=1
-|  |  max-parallelism=3 segment-costs=[18186, 211] cpu-comparison-result=33 [max(6 (self) vs 33 (sum children))]
+|  |  max-parallelism=6 segment-costs=[18186, 211] cpu-comparison-result=33 [max(6 (self) vs 33 (sum children))]
 |  |  140:AGGREGATE [FINALIZE]
 |  |  |  group by: tpcds_parquet.item.i_item_sk
 |  |  |  mem-estimate=10.00MB mem-reservation=1.94MB spill-buffer=64.00KB thread-reservation=0
@@ -3052,9 +3052,9 @@ max-parallelism=3 segment-costs=[1366, 833, 1] cpu-comparison-result=112 [max(6
 |  |  |  tuple-ids=114 row-size=8B cardinality=17.98K cost=211
 |  |  |  in pipelines: 127(GETNEXT)
 |  |  |
-|  |  F34:PLAN FRAGMENT [HASH(iss.i_brand_id,iss.i_class_id,iss.i_category_id)] hosts=3 instances=6 (adjusted from 12)
+|  |  F34:PLAN FRAGMENT [HASH(iss.i_brand_id,iss.i_class_id,iss.i_category_id)] hosts=3 instances=6 (adjusted from 48)
 |  |  Per-Instance Resources: mem-estimate=20.76MB mem-reservation=3.94MB thread-reservation=1
-|  |  max-parallelism=3 segment-costs=[448725, 1488000, 211] cpu-comparison-result=33 [max(6 (self) vs 33 (sum children))]
+|  |  max-parallelism=6 segment-costs=[448725, 1488000, 211] cpu-comparison-result=33 [max(6 (self) vs 33 (sum children))]
 |  |  74:AGGREGATE [STREAMING]
 |  |  |  group by: tpcds_parquet.item.i_item_sk
 |  |  |  mem-estimate=10.00MB mem-reservation=2.00MB spill-buffer=64.00KB thread-reservation=0
@@ -3069,7 +3069,7 @@ max-parallelism=3 segment-costs=[1366, 833, 1] cpu-comparison-result=112 [max(6
 |  |  |  tuple-ids=44,40 row-size=32B cardinality=148.80K cost=446400
 |  |  |  in pipelines: 127(GETNEXT), 48(OPEN)
 |  |  |
-|  |  |--F64:PLAN FRAGMENT [HASH(iss.i_brand_id,iss.i_class_id,iss.i_category_id)] hosts=3 instances=6 (adjusted from 12)
+|  |  |--F64:PLAN FRAGMENT [HASH(iss.i_brand_id,iss.i_class_id,iss.i_category_id)] hosts=3 instances=6 (adjusted from 48)
 |  |  |  |  Per-Instance Resources: mem-estimate=2.30MB mem-reservation=1.94MB thread-reservation=1
 |  |  |  |  max-parallelism=6 segment-costs=[54422]
 |  |  |  JOIN BUILD
@@ -3085,7 +3085,7 @@ max-parallelism=3 segment-costs=[1366, 833, 1] cpu-comparison-result=112 [max(6
 |  |  |  |
 |  |  |  F43:PLAN FRAGMENT [RANDOM] hosts=1 instances=1
 |  |  |  Per-Instance Resources: mem-estimate=16.56MB mem-reservation=256.00KB thread-reservation=1
-|  |  |  max-parallelism=1 segment-costs=[774]
+|  |  |  max-parallelism=1 segment-costs=[50774]
 |  |  |  48:SCAN HDFS [tpcds_parquet.item, RANDOM]
 |  |  |     HDFS partitions=1/1 files=1 size=1.73MB
 |  |  |     stored statistics:
@@ -3093,7 +3093,7 @@ max-parallelism=3 segment-costs=[1366, 833, 1] cpu-comparison-result=112 [max(6
 |  |  |       columns: all
 |  |  |     extrapolated-rows=disabled max-scan-range-rows=18.00K
 |  |  |     mem-estimate=16.00MB mem-reservation=256.00KB thread-reservation=0
-|  |  |     tuple-ids=40 row-size=20B cardinality=18.00K cost=352
+|  |  |     tuple-ids=40 row-size=20B cardinality=18.00K cost=50352
 |  |  |     in pipelines: 48(GETNEXT)
 |  |  |
 |  |  68:HASH JOIN [LEFT SEMI JOIN, PARTITIONED]
@@ -3103,7 +3103,7 @@ max-parallelism=3 segment-costs=[1366, 833, 1] cpu-comparison-result=112 [max(6
 |  |  |  tuple-ids=44 row-size=12B cardinality=148.80K cost=446400
 |  |  |  in pipelines: 127(GETNEXT), 136(OPEN)
 |  |  |
-|  |  |--F65:PLAN FRAGMENT [HASH(iss.i_brand_id,iss.i_class_id,iss.i_category_id)] hosts=3 instances=6 (adjusted from 12)
+|  |  |--F65:PLAN FRAGMENT [HASH(iss.i_brand_id,iss.i_class_id,iss.i_category_id)] hosts=3 instances=6 (adjusted from 48)
 |  |  |  |  Per-Instance Resources: mem-estimate=2.85MB mem-reservation=1.94MB thread-reservation=1
 |  |  |  |  max-parallelism=6 segment-costs=[448725] cpu-comparison-result=6 [max(6 (self) vs 6 (sum children))]
 |  |  |  JOIN BUILD
@@ -3118,7 +3118,7 @@ max-parallelism=3 segment-costs=[1366, 833, 1] cpu-comparison-result=112 [max(6
 |  |  |  |
 |  |  |  F42:PLAN FRAGMENT [HASH(iws.i_brand_id,iws.i_class_id,iws.i_category_id)] hosts=2 instances=4 (adjusted from 2)
 |  |  |  Per-Instance Resources: mem-estimate=10.88MB mem-reservation=1.94MB thread-reservation=1
-|  |  |  max-parallelism=2 segment-costs=[448725, 2325] cpu-comparison-result=6 [max(4 (self) vs 6 (sum children))]
+|  |  |  max-parallelism=4 segment-costs=[448725, 2325] cpu-comparison-result=6 [max(4 (self) vs 6 (sum children))]
 |  |  |  136:AGGREGATE [FINALIZE]
 |  |  |  |  group by: iws.i_brand_id, iws.i_class_id, iws.i_category_id
 |  |  |  |  mem-estimate=10.00MB mem-reservation=1.94MB spill-buffer=64.00KB thread-reservation=0
@@ -3131,8 +3131,8 @@ max-parallelism=3 segment-costs=[1366, 833, 1] cpu-comparison-result=112 [max(6
 |  |  |  |  in pipelines: 60(GETNEXT)
 |  |  |  |
 |  |  |  F39:PLAN FRAGMENT [RANDOM] hosts=2 instances=2
-|  |  |  Per-Instance Resources: mem-estimate=42.25MB mem-reservation=9.00MB thread-reservation=1
-|  |  |  max-parallelism=2 segment-costs=[3605351, 2325] cpu-comparison-result=6 [max(2 (self) vs 6 (sum children))]
+|  |  |  Per-Instance Resources: mem-estimate=26.25MB mem-reservation=9.00MB thread-reservation=1
+|  |  |  max-parallelism=2 segment-costs=[3705351, 2325] cpu-comparison-result=6 [max(2 (self) vs 6 (sum children))]
 |  |  |  67:AGGREGATE [STREAMING]
 |  |  |  |  group by: iws.i_brand_id, iws.i_class_id, iws.i_category_id
 |  |  |  |  mem-estimate=10.00MB mem-reservation=5.00MB spill-buffer=256.00KB thread-reservation=0
@@ -3148,13 +3148,13 @@ max-parallelism=3 segment-costs=[1366, 833, 1] cpu-comparison-result=112 [max(6
 |  |  |  |  in pipelines: 60(GETNEXT), 62(OPEN)
 |  |  |  |
 |  |  |  |--F66:PLAN FRAGMENT [RANDOM] hosts=2 instances=2
-|  |  |  |  |  Per-Instance Resources: mem-estimate=7.82MB mem-reservation=7.75MB thread-reservation=1
+|  |  |  |  |  Per-Instance Resources: mem-estimate=2.00MB mem-reservation=1.94MB thread-reservation=1
 |  |  |  |  |  max-parallelism=2 segment-costs=[7477]
 |  |  |  |  JOIN BUILD
 |  |  |  |  |  join-table-id=09 plan-id=10 cohort-id=05
 |  |  |  |  |  build expressions: d3.d_date_sk
 |  |  |  |  |  runtime filters: RF073[min_max] <- d3.d_date_sk
-|  |  |  |  |  mem-estimate=7.75MB mem-reservation=7.75MB spill-buffer=64.00KB thread-reservation=0 cost=7305
+|  |  |  |  |  mem-estimate=1.94MB mem-reservation=1.94MB spill-buffer=64.00KB thread-reservation=0 cost=7305
 |  |  |  |  |
 |  |  |  |  134:EXCHANGE [BROADCAST]
 |  |  |  |  |  mem-estimate=69.07KB mem-reservation=0B thread-reservation=0
@@ -3163,7 +3163,7 @@ max-parallelism=3 segment-costs=[1366, 833, 1] cpu-comparison-result=112 [max(6
 |  |  |  |  |
 |  |  |  |  F41:PLAN FRAGMENT [RANDOM] hosts=1 instances=1
 |  |  |  |  Per-Instance Resources: mem-estimate=16.05MB mem-reservation=512.00KB thread-reservation=1
-|  |  |  |  max-parallelism=1 segment-costs=[146755]
+|  |  |  |  max-parallelism=1 segment-costs=[196755]
 |  |  |  |  62:SCAN HDFS [tpcds_parquet.date_dim d3, RANDOM]
 |  |  |  |     HDFS partitions=1/1 files=1 size=2.15MB
 |  |  |  |     predicates: d3.d_year <= CAST(2001 AS INT), d3.d_year >= CAST(1999 AS INT)
@@ -3174,7 +3174,7 @@ max-parallelism=3 segment-costs=[1366, 833, 1] cpu-comparison-result=112 [max(6
 |  |  |  |     parquet statistics predicates: d3.d_year <= CAST(2001 AS INT), d3.d_year >= CAST(1999 AS INT)
 |  |  |  |     parquet dictionary predicates: d3.d_year <= CAST(2001 AS INT), d3.d_year >= CAST(1999 AS INT)
 |  |  |  |     mem-estimate=16.00MB mem-reservation=512.00KB thread-reservation=0
-|  |  |  |     tuple-ids=52 row-size=8B cardinality=7.30K cost=146669
+|  |  |  |     tuple-ids=52 row-size=8B cardinality=7.30K cost=196669
 |  |  |  |     in pipelines: 62(GETNEXT)
 |  |  |  |
 |  |  |  63:HASH JOIN [INNER JOIN, BROADCAST]
@@ -3186,13 +3186,13 @@ max-parallelism=3 segment-costs=[1366, 833, 1] cpu-comparison-result=112 [max(6
 |  |  |  |  in pipelines: 60(GETNEXT), 61(OPEN)
 |  |  |  |
 |  |  |  |--F67:PLAN FRAGMENT [RANDOM] hosts=2 instances=2
-|  |  |  |  |  Per-Instance Resources: mem-estimate=8.12MB mem-reservation=7.75MB thread-reservation=1
+|  |  |  |  |  Per-Instance Resources: mem-estimate=2.30MB mem-reservation=1.94MB thread-reservation=1
 |  |  |  |  |  max-parallelism=2 segment-costs=[18844]
 |  |  |  |  JOIN BUILD
 |  |  |  |  |  join-table-id=10 plan-id=11 cohort-id=05
 |  |  |  |  |  build expressions: iws.i_item_sk
 |  |  |  |  |  runtime filters: RF075[min_max] <- iws.i_item_sk
-|  |  |  |  |  mem-estimate=7.75MB mem-reservation=7.75MB spill-buffer=64.00KB thread-reservation=0 cost=18000
+|  |  |  |  |  mem-estimate=1.94MB mem-reservation=1.94MB spill-buffer=64.00KB thread-reservation=0 cost=18000
 |  |  |  |  |
 |  |  |  |  133:EXCHANGE [BROADCAST]
 |  |  |  |  |  mem-estimate=375.56KB mem-reservation=0B thread-reservation=0
@@ -3201,7 +3201,7 @@ max-parallelism=3 segment-costs=[1366, 833, 1] cpu-comparison-result=112 [max(6
 |  |  |  |  |
 |  |  |  |  F40:PLAN FRAGMENT [RANDOM] hosts=1 instances=1
 |  |  |  |  Per-Instance Resources: mem-estimate=16.09MB mem-reservation=256.00KB thread-reservation=1
-|  |  |  |  max-parallelism=1 segment-costs=[774]
+|  |  |  |  max-parallelism=1 segment-costs=[50774]
 |  |  |  |  61:SCAN HDFS [tpcds_parquet.item iws, RANDOM]
 |  |  |  |     HDFS partitions=1/1 files=1 size=1.73MB
 |  |  |  |     stored statistics:
@@ -3209,7 +3209,7 @@ max-parallelism=3 segment-costs=[1366, 833, 1] cpu-comparison-result=112 [max(6
 |  |  |  |       columns: all
 |  |  |  |     extrapolated-rows=disabled max-scan-range-rows=18.00K
 |  |  |  |     mem-estimate=16.00MB mem-reservation=256.00KB thread-reservation=0
-|  |  |  |     tuple-ids=51 row-size=20B cardinality=18.00K cost=352
+|  |  |  |     tuple-ids=51 row-size=20B cardinality=18.00K cost=50352
 |  |  |  |     in pipelines: 61(GETNEXT)
 |  |  |  |
 |  |  |  60:SCAN HDFS [tpcds_parquet.web_sales, RANDOM]
@@ -3219,8 +3219,8 @@ max-parallelism=3 segment-costs=[1366, 833, 1] cpu-comparison-result=112 [max(6
 |  |  |       table: rows=719.38K size=45.09MB
 |  |  |       columns: all
 |  |  |     extrapolated-rows=disabled max-scan-range-rows=644.77K
-|  |  |     mem-estimate=32.00MB mem-reservation=4.00MB thread-reservation=0
-|  |  |     tuple-ids=50 row-size=12B cardinality=719.38K cost=8431
+|  |  |     mem-estimate=16.00MB mem-reservation=4.00MB thread-reservation=0
+|  |  |     tuple-ids=50 row-size=12B cardinality=719.38K cost=108431
 |  |  |     in pipelines: 60(GETNEXT)
 |  |  |
 |  |  66:HASH JOIN [LEFT SEMI JOIN, PARTITIONED]
@@ -3230,7 +3230,7 @@ max-parallelism=3 segment-costs=[1366, 833, 1] cpu-comparison-result=112 [max(6
 |  |  |  tuple-ids=44 row-size=12B cardinality=148.80K cost=446400
 |  |  |  in pipelines: 127(GETNEXT), 131(OPEN)
 |  |  |
-|  |  |--F68:PLAN FRAGMENT [HASH(iss.i_brand_id,iss.i_class_id,iss.i_category_id)] hosts=3 instances=6 (adjusted from 12)
+|  |  |--F68:PLAN FRAGMENT [HASH(iss.i_brand_id,iss.i_class_id,iss.i_category_id)] hosts=3 instances=6 (adjusted from 48)
 |  |  |  |  Per-Instance Resources: mem-estimate=2.60MB mem-reservation=1.94MB thread-reservation=1
 |  |  |  |  max-parallelism=6 segment-costs=[448725] cpu-comparison-result=8 [max(6 (self) vs 8 (sum children))]
 |  |  |  JOIN BUILD
@@ -3245,7 +3245,7 @@ max-parallelism=3 segment-costs=[1366, 833, 1] cpu-comparison-result=112 [max(6
 |  |  |  |
 |  |  |  F38:PLAN FRAGMENT [HASH(ics.i_brand_id,ics.i_class_id,ics.i_category_id)] hosts=3 instances=6 (adjusted from 3)
 |  |  |  Per-Instance Resources: mem-estimate=10.61MB mem-reservation=1.94MB thread-reservation=1
-|  |  |  max-parallelism=3 segment-costs=[448725, 2325] cpu-comparison-result=8 [max(6 (self) vs 8 (sum children))]
+|  |  |  max-parallelism=6 segment-costs=[448725, 2325] cpu-comparison-result=8 [max(6 (self) vs 8 (sum children))]
 |  |  |  131:AGGREGATE [FINALIZE]
 |  |  |  |  group by: ics.i_brand_id, ics.i_class_id, ics.i_category_id
 |  |  |  |  mem-estimate=10.00MB mem-reservation=1.94MB spill-buffer=64.00KB thread-reservation=0
@@ -3258,8 +3258,8 @@ max-parallelism=3 segment-costs=[1366, 833, 1] cpu-comparison-result=112 [max(6
 |  |  |  |  in pipelines: 55(GETNEXT)
 |  |  |  |
 |  |  |  F35:PLAN FRAGMENT [RANDOM] hosts=3 instances=3
-|  |  |  Per-Instance Resources: mem-estimate=58.38MB mem-reservation=9.00MB thread-reservation=1
-|  |  |  max-parallelism=3 segment-costs=[7224634, 2325] cpu-comparison-result=8 [max(3 (self) vs 8 (sum children))]
+|  |  |  Per-Instance Resources: mem-estimate=26.38MB mem-reservation=9.00MB thread-reservation=1
+|  |  |  max-parallelism=3 segment-costs=[7374634, 2325] cpu-comparison-result=8 [max(3 (self) vs 8 (sum children))]
 |  |  |  65:AGGREGATE [STREAMING]
 |  |  |  |  group by: ics.i_brand_id, ics.i_class_id, ics.i_category_id
 |  |  |  |  mem-estimate=10.00MB mem-reservation=5.00MB spill-buffer=256.00KB thread-reservation=0
@@ -3275,13 +3275,13 @@ max-parallelism=3 segment-costs=[1366, 833, 1] cpu-comparison-result=112 [max(6
 |  |  |  |  in pipelines: 55(GETNEXT), 57(OPEN)
 |  |  |  |
 |  |  |  |--F69:PLAN FRAGMENT [RANDOM] hosts=3 instances=3
-|  |  |  |  |  Per-Instance Resources: mem-estimate=7.82MB mem-reservation=7.75MB thread-reservation=1
+|  |  |  |  |  Per-Instance Resources: mem-estimate=2.00MB mem-reservation=1.94MB thread-reservation=1
 |  |  |  |  |  max-parallelism=3 segment-costs=[7563]
 |  |  |  |  JOIN BUILD
 |  |  |  |  |  join-table-id=12 plan-id=13 cohort-id=06
 |  |  |  |  |  build expressions: d2.d_date_sk
 |  |  |  |  |  runtime filters: RF069[min_max] <- d2.d_date_sk
-|  |  |  |  |  mem-estimate=7.75MB mem-reservation=7.75MB spill-buffer=64.00KB thread-reservation=0 cost=7305
+|  |  |  |  |  mem-estimate=1.94MB mem-reservation=1.94MB spill-buffer=64.00KB thread-reservation=0 cost=7305
 |  |  |  |  |
 |  |  |  |  129:EXCHANGE [BROADCAST]
 |  |  |  |  |  mem-estimate=69.07KB mem-reservation=0B thread-reservation=0
@@ -3290,7 +3290,7 @@ max-parallelism=3 segment-costs=[1366, 833, 1] cpu-comparison-result=112 [max(6
 |  |  |  |  |
 |  |  |  |  F37:PLAN FRAGMENT [RANDOM] hosts=1 instances=1
 |  |  |  |  Per-Instance Resources: mem-estimate=16.05MB mem-reservation=512.00KB thread-reservation=1
-|  |  |  |  max-parallelism=1 segment-costs=[146755]
+|  |  |  |  max-parallelism=1 segment-costs=[196755]
 |  |  |  |  57:SCAN HDFS [tpcds_parquet.date_dim d2, RANDOM]
 |  |  |  |     HDFS partitions=1/1 files=1 size=2.15MB
 |  |  |  |     predicates: d2.d_year <= CAST(2001 AS INT), d2.d_year >= CAST(1999 AS INT)
@@ -3301,7 +3301,7 @@ max-parallelism=3 segment-costs=[1366, 833, 1] cpu-comparison-result=112 [max(6
 |  |  |  |     parquet statistics predicates: d2.d_year <= CAST(2001 AS INT), d2.d_year >= CAST(1999 AS INT)
 |  |  |  |     parquet dictionary predicates: d2.d_year <= CAST(2001 AS INT), d2.d_year >= CAST(1999 AS INT)
 |  |  |  |     mem-estimate=16.00MB mem-reservation=512.00KB thread-reservation=0
-|  |  |  |     tuple-ids=48 row-size=8B cardinality=7.30K cost=146669
+|  |  |  |     tuple-ids=48 row-size=8B cardinality=7.30K cost=196669
 |  |  |  |     in pipelines: 57(GETNEXT)
 |  |  |  |
 |  |  |  58:HASH JOIN [INNER JOIN, BROADCAST]
@@ -3313,13 +3313,13 @@ max-parallelism=3 segment-costs=[1366, 833, 1] cpu-comparison-result=112 [max(6
 |  |  |  |  in pipelines: 55(GETNEXT), 56(OPEN)
 |  |  |  |
 |  |  |  |--F70:PLAN FRAGMENT [RANDOM] hosts=3 instances=3
-|  |  |  |  |  Per-Instance Resources: mem-estimate=8.12MB mem-reservation=7.75MB thread-reservation=1
+|  |  |  |  |  Per-Instance Resources: mem-estimate=2.30MB mem-reservation=1.94MB thread-reservation=1
 |  |  |  |  |  max-parallelism=3 segment-costs=[19266]
 |  |  |  |  JOIN BUILD
 |  |  |  |  |  join-table-id=13 plan-id=14 cohort-id=06
 |  |  |  |  |  build expressions: ics.i_item_sk
 |  |  |  |  |  runtime filters: RF071[min_max] <- ics.i_item_sk
-|  |  |  |  |  mem-estimate=7.75MB mem-reservation=7.75MB spill-buffer=64.00KB thread-reservation=0 cost=18000
+|  |  |  |  |  mem-estimate=1.94MB mem-reservation=1.94MB spill-buffer=64.00KB thread-reservation=0 cost=18000
 |  |  |  |  |
 |  |  |  |  128:EXCHANGE [BROADCAST]
 |  |  |  |  |  mem-estimate=375.56KB mem-reservation=0B thread-reservation=0
@@ -3328,7 +3328,7 @@ max-parallelism=3 segment-costs=[1366, 833, 1] cpu-comparison-result=112 [max(6
 |  |  |  |  |
 |  |  |  |  F36:PLAN FRAGMENT [RANDOM] hosts=1 instances=1
 |  |  |  |  Per-Instance Resources: mem-estimate=16.09MB mem-reservation=256.00KB thread-reservation=1
-|  |  |  |  max-parallelism=1 segment-costs=[774]
+|  |  |  |  max-parallelism=1 segment-costs=[50774]
 |  |  |  |  56:SCAN HDFS [tpcds_parquet.item ics, RANDOM]
 |  |  |  |     HDFS partitions=1/1 files=1 size=1.73MB
 |  |  |  |     stored statistics:
@@ -3336,7 +3336,7 @@ max-parallelism=3 segment-costs=[1366, 833, 1] cpu-comparison-result=112 [max(6
 |  |  |  |       columns: all
 |  |  |  |     extrapolated-rows=disabled max-scan-range-rows=18.00K
 |  |  |  |     mem-estimate=16.00MB mem-reservation=256.00KB thread-reservation=0
-|  |  |  |     tuple-ids=47 row-size=20B cardinality=18.00K cost=352
+|  |  |  |     tuple-ids=47 row-size=20B cardinality=18.00K cost=50352
 |  |  |  |     in pipelines: 56(GETNEXT)
 |  |  |  |
 |  |  |  55:SCAN HDFS [tpcds_parquet.catalog_sales, RANDOM]
@@ -3346,8 +3346,8 @@ max-parallelism=3 segment-costs=[1366, 833, 1] cpu-comparison-result=112 [max(6
 |  |  |       table: rows=1.44M size=96.62MB
 |  |  |       columns: all
 |  |  |     extrapolated-rows=disabled max-scan-range-rows=650.14K
-|  |  |     mem-estimate=48.00MB mem-reservation=4.00MB thread-reservation=0
-|  |  |     tuple-ids=46 row-size=12B cardinality=1.44M cost=16894
+|  |  |     mem-estimate=16.00MB mem-reservation=4.00MB thread-reservation=0
+|  |  |     tuple-ids=46 row-size=12B cardinality=1.44M cost=166894
 |  |  |     in pipelines: 55(GETNEXT)
 |  |  |
 |  |  127:AGGREGATE [FINALIZE]
@@ -3361,9 +3361,9 @@ max-parallelism=3 segment-costs=[1366, 833, 1] cpu-comparison-result=112 [max(6
 |  |  |  tuple-ids=44 row-size=12B cardinality=148.80K cost=2325
 |  |  |  in pipelines: 49(GETNEXT)
 |  |  |
-|  |  F31:PLAN FRAGMENT [RANDOM] hosts=3 instances=12
+|  |  F31:PLAN FRAGMENT [RANDOM] hosts=3 instances=12 (adjusted from 48)
 |  |  Per-Instance Resources: mem-estimate=26.38MB mem-reservation=5.50MB thread-reservation=1
-|  |  max-parallelism=12 segment-costs=[14435775, 2325] cpu-comparison-result=12 [max(12 (self) vs 8 (sum children))]
+|  |  max-parallelism=12 segment-costs=[105635772, 2325] cpu-comparison-result=12 [max(12 (self) vs 8 (sum children))]
 |  |  54:AGGREGATE [STREAMING]
 |  |  |  group by: iss.i_brand_id, iss.i_class_id, iss.i_category_id
 |  |  |  mem-estimate=10.00MB mem-reservation=5.00MB spill-buffer=256.00KB thread-reservation=0
@@ -3393,7 +3393,7 @@ max-parallelism=3 segment-costs=[1366, 833, 1] cpu-comparison-result=112 [max(6
 |  |  |  |
 |  |  |  F33:PLAN FRAGMENT [RANDOM] hosts=1 instances=1
 |  |  |  Per-Instance Resources: mem-estimate=16.05MB mem-reservation=512.00KB thread-reservation=1
-|  |  |  max-parallelism=1 segment-costs=[146755]
+|  |  |  max-parallelism=1 segment-costs=[196755]
 |  |  |  51:SCAN HDFS [tpcds_parquet.date_dim d1, RANDOM]
 |  |  |     HDFS partitions=1/1 files=1 size=2.15MB
 |  |  |     predicates: d1.d_year <= CAST(2001 AS INT), d1.d_year >= CAST(1999 AS INT)
@@ -3404,7 +3404,7 @@ max-parallelism=3 segment-costs=[1366, 833, 1] cpu-comparison-result=112 [max(6
 |  |  |     parquet statistics predicates: d1.d_year <= CAST(2001 AS INT), d1.d_year >= CAST(1999 AS INT)
 |  |  |     parquet dictionary predicates: d1.d_year <= CAST(2001 AS INT), d1.d_year >= CAST(1999 AS INT)
 |  |  |     mem-estimate=16.00MB mem-reservation=512.00KB thread-reservation=0
-|  |  |     tuple-ids=43 row-size=8B cardinality=7.30K cost=146669
+|  |  |     tuple-ids=43 row-size=8B cardinality=7.30K cost=196669
 |  |  |     in pipelines: 51(GETNEXT)
 |  |  |
 |  |  52:HASH JOIN [INNER JOIN, BROADCAST]
@@ -3431,7 +3431,7 @@ max-parallelism=3 segment-costs=[1366, 833, 1] cpu-comparison-result=112 [max(6
 |  |  |  |
 |  |  |  F32:PLAN FRAGMENT [RANDOM] hosts=1 instances=1
 |  |  |  Per-Instance Resources: mem-estimate=16.09MB mem-reservation=256.00KB thread-reservation=1
-|  |  |  max-parallelism=1 segment-costs=[774]
+|  |  |  max-parallelism=1 segment-costs=[50774]
 |  |  |  50:SCAN HDFS [tpcds_parquet.item iss, RANDOM]
 |  |  |     HDFS partitions=1/1 files=1 size=1.73MB
 |  |  |     runtime filters: RF055[min_max] -> iss.i_brand_id, RF056[min_max] -> iss.i_category_id, RF057[min_max] -> iss.i_class_id
@@ -3440,7 +3440,7 @@ max-parallelism=3 segment-costs=[1366, 833, 1] cpu-comparison-result=112 [max(6
 |  |  |       columns: all
 |  |  |     extrapolated-rows=disabled max-scan-range-rows=18.00K
 |  |  |     mem-estimate=16.00MB mem-reservation=256.00KB thread-reservation=0
-|  |  |     tuple-ids=42 row-size=20B cardinality=18.00K cost=352
+|  |  |     tuple-ids=42 row-size=20B cardinality=18.00K cost=50352
 |  |  |     in pipelines: 50(GETNEXT)
 |  |  |
 |  |  49:SCAN HDFS [tpcds_parquet.store_sales, RANDOM]
@@ -3452,7 +3452,7 @@ max-parallelism=3 segment-costs=[1366, 833, 1] cpu-comparison-result=112 [max(6
 |  |       columns: all
 |  |     extrapolated-rows=disabled max-scan-range-rows=130.09K
 |  |     mem-estimate=16.00MB mem-reservation=512.00KB thread-reservation=0
-|  |     tuple-ids=41 row-size=12B cardinality=2.88M cost=33755
+|  |     tuple-ids=41 row-size=12B cardinality=2.88M cost=91233752
 |  |     in pipelines: 49(GETNEXT)
 |  |
 |  73:HASH JOIN [INNER JOIN, BROADCAST]
@@ -3479,7 +3479,7 @@ max-parallelism=3 segment-costs=[1366, 833, 1] cpu-comparison-result=112 [max(6
 |  |  F30:PLAN FRAGMENT [RANDOM] hosts=1 instances=1
 |  |  Per-Host Shared Resources: mem-estimate=1.00MB mem-reservation=1.00MB thread-reservation=0 runtime-filters-memory=1.00MB
 |  |  Per-Instance Resources: mem-estimate=16.05MB mem-reservation=512.00KB thread-reservation=1
-|  |  max-parallelism=1 segment-costs=[1428]
+|  |  max-parallelism=1 segment-costs=[51428]
 |  |  47:SCAN HDFS [tpcds_parquet.date_dim, RANDOM]
 |  |     HDFS partitions=1/1 files=1 size=2.15MB
 |  |     runtime filters: RF045[min_max] -> d_week_seq, RF044[bloom] -> d_week_seq
@@ -3488,7 +3488,7 @@ max-parallelism=3 segment-costs=[1366, 833, 1] cpu-comparison-result=112 [max(6
 |  |       columns: all
 |  |     extrapolated-rows=disabled max-scan-range-rows=73.05K
 |  |     mem-estimate=16.00MB mem-reservation=512.00KB thread-reservation=0
-|  |     tuple-ids=39 row-size=8B cardinality=73.05K cost=571
+|  |     tuple-ids=39 row-size=8B cardinality=73.05K cost=50571
 |  |     in pipelines: 47(GETNEXT)
 |  |
 |  72:HASH JOIN [INNER JOIN, BROADCAST]
@@ -3515,7 +3515,7 @@ max-parallelism=3 segment-costs=[1366, 833, 1] cpu-comparison-result=112 [max(6
 |  |  |
 |  |  F29:PLAN FRAGMENT [RANDOM] hosts=1 instances=1
 |  |  Per-Instance Resources: mem-estimate=16.09MB mem-reservation=256.00KB thread-reservation=1
-|  |  max-parallelism=1 segment-costs=[774]
+|  |  max-parallelism=1 segment-costs=[50774]
 |  |  46:SCAN HDFS [tpcds_parquet.item, RANDOM]
 |  |     HDFS partitions=1/1 files=1 size=1.73MB
 |  |     runtime filters: RF047[min_max] -> tpcds_parquet.item.i_item_sk
@@ -3524,7 +3524,7 @@ max-parallelism=3 segment-costs=[1366, 833, 1] cpu-comparison-result=112 [max(6
 |  |       columns: all
 |  |     extrapolated-rows=disabled max-scan-range-rows=18.00K
 |  |     mem-estimate=16.00MB mem-reservation=256.00KB thread-reservation=0
-|  |     tuple-ids=38 row-size=20B cardinality=18.00K cost=352
+|  |     tuple-ids=38 row-size=20B cardinality=18.00K cost=50352
 |  |     in pipelines: 46(GETNEXT)
 |  |
 |  45:SCAN HDFS [tpcds_parquet.store_sales, RANDOM]
@@ -3536,7 +3536,7 @@ max-parallelism=3 segment-costs=[1366, 833, 1] cpu-comparison-result=112 [max(6
 |       columns: all
 |     extrapolated-rows=disabled max-scan-range-rows=130.09K
 |     mem-estimate=16.00MB mem-reservation=1.00MB thread-reservation=0
-|     tuple-ids=37 row-size=20B cardinality=2.88M cost=56258
+|     tuple-ids=37 row-size=20B cardinality=2.88M cost=91256256
 |     in pipelines: 45(GETNEXT)
 |
 44:NESTED LOOP JOIN [INNER JOIN, BROADCAST]
@@ -3560,7 +3560,7 @@ max-parallelism=3 segment-costs=[1366, 833, 1] cpu-comparison-result=112 [max(6
 |  |
 |  F27:PLAN FRAGMENT [UNPARTITIONED] hosts=1 instances=1
 |  Per-Instance Resources: mem-estimate=96.00KB mem-reservation=0B thread-reservation=1
-|  max-parallelism=1 segment-costs=[2, 1] cpu-comparison-result=12 [max(2 (self) vs 12 (sum children))]
+|  max-parallelism=2 segment-costs=[2, 1] cpu-comparison-result=12 [max(2 (self) vs 12 (sum children))]
 |  120:AGGREGATE [FINALIZE]
 |  |  output: avg:merge(quantity * list_price)
 |  |  mem-estimate=16.00KB mem-reservation=0B spill-buffer=2.00MB thread-reservation=0
@@ -3572,9 +3572,9 @@ max-parallelism=3 segment-costs=[1366, 833, 1] cpu-comparison-result=112 [max(6
 |  |  tuple-ids=32 row-size=16B cardinality=1 cost=1
 |  |  in pipelines: 43(GETNEXT)
 |  |
-|  F26:PLAN FRAGMENT [RANDOM] hosts=3 instances=12
-|  Per-Instance Resources: mem-estimate=48.02MB mem-reservation=4.00MB thread-reservation=1
-|  max-parallelism=12 segment-costs=[40389768, 1] cpu-comparison-result=12 [max(12 (self) vs 12 (sum children))]
+|  F26:PLAN FRAGMENT [RANDOM] hosts=3 instances=12 (adjusted from 48)
+|  Per-Instance Resources: mem-estimate=16.02MB mem-reservation=4.00MB thread-reservation=1
+|  max-parallelism=12 segment-costs=[131839765, 1] cpu-comparison-result=12 [max(12 (self) vs 12 (sum children))]
 |  43:AGGREGATE
 |  |  output: avg(CAST(quantity AS DECIMAL(10,0)) * list_price)
 |  |  mem-estimate=16.00KB mem-reservation=0B spill-buffer=2.00MB thread-reservation=0
@@ -3610,7 +3610,7 @@ max-parallelism=3 segment-costs=[1366, 833, 1] cpu-comparison-result=112 [max(6
 |  |  |  |
 |  |  |  F25:PLAN FRAGMENT [RANDOM] hosts=1 instances=1
 |  |  |  Per-Instance Resources: mem-estimate=16.05MB mem-reservation=512.00KB thread-reservation=1
-|  |  |  max-parallelism=1 segment-costs=[146755]
+|  |  |  max-parallelism=1 segment-costs=[196755]
 |  |  |  41:SCAN HDFS [tpcds_parquet.date_dim, RANDOM]
 |  |  |     HDFS partitions=1/1 files=1 size=2.15MB
 |  |  |     predicates: d_year <= CAST(2001 AS INT), d_year >= CAST(1999 AS INT)
@@ -3621,7 +3621,7 @@ max-parallelism=3 segment-costs=[1366, 833, 1] cpu-comparison-result=112 [max(6
 |  |  |     parquet statistics predicates: d_year <= CAST(2001 AS INT), d_year >= CAST(1999 AS INT)
 |  |  |     parquet dictionary predicates: d_year <= CAST(2001 AS INT), d_year >= CAST(1999 AS INT)
 |  |  |     mem-estimate=16.00MB mem-reservation=512.00KB thread-reservation=0
-|  |  |     tuple-ids=29 row-size=8B cardinality=7.30K cost=146669
+|  |  |     tuple-ids=29 row-size=8B cardinality=7.30K cost=196669
 |  |  |     in pipelines: 41(GETNEXT)
 |  |  |
 |  |  40:SCAN HDFS [tpcds_parquet.web_sales, RANDOM]
@@ -3631,8 +3631,8 @@ max-parallelism=3 segment-costs=[1366, 833, 1] cpu-comparison-result=112 [max(6
 |  |       table: rows=719.38K size=45.09MB
 |  |       columns: all
 |  |     extrapolated-rows=disabled max-scan-range-rows=644.77K
-|  |     mem-estimate=32.00MB mem-reservation=4.00MB thread-reservation=0
-|  |     tuple-ids=28 row-size=12B cardinality=719.38K cost=8431
+|  |     mem-estimate=16.00MB mem-reservation=4.00MB thread-reservation=0
+|  |     tuple-ids=28 row-size=12B cardinality=719.38K cost=108431
 |  |     in pipelines: 40(GETNEXT)
 |  |
 |  |--39:HASH JOIN [INNER JOIN, BROADCAST]
@@ -3659,7 +3659,7 @@ max-parallelism=3 segment-costs=[1366, 833, 1] cpu-comparison-result=112 [max(6
 |  |  |  |
 |  |  |  F23:PLAN FRAGMENT [RANDOM] hosts=1 instances=1
 |  |  |  Per-Instance Resources: mem-estimate=16.05MB mem-reservation=512.00KB thread-reservation=1
-|  |  |  max-parallelism=1 segment-costs=[146755]
+|  |  |  max-parallelism=1 segment-costs=[196755]
 |  |  |  38:SCAN HDFS [tpcds_parquet.date_dim, RANDOM]
 |  |  |     HDFS partitions=1/1 files=1 size=2.15MB
 |  |  |     predicates: d_year <= CAST(2001 AS INT), d_year >= CAST(1999 AS INT)
@@ -3670,7 +3670,7 @@ max-parallelism=3 segment-costs=[1366, 833, 1] cpu-comparison-result=112 [max(6
 |  |  |     parquet statistics predicates: d_year <= CAST(2001 AS INT), d_year >= CAST(1999 AS INT)
 |  |  |     parquet dictionary predicates: d_year <= CAST(2001 AS INT), d_year >= CAST(1999 AS INT)
 |  |  |     mem-estimate=16.00MB mem-reservation=512.00KB thread-reservation=0
-|  |  |     tuple-ids=27 row-size=8B cardinality=7.30K cost=146669
+|  |  |     tuple-ids=27 row-size=8B cardinality=7.30K cost=196669
 |  |  |     in pipelines: 38(GETNEXT)
 |  |  |
 |  |  37:SCAN HDFS [tpcds_parquet.catalog_sales, RANDOM]
@@ -3680,8 +3680,8 @@ max-parallelism=3 segment-costs=[1366, 833, 1] cpu-comparison-result=112 [max(6
 |  |       table: rows=1.44M size=96.62MB
 |  |       columns: all
 |  |     extrapolated-rows=disabled max-scan-range-rows=650.14K
-|  |     mem-estimate=48.00MB mem-reservation=4.00MB thread-reservation=0
-|  |     tuple-ids=26 row-size=12B cardinality=1.44M cost=16894
+|  |     mem-estimate=16.00MB mem-reservation=4.00MB thread-reservation=0
+|  |     tuple-ids=26 row-size=12B cardinality=1.44M cost=166894
 |  |     in pipelines: 37(GETNEXT)
 |  |
 |  36:HASH JOIN [INNER JOIN, BROADCAST]
@@ -3707,7 +3707,7 @@ max-parallelism=3 segment-costs=[1366, 833, 1] cpu-comparison-result=112 [max(6
 |  |  |
 |  |  F21:PLAN FRAGMENT [RANDOM] hosts=1 instances=1
 |  |  Per-Instance Resources: mem-estimate=16.05MB mem-reservation=512.00KB thread-reservation=1
-|  |  max-parallelism=1 segment-costs=[146755]
+|  |  max-parallelism=1 segment-costs=[196755]
 |  |  35:SCAN HDFS [tpcds_parquet.date_dim, RANDOM]
 |  |     HDFS partitions=1/1 files=1 size=2.15MB
 |  |     predicates: d_year <= CAST(2001 AS INT), d_year >= CAST(1999 AS INT)
@@ -3718,7 +3718,7 @@ max-parallelism=3 segment-costs=[1366, 833, 1] cpu-comparison-result=112 [max(6
 |  |     parquet statistics predicates: d_year <= CAST(2001 AS INT), d_year >= CAST(1999 AS INT)
 |  |     parquet dictionary predicates: d_year <= CAST(2001 AS INT), d_year >= CAST(1999 AS INT)
 |  |     mem-estimate=16.00MB mem-reservation=512.00KB thread-reservation=0
-|  |     tuple-ids=25 row-size=8B cardinality=7.30K cost=146669
+|  |     tuple-ids=25 row-size=8B cardinality=7.30K cost=196669
 |  |     in pipelines: 35(GETNEXT)
 |  |
 |  34:SCAN HDFS [tpcds_parquet.store_sales, RANDOM]
@@ -3729,7 +3729,7 @@ max-parallelism=3 segment-costs=[1366, 833, 1] cpu-comparison-result=112 [max(6
 |       columns: all
 |     extrapolated-rows=disabled max-scan-range-rows=130.09K
 |     mem-estimate=16.00MB mem-reservation=512.00KB thread-reservation=0
-|     tuple-ids=24 row-size=12B cardinality=2.88M cost=33755
+|     tuple-ids=24 row-size=12B cardinality=2.88M cost=91233752
 |     in pipelines: 34(GETNEXT)
 |
 115:AGGREGATE [FINALIZE]
@@ -3744,10 +3744,10 @@ max-parallelism=3 segment-costs=[1366, 833, 1] cpu-comparison-result=112 [max(6
 |  tuple-ids=22 row-size=36B cardinality=271 cost=11
 |  in pipelines: 00(GETNEXT)
 |
-F00:PLAN FRAGMENT [RANDOM] hosts=3 instances=12
+F00:PLAN FRAGMENT [RANDOM] hosts=3 instances=12 (adjusted from 48)
 Per-Host Shared Resources: mem-estimate=3.00MB mem-reservation=3.00MB thread-reservation=0 runtime-filters-memory=3.00MB
 Per-Instance Resources: mem-estimate=26.94MB mem-reservation=3.00MB thread-reservation=1
-max-parallelism=12 segment-costs=[11579229, 11] cpu-comparison-result=44 [max(12 (self) vs 44 (sum children))]
+max-parallelism=12 segment-costs=[102779227, 11] cpu-comparison-result=44 [max(12 (self) vs 44 (sum children))]
 32:AGGREGATE [STREAMING]
 |  output: sum(CAST(ss_quantity AS DECIMAL(10,0)) * ss_list_price), count(*)
 |  group by: i_brand_id, i_class_id, i_category_id
@@ -3778,7 +3778,7 @@ max-parallelism=12 segment-costs=[11579229, 11] cpu-comparison-result=44 [max(12
 |  |
 |  F18:PLAN FRAGMENT [UNPARTITIONED] hosts=1 instances=1
 |  Per-Instance Resources: mem-estimate=80.00KB mem-reservation=0B thread-reservation=1
-|  max-parallelism=1 segment-costs=[1, 1]
+|  max-parallelism=2 segment-costs=[1, 1]
 |  26:CARDINALITY CHECK
 |  |  limit: 1
 |  |  mem-estimate=0B mem-reservation=0B thread-reservation=0
@@ -3793,7 +3793,7 @@ max-parallelism=12 segment-costs=[11579229, 11] cpu-comparison-result=44 [max(12
 |  |
 |  F17:PLAN FRAGMENT [RANDOM] hosts=1 instances=1
 |  Per-Instance Resources: mem-estimate=16.08MB mem-reservation=512.00KB thread-reservation=1
-|  max-parallelism=1 segment-costs=[220290]
+|  max-parallelism=1 segment-costs=[270290]
 |  25:SCAN HDFS [tpcds_parquet.date_dim, RANDOM]
 |     HDFS partitions=1/1 files=1 size=2.15MB
 |     predicates: d_year = CAST(2000 AS INT), d_dom = CAST(11 AS INT), d_moy = CAST(12 AS INT)
@@ -3805,7 +3805,7 @@ max-parallelism=12 segment-costs=[11579229, 11] cpu-comparison-result=44 [max(12
 |     parquet dictionary predicates: d_year = CAST(2000 AS INT), d_dom = CAST(11 AS INT), d_moy = CAST(12 AS INT)
 |     limit: 2
 |     mem-estimate=16.00MB mem-reservation=512.00KB thread-reservation=0
-|     tuple-ids=20 row-size=16B cardinality=2 cost=220289
+|     tuple-ids=20 row-size=16B cardinality=2 cost=270289
 |     in pipelines: 25(GETNEXT)
 |
 30:HASH JOIN [LEFT SEMI JOIN, BROADCAST]
@@ -3829,9 +3829,9 @@ max-parallelism=12 segment-costs=[11579229, 11] cpu-comparison-result=44 [max(12
 |  |  tuple-ids=91 row-size=8B cardinality=17.98K cost=633
 |  |  in pipelines: 110(GETNEXT)
 |  |
-|  F16:PLAN FRAGMENT [HASH(tpcds_parquet.item.i_item_sk)] hosts=3 instances=6 (adjusted from 12)
+|  F16:PLAN FRAGMENT [HASH(tpcds_parquet.item.i_item_sk)] hosts=3 instances=6 (adjusted from 48)
 |  Per-Instance Resources: mem-estimate=10.12MB mem-reservation=1.94MB thread-reservation=1
-|  max-parallelism=3 segment-costs=[18186, 211] cpu-comparison-result=33 [max(6 (self) vs 33 (sum children))]
+|  max-parallelism=6 segment-costs=[18186, 211] cpu-comparison-result=33 [max(6 (self) vs 33 (sum children))]
 |  110:AGGREGATE [FINALIZE]
 |  |  group by: tpcds_parquet.item.i_item_sk
 |  |  mem-estimate=10.00MB mem-reservation=1.94MB spill-buffer=64.00KB thread-reservation=0
@@ -3843,9 +3843,9 @@ max-parallelism=12 segment-costs=[11579229, 11] cpu-comparison-result=44 [max(12
 |  |  tuple-ids=91 row-size=8B cardinality=17.98K cost=211
 |  |  in pipelines: 97(GETNEXT)
 |  |
-|  F06:PLAN FRAGMENT [HASH(iss.i_brand_id,iss.i_class_id,iss.i_category_id)] hosts=3 instances=6 (adjusted from 12)
+|  F06:PLAN FRAGMENT [HASH(iss.i_brand_id,iss.i_class_id,iss.i_category_id)] hosts=3 instances=6 (adjusted from 48)
 |  Per-Instance Resources: mem-estimate=20.76MB mem-reservation=3.94MB thread-reservation=1
-|  max-parallelism=3 segment-costs=[448725, 1488000, 211] cpu-comparison-result=33 [max(6 (self) vs 33 (sum children))]
+|  max-parallelism=6 segment-costs=[448725, 1488000, 211] cpu-comparison-result=33 [max(6 (self) vs 33 (sum children))]
 |  29:AGGREGATE [STREAMING]
 |  |  group by: tpcds_parquet.item.i_item_sk
 |  |  mem-estimate=10.00MB mem-reservation=2.00MB spill-buffer=64.00KB thread-reservation=0
@@ -3860,7 +3860,7 @@ max-parallelism=12 segment-costs=[11579229, 11] cpu-comparison-result=44 [max(12
 |  |  tuple-ids=7,3 row-size=32B cardinality=148.80K cost=446400
 |  |  in pipelines: 97(GETNEXT), 03(OPEN)
 |  |
-|  |--F81:PLAN FRAGMENT [HASH(iss.i_brand_id,iss.i_class_id,iss.i_category_id)] hosts=3 instances=6 (adjusted from 12)
+|  |--F81:PLAN FRAGMENT [HASH(iss.i_brand_id,iss.i_class_id,iss.i_category_id)] hosts=3 instances=6 (adjusted from 48)
 |  |  |  Per-Instance Resources: mem-estimate=4.30MB mem-reservation=3.94MB thread-reservation=1 runtime-filters-memory=2.00MB
 |  |  |  max-parallelism=6 segment-costs=[54422]
 |  |  JOIN BUILD
@@ -3876,7 +3876,7 @@ max-parallelism=12 segment-costs=[11579229, 11] cpu-comparison-result=44 [max(12
 |  |  |
 |  |  F15:PLAN FRAGMENT [RANDOM] hosts=1 instances=1
 |  |  Per-Instance Resources: mem-estimate=16.56MB mem-reservation=256.00KB thread-reservation=1
-|  |  max-parallelism=1 segment-costs=[774]
+|  |  max-parallelism=1 segment-costs=[50774]
 |  |  03:SCAN HDFS [tpcds_parquet.item, RANDOM]
 |  |     HDFS partitions=1/1 files=1 size=1.73MB
 |  |     stored statistics:
@@ -3884,7 +3884,7 @@ max-parallelism=12 segment-costs=[11579229, 11] cpu-comparison-result=44 [max(12
 |  |       columns: all
 |  |     extrapolated-rows=disabled max-scan-range-rows=18.00K
 |  |     mem-estimate=16.00MB mem-reservation=256.00KB thread-reservation=0
-|  |     tuple-ids=3 row-size=20B cardinality=18.00K cost=352
+|  |     tuple-ids=3 row-size=20B cardinality=18.00K cost=50352
 |  |     in pipelines: 03(GETNEXT)
 |  |
 |  23:HASH JOIN [LEFT SEMI JOIN, PARTITIONED]
@@ -3894,7 +3894,7 @@ max-parallelism=12 segment-costs=[11579229, 11] cpu-comparison-result=44 [max(12
 |  |  tuple-ids=7 row-size=12B cardinality=148.80K cost=446400
 |  |  in pipelines: 97(GETNEXT), 106(OPEN)
 |  |
-|  |--F82:PLAN FRAGMENT [HASH(iss.i_brand_id,iss.i_class_id,iss.i_category_id)] hosts=3 instances=6 (adjusted from 12)
+|  |--F82:PLAN FRAGMENT [HASH(iss.i_brand_id,iss.i_class_id,iss.i_category_id)] hosts=3 instances=6 (adjusted from 48)
 |  |  |  Per-Instance Resources: mem-estimate=2.85MB mem-reservation=1.94MB thread-reservation=1
 |  |  |  max-parallelism=6 segment-costs=[448725] cpu-comparison-result=6 [max(6 (self) vs 6 (sum children))]
 |  |  JOIN BUILD
@@ -3909,7 +3909,7 @@ max-parallelism=12 segment-costs=[11579229, 11] cpu-comparison-result=44 [max(12
 |  |  |
 |  |  F14:PLAN FRAGMENT [HASH(iws.i_brand_id,iws.i_class_id,iws.i_category_id)] hosts=2 instances=4 (adjusted from 2)
 |  |  Per-Instance Resources: mem-estimate=10.88MB mem-reservation=1.94MB thread-reservation=1
-|  |  max-parallelism=2 segment-costs=[448725, 2325] cpu-comparison-result=6 [max(4 (self) vs 6 (sum children))]
+|  |  max-parallelism=4 segment-costs=[448725, 2325] cpu-comparison-result=6 [max(4 (self) vs 6 (sum children))]
 |  |  106:AGGREGATE [FINALIZE]
 |  |  |  group by: iws.i_brand_id, iws.i_class_id, iws.i_category_id
 |  |  |  mem-estimate=10.00MB mem-reservation=1.94MB spill-buffer=64.00KB thread-reservation=0
@@ -3922,8 +3922,8 @@ max-parallelism=12 segment-costs=[11579229, 11] cpu-comparison-result=44 [max(12
 |  |  |  in pipelines: 15(GETNEXT)
 |  |  |
 |  |  F11:PLAN FRAGMENT [RANDOM] hosts=2 instances=2
-|  |  Per-Instance Resources: mem-estimate=42.25MB mem-reservation=9.00MB thread-reservation=1
-|  |  max-parallelism=2 segment-costs=[3605351, 2325] cpu-comparison-result=6 [max(2 (self) vs 6 (sum children))]
+|  |  Per-Instance Resources: mem-estimate=26.25MB mem-reservation=9.00MB thread-reservation=1
+|  |  max-parallelism=2 segment-costs=[3705351, 2325] cpu-comparison-result=6 [max(2 (self) vs 6 (sum children))]
 |  |  22:AGGREGATE [STREAMING]
 |  |  |  group by: iws.i_brand_id, iws.i_class_id, iws.i_category_id
 |  |  |  mem-estimate=10.00MB mem-reservation=5.00MB spill-buffer=256.00KB thread-reservation=0
@@ -3939,13 +3939,13 @@ max-parallelism=12 segment-costs=[11579229, 11] cpu-comparison-result=44 [max(12
 |  |  |  in pipelines: 15(GETNEXT), 17(OPEN)
 |  |  |
 |  |  |--F83:PLAN FRAGMENT [RANDOM] hosts=2 instances=2
-|  |  |  |  Per-Instance Resources: mem-estimate=7.82MB mem-reservation=7.75MB thread-reservation=1
+|  |  |  |  Per-Instance Resources: mem-estimate=2.00MB mem-reservation=1.94MB thread-reservation=1
 |  |  |  |  max-parallelism=2 segment-costs=[7477]
 |  |  |  JOIN BUILD
 |  |  |  |  join-table-id=26 plan-id=27 cohort-id=09
 |  |  |  |  build expressions: d3.d_date_sk
 |  |  |  |  runtime filters: RF035[min_max] <- d3.d_date_sk
-|  |  |  |  mem-estimate=7.75MB mem-reservation=7.75MB spill-buffer=64.00KB thread-reservation=0 cost=7305
+|  |  |  |  mem-estimate=1.94MB mem-reservation=1.94MB spill-buffer=64.00KB thread-reservation=0 cost=7305
 |  |  |  |
 |  |  |  104:EXCHANGE [BROADCAST]
 |  |  |  |  mem-estimate=69.07KB mem-reservation=0B thread-reservation=0
@@ -3954,7 +3954,7 @@ max-parallelism=12 segment-costs=[11579229, 11] cpu-comparison-result=44 [max(12
 |  |  |  |
 |  |  |  F13:PLAN FRAGMENT [RANDOM] hosts=1 instances=1
 |  |  |  Per-Instance Resources: mem-estimate=16.05MB mem-reservation=512.00KB thread-reservation=1
-|  |  |  max-parallelism=1 segment-costs=[146755]
+|  |  |  max-parallelism=1 segment-costs=[196755]
 |  |  |  17:SCAN HDFS [tpcds_parquet.date_dim d3, RANDOM]
 |  |  |     HDFS partitions=1/1 files=1 size=2.15MB
 |  |  |     predicates: d3.d_year <= CAST(2001 AS INT), d3.d_year >= CAST(1999 AS INT)
@@ -3965,7 +3965,7 @@ max-parallelism=12 segment-costs=[11579229, 11] cpu-comparison-result=44 [max(12
 |  |  |     parquet statistics predicates: d3.d_year <= CAST(2001 AS INT), d3.d_year >= CAST(1999 AS INT)
 |  |  |     parquet dictionary predicates: d3.d_year <= CAST(2001 AS INT), d3.d_year >= CAST(1999 AS INT)
 |  |  |     mem-estimate=16.00MB mem-reservation=512.00KB thread-reservation=0
-|  |  |     tuple-ids=15 row-size=8B cardinality=7.30K cost=146669
+|  |  |     tuple-ids=15 row-size=8B cardinality=7.30K cost=196669
 |  |  |     in pipelines: 17(GETNEXT)
 |  |  |
 |  |  18:HASH JOIN [INNER JOIN, BROADCAST]
@@ -3977,13 +3977,13 @@ max-parallelism=12 segment-costs=[11579229, 11] cpu-comparison-result=44 [max(12
 |  |  |  in pipelines: 15(GETNEXT), 16(OPEN)
 |  |  |
 |  |  |--F84:PLAN FRAGMENT [RANDOM] hosts=2 instances=2
-|  |  |  |  Per-Instance Resources: mem-estimate=8.12MB mem-reservation=7.75MB thread-reservation=1
+|  |  |  |  Per-Instance Resources: mem-estimate=2.30MB mem-reservation=1.94MB thread-reservation=1
 |  |  |  |  max-parallelism=2 segment-costs=[18844]
 |  |  |  JOIN BUILD
 |  |  |  |  join-table-id=27 plan-id=28 cohort-id=09
 |  |  |  |  build expressions: iws.i_item_sk
 |  |  |  |  runtime filters: RF037[min_max] <- iws.i_item_sk
-|  |  |  |  mem-estimate=7.75MB mem-reservation=7.75MB spill-buffer=64.00KB thread-reservation=0 cost=18000
+|  |  |  |  mem-estimate=1.94MB mem-reservation=1.94MB spill-buffer=64.00KB thread-reservation=0 cost=18000
 |  |  |  |
 |  |  |  103:EXCHANGE [BROADCAST]
 |  |  |  |  mem-estimate=375.56KB mem-reservation=0B thread-reservation=0
@@ -3992,7 +3992,7 @@ max-parallelism=12 segment-costs=[11579229, 11] cpu-comparison-result=44 [max(12
 |  |  |  |
 |  |  |  F12:PLAN FRAGMENT [RANDOM] hosts=1 instances=1
 |  |  |  Per-Instance Resources: mem-estimate=16.09MB mem-reservation=256.00KB thread-reservation=1
-|  |  |  max-parallelism=1 segment-costs=[774]
+|  |  |  max-parallelism=1 segment-costs=[50774]
 |  |  |  16:SCAN HDFS [tpcds_parquet.item iws, RANDOM]
 |  |  |     HDFS partitions=1/1 files=1 size=1.73MB
 |  |  |     stored statistics:
@@ -4000,7 +4000,7 @@ max-parallelism=12 segment-costs=[11579229, 11] cpu-comparison-result=44 [max(12
 |  |  |       columns: all
 |  |  |     extrapolated-rows=disabled max-scan-range-rows=18.00K
 |  |  |     mem-estimate=16.00MB mem-reservation=256.00KB thread-reservation=0
-|  |  |     tuple-ids=14 row-size=20B cardinality=18.00K cost=352
+|  |  |     tuple-ids=14 row-size=20B cardinality=18.00K cost=50352
 |  |  |     in pipelines: 16(GETNEXT)
 |  |  |
 |  |  15:SCAN HDFS [tpcds_parquet.web_sales, RANDOM]
@@ -4010,8 +4010,8 @@ max-parallelism=12 segment-costs=[11579229, 11] cpu-comparison-result=44 [max(12
 |  |       table: rows=719.38K size=45.09MB
 |  |       columns: all
 |  |     extrapolated-rows=disabled max-scan-range-rows=644.77K
-|  |     mem-estimate=32.00MB mem-reservation=4.00MB thread-reservation=0
-|  |     tuple-ids=13 row-size=12B cardinality=719.38K cost=8431
+|  |     mem-estimate=16.00MB mem-reservation=4.00MB thread-reservation=0
+|  |     tuple-ids=13 row-size=12B cardinality=719.38K cost=108431
 |  |     in pipelines: 15(GETNEXT)
 |  |
 |  21:HASH JOIN [LEFT SEMI JOIN, PARTITIONED]
@@ -4021,7 +4021,7 @@ max-parallelism=12 segment-costs=[11579229, 11] cpu-comparison-result=44 [max(12
 |  |  tuple-ids=7 row-size=12B cardinality=148.80K cost=446400
 |  |  in pipelines: 97(GETNEXT), 101(OPEN)
 |  |
-|  |--F85:PLAN FRAGMENT [HASH(iss.i_brand_id,iss.i_class_id,iss.i_category_id)] hosts=3 instances=6 (adjusted from 12)
+|  |--F85:PLAN FRAGMENT [HASH(iss.i_brand_id,iss.i_class_id,iss.i_category_id)] hosts=3 instances=6 (adjusted from 48)
 |  |  |  Per-Instance Resources: mem-estimate=2.60MB mem-reservation=1.94MB thread-reservation=1
 |  |  |  max-parallelism=6 segment-costs=[448725] cpu-comparison-result=8 [max(6 (self) vs 8 (sum children))]
 |  |  JOIN BUILD
@@ -4036,7 +4036,7 @@ max-parallelism=12 segment-costs=[11579229, 11] cpu-comparison-result=44 [max(12
 |  |  |
 |  |  F10:PLAN FRAGMENT [HASH(ics.i_brand_id,ics.i_class_id,ics.i_category_id)] hosts=3 instances=6 (adjusted from 3)
 |  |  Per-Instance Resources: mem-estimate=10.61MB mem-reservation=1.94MB thread-reservation=1
-|  |  max-parallelism=3 segment-costs=[448725, 2325] cpu-comparison-result=8 [max(6 (self) vs 8 (sum children))]
+|  |  max-parallelism=6 segment-costs=[448725, 2325] cpu-comparison-result=8 [max(6 (self) vs 8 (sum children))]
 |  |  101:AGGREGATE [FINALIZE]
 |  |  |  group by: ics.i_brand_id, ics.i_class_id, ics.i_category_id
 |  |  |  mem-estimate=10.00MB mem-reservation=1.94MB spill-buffer=64.00KB thread-reservation=0
@@ -4049,8 +4049,8 @@ max-parallelism=12 segment-costs=[11579229, 11] cpu-comparison-result=44 [max(12
 |  |  |  in pipelines: 10(GETNEXT)
 |  |  |
 |  |  F07:PLAN FRAGMENT [RANDOM] hosts=3 instances=3
-|  |  Per-Instance Resources: mem-estimate=58.38MB mem-reservation=9.00MB thread-reservation=1
-|  |  max-parallelism=3 segment-costs=[7224634, 2325] cpu-comparison-result=8 [max(3 (self) vs 8 (sum children))]
+|  |  Per-Instance Resources: mem-estimate=26.38MB mem-reservation=9.00MB thread-reservation=1
+|  |  max-parallelism=3 segment-costs=[7374634, 2325] cpu-comparison-result=8 [max(3 (self) vs 8 (sum children))]
 |  |  20:AGGREGATE [STREAMING]
 |  |  |  group by: ics.i_brand_id, ics.i_class_id, ics.i_category_id
 |  |  |  mem-estimate=10.00MB mem-reservation=5.00MB spill-buffer=256.00KB thread-reservation=0
@@ -4066,13 +4066,13 @@ max-parallelism=12 segment-costs=[11579229, 11] cpu-comparison-result=44 [max(12
 |  |  |  in pipelines: 10(GETNEXT), 12(OPEN)
 |  |  |
 |  |  |--F86:PLAN FRAGMENT [RANDOM] hosts=3 instances=3
-|  |  |  |  Per-Instance Resources: mem-estimate=7.82MB mem-reservation=7.75MB thread-reservation=1
+|  |  |  |  Per-Instance Resources: mem-estimate=2.00MB mem-reservation=1.94MB thread-reservation=1
 |  |  |  |  max-parallelism=3 segment-costs=[7563]
 |  |  |  JOIN BUILD
 |  |  |  |  join-table-id=29 plan-id=30 cohort-id=10
 |  |  |  |  build expressions: d2.d_date_sk
 |  |  |  |  runtime filters: RF031[min_max] <- d2.d_date_sk
-|  |  |  |  mem-estimate=7.75MB mem-reservation=7.75MB spill-buffer=64.00KB thread-reservation=0 cost=7305
+|  |  |  |  mem-estimate=1.94MB mem-reservation=1.94MB spill-buffer=64.00KB thread-reservation=0 cost=7305
 |  |  |  |
 |  |  |  99:EXCHANGE [BROADCAST]
 |  |  |  |  mem-estimate=69.07KB mem-reservation=0B thread-reservation=0
@@ -4081,7 +4081,7 @@ max-parallelism=12 segment-costs=[11579229, 11] cpu-comparison-result=44 [max(12
 |  |  |  |
 |  |  |  F09:PLAN FRAGMENT [RANDOM] hosts=1 instances=1
 |  |  |  Per-Instance Resources: mem-estimate=16.05MB mem-reservation=512.00KB thread-reservation=1
-|  |  |  max-parallelism=1 segment-costs=[146755]
+|  |  |  max-parallelism=1 segment-costs=[196755]
 |  |  |  12:SCAN HDFS [tpcds_parquet.date_dim d2, RANDOM]
 |  |  |     HDFS partitions=1/1 files=1 size=2.15MB
 |  |  |     predicates: d2.d_year <= CAST(2001 AS INT), d2.d_year >= CAST(1999 AS INT)
@@ -4092,7 +4092,7 @@ max-parallelism=12 segment-costs=[11579229, 11] cpu-comparison-result=44 [max(12
 |  |  |     parquet statistics predicates: d2.d_year <= CAST(2001 AS INT), d2.d_year >= CAST(1999 AS INT)
 |  |  |     parquet dictionary predicates: d2.d_year <= CAST(2001 AS INT), d2.d_year >= CAST(1999 AS INT)
 |  |  |     mem-estimate=16.00MB mem-reservation=512.00KB thread-reservation=0
-|  |  |     tuple-ids=11 row-size=8B cardinality=7.30K cost=146669
+|  |  |     tuple-ids=11 row-size=8B cardinality=7.30K cost=196669
 |  |  |     in pipelines: 12(GETNEXT)
 |  |  |
 |  |  13:HASH JOIN [INNER JOIN, BROADCAST]
@@ -4104,13 +4104,13 @@ max-parallelism=12 segment-costs=[11579229, 11] cpu-comparison-result=44 [max(12
 |  |  |  in pipelines: 10(GETNEXT), 11(OPEN)
 |  |  |
 |  |  |--F87:PLAN FRAGMENT [RANDOM] hosts=3 instances=3
-|  |  |  |  Per-Instance Resources: mem-estimate=8.12MB mem-reservation=7.75MB thread-reservation=1
+|  |  |  |  Per-Instance Resources: mem-estimate=2.30MB mem-reservation=1.94MB thread-reservation=1
 |  |  |  |  max-parallelism=3 segment-costs=[19266]
 |  |  |  JOIN BUILD
 |  |  |  |  join-table-id=30 plan-id=31 cohort-id=10
 |  |  |  |  build expressions: ics.i_item_sk
 |  |  |  |  runtime filters: RF033[min_max] <- ics.i_item_sk
-|  |  |  |  mem-estimate=7.75MB mem-reservation=7.75MB spill-buffer=64.00KB thread-reservation=0 cost=18000
+|  |  |  |  mem-estimate=1.94MB mem-reservation=1.94MB spill-buffer=64.00KB thread-reservation=0 cost=18000
 |  |  |  |
 |  |  |  98:EXCHANGE [BROADCAST]
 |  |  |  |  mem-estimate=375.56KB mem-reservation=0B thread-reservation=0
@@ -4119,7 +4119,7 @@ max-parallelism=12 segment-costs=[11579229, 11] cpu-comparison-result=44 [max(12
 |  |  |  |
 |  |  |  F08:PLAN FRAGMENT [RANDOM] hosts=1 instances=1
 |  |  |  Per-Instance Resources: mem-estimate=16.09MB mem-reservation=256.00KB thread-reservation=1
-|  |  |  max-parallelism=1 segment-costs=[774]
+|  |  |  max-parallelism=1 segment-costs=[50774]
 |  |  |  11:SCAN HDFS [tpcds_parquet.item ics, RANDOM]
 |  |  |     HDFS partitions=1/1 files=1 size=1.73MB
 |  |  |     stored statistics:
@@ -4127,7 +4127,7 @@ max-parallelism=12 segment-costs=[11579229, 11] cpu-comparison-result=44 [max(12
 |  |  |       columns: all
 |  |  |     extrapolated-rows=disabled max-scan-range-rows=18.00K
 |  |  |     mem-estimate=16.00MB mem-reservation=256.00KB thread-reservation=0
-|  |  |     tuple-ids=10 row-size=20B cardinality=18.00K cost=352
+|  |  |     tuple-ids=10 row-size=20B cardinality=18.00K cost=50352
 |  |  |     in pipelines: 11(GETNEXT)
 |  |  |
 |  |  10:SCAN HDFS [tpcds_parquet.catalog_sales, RANDOM]
@@ -4137,8 +4137,8 @@ max-parallelism=12 segment-costs=[11579229, 11] cpu-comparison-result=44 [max(12
 |  |       table: rows=1.44M size=96.62MB
 |  |       columns: all
 |  |     extrapolated-rows=disabled max-scan-range-rows=650.14K
-|  |     mem-estimate=48.00MB mem-reservation=4.00MB thread-reservation=0
-|  |     tuple-ids=9 row-size=12B cardinality=1.44M cost=16894
+|  |     mem-estimate=16.00MB mem-reservation=4.00MB thread-reservation=0
+|  |     tuple-ids=9 row-size=12B cardinality=1.44M cost=166894
 |  |     in pipelines: 10(GETNEXT)
 |  |
 |  97:AGGREGATE [FINALIZE]
@@ -4152,9 +4152,9 @@ max-parallelism=12 segment-costs=[11579229, 11] cpu-comparison-result=44 [max(12
 |  |  tuple-ids=7 row-size=12B cardinality=148.80K cost=2325
 |  |  in pipelines: 04(GETNEXT)
 |  |
-|  F03:PLAN FRAGMENT [RANDOM] hosts=3 instances=12
+|  F03:PLAN FRAGMENT [RANDOM] hosts=3 instances=12 (adjusted from 48)
 |  Per-Instance Resources: mem-estimate=26.38MB mem-reservation=5.50MB thread-reservation=1
-|  max-parallelism=12 segment-costs=[14435775, 2325] cpu-comparison-result=12 [max(12 (self) vs 8 (sum children))]
+|  max-parallelism=12 segment-costs=[105635772, 2325] cpu-comparison-result=12 [max(12 (self) vs 8 (sum children))]
 |  09:AGGREGATE [STREAMING]
 |  |  group by: iss.i_brand_id, iss.i_class_id, iss.i_category_id
 |  |  mem-estimate=10.00MB mem-reservation=5.00MB spill-buffer=256.00KB thread-reservation=0
@@ -4184,7 +4184,7 @@ max-parallelism=12 segment-costs=[11579229, 11] cpu-comparison-result=44 [max(12
 |  |  |
 |  |  F05:PLAN FRAGMENT [RANDOM] hosts=1 instances=1
 |  |  Per-Instance Resources: mem-estimate=16.05MB mem-reservation=512.00KB thread-reservation=1
-|  |  max-parallelism=1 segment-costs=[146755]
+|  |  max-parallelism=1 segment-costs=[196755]
 |  |  06:SCAN HDFS [tpcds_parquet.date_dim d1, RANDOM]
 |  |     HDFS partitions=1/1 files=1 size=2.15MB
 |  |     predicates: d1.d_year <= CAST(2001 AS INT), d1.d_year >= CAST(1999 AS INT)
@@ -4195,7 +4195,7 @@ max-parallelism=12 segment-costs=[11579229, 11] cpu-comparison-result=44 [max(12
 |  |     parquet statistics predicates: d1.d_year <= CAST(2001 AS INT), d1.d_year >= CAST(1999 AS INT)
 |  |     parquet dictionary predicates: d1.d_year <= CAST(2001 AS INT), d1.d_year >= CAST(1999 AS INT)
 |  |     mem-estimate=16.00MB mem-reservation=512.00KB thread-reservation=0
-|  |     tuple-ids=6 row-size=8B cardinality=7.30K cost=146669
+|  |     tuple-ids=6 row-size=8B cardinality=7.30K cost=196669
 |  |     in pipelines: 06(GETNEXT)
 |  |
 |  07:HASH JOIN [INNER JOIN, BROADCAST]
@@ -4223,7 +4223,7 @@ max-parallelism=12 segment-costs=[11579229, 11] cpu-comparison-result=44 [max(12
 |  |  F04:PLAN FRAGMENT [RANDOM] hosts=1 instances=1
 |  |  Per-Host Shared Resources: mem-estimate=2.00MB mem-reservation=2.00MB thread-reservation=0 runtime-filters-memory=2.00MB
 |  |  Per-Instance Resources: mem-estimate=16.09MB mem-reservation=256.00KB thread-reservation=1
-|  |  max-parallelism=1 segment-costs=[774]
+|  |  max-parallelism=1 segment-costs=[50774]
 |  |  05:SCAN HDFS [tpcds_parquet.item iss, RANDOM]
 |  |     HDFS partitions=1/1 files=1 size=1.73MB
 |  |     runtime filters: RF017[min_max] -> iss.i_brand_id, RF018[min_max] -> iss.i_category_id, RF019[min_max] -> iss.i_class_id, RF014[bloom] -> iss.i_brand_id, RF015[bloom] -> iss.i_category_id
@@ -4232,7 +4232,7 @@ max-parallelism=12 segment-costs=[11579229, 11] cpu-comparison-result=44 [max(12
 |  |       columns: all
 |  |     extrapolated-rows=disabled max-scan-range-rows=18.00K
 |  |     mem-estimate=16.00MB mem-reservation=256.00KB thread-reservation=0
-|  |     tuple-ids=5 row-size=20B cardinality=18.00K cost=352
+|  |     tuple-ids=5 row-size=20B cardinality=18.00K cost=50352
 |  |     in pipelines: 05(GETNEXT)
 |  |
 |  04:SCAN HDFS [tpcds_parquet.store_sales, RANDOM]
@@ -4244,7 +4244,7 @@ max-parallelism=12 segment-costs=[11579229, 11] cpu-comparison-result=44 [max(12
 |       columns: all
 |     extrapolated-rows=disabled max-scan-range-rows=130.09K
 |     mem-estimate=16.00MB mem-reservation=512.00KB thread-reservation=0
-|     tuple-ids=4 row-size=12B cardinality=2.88M cost=33755
+|     tuple-ids=4 row-size=12B cardinality=2.88M cost=91233752
 |     in pipelines: 04(GETNEXT)
 |
 28:HASH JOIN [INNER JOIN, BROADCAST]
@@ -4272,7 +4272,7 @@ max-parallelism=12 segment-costs=[11579229, 11] cpu-comparison-result=44 [max(12
 |  F02:PLAN FRAGMENT [RANDOM] hosts=1 instances=1
 |  Per-Host Shared Resources: mem-estimate=1.00MB mem-reservation=1.00MB thread-reservation=0 runtime-filters-memory=1.00MB
 |  Per-Instance Resources: mem-estimate=16.05MB mem-reservation=512.00KB thread-reservation=1
-|  max-parallelism=1 segment-costs=[1428]
+|  max-parallelism=1 segment-costs=[51428]
 |  02:SCAN HDFS [tpcds_parquet.date_dim, RANDOM]
 |     HDFS partitions=1/1 files=1 size=2.15MB
 |     runtime filters: RF007[min_max] -> d_week_seq, RF006[bloom] -> d_week_seq
@@ -4281,7 +4281,7 @@ max-parallelism=12 segment-costs=[11579229, 11] cpu-comparison-result=44 [max(12
 |       columns: all
 |     extrapolated-rows=disabled max-scan-range-rows=73.05K
 |     mem-estimate=16.00MB mem-reservation=512.00KB thread-reservation=0
-|     tuple-ids=2 row-size=8B cardinality=73.05K cost=571
+|     tuple-ids=2 row-size=8B cardinality=73.05K cost=50571
 |     in pipelines: 02(GETNEXT)
 |
 27:HASH JOIN [INNER JOIN, BROADCAST]
@@ -4309,7 +4309,7 @@ max-parallelism=12 segment-costs=[11579229, 11] cpu-comparison-result=44 [max(12
 |  F01:PLAN FRAGMENT [RANDOM] hosts=1 instances=1
 |  Per-Host Shared Resources: mem-estimate=4.00MB mem-reservation=4.00MB thread-reservation=0 runtime-filters-memory=4.00MB
 |  Per-Instance Resources: mem-estimate=16.09MB mem-reservation=256.00KB thread-reservation=1
-|  max-parallelism=1 segment-costs=[774]
+|  max-parallelism=1 segment-costs=[50774]
 |  01:SCAN HDFS [tpcds_parquet.item, RANDOM]
 |     HDFS partitions=1/1 files=1 size=1.73MB
 |     runtime filters: RF003[min_max] -> tpcds_parquet.item.i_brand_id, RF004[min_max] -> tpcds_parquet.item.i_category_id, RF005[min_max] -> tpcds_parquet.item.i_class_id, RF009[min_max] -> tpcds_parquet.item.i_item_sk, RF000[bloom] -> tpcds_parquet.item.i_brand_id, RF001[bloom] -> tpcds_parquet.item.i_category_id, RF002[bloom] -> tpcds_parquet.item.i_class_id, RF008[bloom] -> tpcds_parquet.item.i_item_sk
@@ -4318,7 +4318,7 @@ max-parallelism=12 segment-costs=[11579229, 11] cpu-comparison-result=44 [max(12
 |       columns: all
 |     extrapolated-rows=disabled max-scan-range-rows=18.00K
 |     mem-estimate=16.00MB mem-reservation=256.00KB thread-reservation=0
-|     tuple-ids=1 row-size=20B cardinality=18.00K cost=352
+|     tuple-ids=1 row-size=20B cardinality=18.00K cost=50352
 |     in pipelines: 01(GETNEXT)
 |
 00:SCAN HDFS [tpcds_parquet.store_sales, RANDOM]
@@ -4330,7 +4330,7 @@ max-parallelism=12 segment-costs=[11579229, 11] cpu-comparison-result=44 [max(12
      columns: all
    extrapolated-rows=disabled max-scan-range-rows=130.09K
    mem-estimate=16.00MB mem-reservation=1.00MB thread-reservation=0
-   tuple-ids=0 row-size=20B cardinality=2.88M cost=56258
+   tuple-ids=0 row-size=20B cardinality=2.88M cost=91256256
    in pipelines: 00(GETNEXT)
 ====
 # TPCDS-Q23-1 First of two queries.
@@ -4384,8 +4384,8 @@ from
          and ws_bill_customer_sk in (select c_customer_sk from best_ss_customer)) y
  limit 100;
 ---- PARALLELPLANS
-Max Per-Host Resource Reservation: Memory=650.75MB Threads=81
-Per-Host Resource Estimates: Memory=1.53GB
+Max Per-Host Resource Reservation: Memory=627.50MB Threads=81
+Per-Host Resource Estimates: Memory=1.46GB
 F31:PLAN FRAGMENT [UNPARTITIONED] hosts=1 instances=1
 |  Per-Instance Resources: mem-estimate=32.00KB mem-reservation=0B thread-reservation=1
 |  max-parallelism=1 segment-costs=[2, 0] cpu-comparison-result=79 [max(1 (self) vs 79 (sum children))]
@@ -4405,7 +4405,7 @@ PLAN-ROOT SINK
 |  tuple-ids=46 row-size=16B cardinality=1 cost=1
 |  in pipelines: 49(GETNEXT)
 |
-F30:PLAN FRAGMENT [RANDOM] hosts=3 instances=12
+F30:PLAN FRAGMENT [RANDOM] hosts=3 instances=12 (adjusted from 48)
 Per-Instance Resources: mem-estimate=10.93MB mem-reservation=1.94MB thread-reservation=1
 max-parallelism=12 segment-costs=[202344, 202344, 584489, 1] cpu-comparison-result=79 [max(12 (self) vs 79 (sum children))]
 49:AGGREGATE
@@ -4426,7 +4426,7 @@ max-parallelism=12 segment-costs=[202344, 202344, 584489, 1] cpu-comparison-resu
 |  |  tuple-ids=22,23 row-size=36B cardinality=42.85K cost=100000
 |  |  in pipelines: 71(GETNEXT), 25(OPEN)
 |  |
-|  |--F40:PLAN FRAGMENT [RANDOM] hosts=3 instances=12
+|  |--F40:PLAN FRAGMENT [RANDOM] hosts=3 instances=12 (adjusted from 48)
 |  |  |  Per-Instance Resources: mem-estimate=3.76MB mem-reservation=2.94MB thread-reservation=1 runtime-filters-memory=1.00MB
 |  |  |  max-parallelism=12 segment-costs=[44696] cpu-comparison-result=15 [max(14 (self) vs 15 (sum children))]
 |  |  JOIN BUILD
@@ -4442,8 +4442,8 @@ max-parallelism=12 segment-costs=[202344, 202344, 584489, 1] cpu-comparison-resu
 |  |  |
 |  |  F23:PLAN FRAGMENT [RANDOM] hosts=2 instances=2
 |  |  Per-Host Shared Resources: mem-estimate=1.00MB mem-reservation=1.00MB thread-reservation=0 runtime-filters-memory=1.00MB
-|  |  Per-Instance Resources: mem-estimate=34.06MB mem-reservation=8.00MB thread-reservation=1
-|  |  max-parallelism=2 segment-costs=[780941]
+|  |  Per-Instance Resources: mem-estimate=18.06MB mem-reservation=8.00MB thread-reservation=1
+|  |  max-parallelism=2 segment-costs=[880941]
 |  |  47:HASH JOIN [LEFT SEMI JOIN, BROADCAST]
 |  |  |  hash-table-id=09
 |  |  |  hash predicates: ws_item_sk = i_item_sk
@@ -4452,22 +4452,22 @@ max-parallelism=12 segment-costs=[202344, 202344, 584489, 1] cpu-comparison-resu
 |  |  |  in pipelines: 25(GETNEXT), 85(OPEN)
 |  |  |
 |  |  |--F41:PLAN FRAGMENT [RANDOM] hosts=2 instances=2
-|  |  |  |  Per-Instance Resources: mem-estimate=7.96MB mem-reservation=7.75MB thread-reservation=1
+|  |  |  |  Per-Instance Resources: mem-estimate=2.14MB mem-reservation=1.94MB thread-reservation=1
 |  |  |  |  max-parallelism=2 segment-costs=[18397] cpu-comparison-result=12 [max(2 (self) vs 12 (sum children))]
 |  |  |  JOIN BUILD
 |  |  |  |  join-table-id=09 plan-id=10 cohort-id=05
 |  |  |  |  build expressions: i_item_sk
 |  |  |  |  runtime filters: RF025[min_max] <- i_item_sk
-|  |  |  |  mem-estimate=7.75MB mem-reservation=7.75MB spill-buffer=64.00KB thread-reservation=0 cost=17975
+|  |  |  |  mem-estimate=1.94MB mem-reservation=1.94MB spill-buffer=64.00KB thread-reservation=0 cost=17975
 |  |  |  |
 |  |  |  86:EXCHANGE [BROADCAST]
 |  |  |  |  mem-estimate=212.43KB mem-reservation=0B thread-reservation=0
 |  |  |  |  tuple-ids=68 row-size=8B cardinality=17.98K cost=422
 |  |  |  |  in pipelines: 85(GETNEXT)
 |  |  |  |
-|  |  |  F29:PLAN FRAGMENT [HASH(i_item_sk)] hosts=3 instances=6 (adjusted from 12)
+|  |  |  F29:PLAN FRAGMENT [HASH(i_item_sk)] hosts=3 instances=6 (adjusted from 48)
 |  |  |  Per-Instance Resources: mem-estimate=10.12MB mem-reservation=1.94MB thread-reservation=1
-|  |  |  max-parallelism=3 segment-costs=[18186, 211] cpu-comparison-result=12 [max(6 (self) vs 12 (sum children))]
+|  |  |  max-parallelism=6 segment-costs=[18186, 211] cpu-comparison-result=12 [max(6 (self) vs 12 (sum children))]
 |  |  |  85:AGGREGATE [FINALIZE]
 |  |  |  |  group by: i_item_sk
 |  |  |  |  mem-estimate=10.00MB mem-reservation=1.94MB spill-buffer=64.00KB thread-reservation=0
@@ -4479,9 +4479,9 @@ max-parallelism=12 segment-costs=[202344, 202344, 584489, 1] cpu-comparison-resu
 |  |  |  |  tuple-ids=68 row-size=8B cardinality=17.98K cost=211
 |  |  |  |  in pipelines: 83(GETNEXT)
 |  |  |  |
-|  |  |  F28:PLAN FRAGMENT [HASH(substr(i_item_desc, 1, 30),i_item_sk,d_date)] hosts=3 instances=6 (adjusted from 12)
+|  |  |  F28:PLAN FRAGMENT [HASH(substr(i_item_desc, 1, 30),i_item_sk,d_date)] hosts=3 instances=6 (adjusted from 48)
 |  |  |  Per-Instance Resources: mem-estimate=54.63MB mem-reservation=36.00MB thread-reservation=1
-|  |  |  max-parallelism=3 segment-costs=[9542330, 235454, 211] cpu-comparison-result=12 [max(6 (self) vs 12 (sum children))]
+|  |  |  max-parallelism=6 segment-costs=[9542330, 235454, 211] cpu-comparison-result=12 [max(6 (self) vs 12 (sum children))]
 |  |  |  46:AGGREGATE [STREAMING]
 |  |  |  |  group by: i_item_sk
 |  |  |  |  mem-estimate=10.00MB mem-reservation=2.00MB spill-buffer=64.00KB thread-reservation=0
@@ -4501,10 +4501,10 @@ max-parallelism=12 segment-costs=[202344, 202344, 584489, 1] cpu-comparison-resu
 |  |  |  |  tuple-ids=27 row-size=50B cardinality=2.35M cost=124166
 |  |  |  |  in pipelines: 27(GETNEXT)
 |  |  |  |
-|  |  |  F25:PLAN FRAGMENT [RANDOM] hosts=3 instances=12
+|  |  |  F25:PLAN FRAGMENT [RANDOM] hosts=3 instances=12 (adjusted from 48)
 |  |  |  Per-Host Shared Resources: mem-estimate=1.00MB mem-reservation=1.00MB thread-reservation=0 runtime-filters-memory=1.00MB
 |  |  |  Per-Instance Resources: mem-estimate=34.27MB mem-reservation=17.50MB thread-reservation=1
-|  |  |  max-parallelism=12 segment-costs=[14686864, 124166] cpu-comparison-result=12 [max(12 (self) vs 8 (sum children))]
+|  |  |  max-parallelism=12 segment-costs=[105886861, 124166] cpu-comparison-result=12 [max(12 (self) vs 8 (sum children))]
 |  |  |  32:AGGREGATE [STREAMING]
 |  |  |  |  output: count(*)
 |  |  |  |  group by: substr(i_item_desc, CAST(1 AS BIGINT), CAST(30 AS BIGINT)), i_item_sk, d_date
@@ -4536,7 +4536,7 @@ max-parallelism=12 segment-costs=[202344, 202344, 584489, 1] cpu-comparison-resu
 |  |  |  |  |
 |  |  |  |  F27:PLAN FRAGMENT [RANDOM] hosts=1 instances=1
 |  |  |  |  Per-Instance Resources: mem-estimate=16.49MB mem-reservation=2.00MB thread-reservation=1
-|  |  |  |  max-parallelism=1 segment-costs=[4306]
+|  |  |  |  max-parallelism=1 segment-costs=[54306]
 |  |  |  |  29:SCAN HDFS [tpcds_parquet.item, RANDOM]
 |  |  |  |     HDFS partitions=1/1 files=1 size=1.73MB
 |  |  |  |     stored statistics:
@@ -4544,7 +4544,7 @@ max-parallelism=12 segment-costs=[202344, 202344, 584489, 1] cpu-comparison-resu
 |  |  |  |       columns: all
 |  |  |  |     extrapolated-rows=disabled max-scan-range-rows=18.00K
 |  |  |  |     mem-estimate=16.00MB mem-reservation=2.00MB thread-reservation=0
-|  |  |  |     tuple-ids=26 row-size=120B cardinality=18.00K cost=2118
+|  |  |  |     tuple-ids=26 row-size=120B cardinality=18.00K cost=52118
 |  |  |  |     in pipelines: 29(GETNEXT)
 |  |  |  |
 |  |  |  30:HASH JOIN [INNER JOIN, BROADCAST]
@@ -4571,7 +4571,7 @@ max-parallelism=12 segment-costs=[202344, 202344, 584489, 1] cpu-comparison-resu
 |  |  |  |  |
 |  |  |  |  F26:PLAN FRAGMENT [RANDOM] hosts=1 instances=1
 |  |  |  |  Per-Instance Resources: mem-estimate=16.13MB mem-reservation=2.00MB thread-reservation=1
-|  |  |  |  max-parallelism=1 segment-costs=[75240]
+|  |  |  |  max-parallelism=1 segment-costs=[125240]
 |  |  |  |  28:SCAN HDFS [tpcds_parquet.date_dim, RANDOM]
 |  |  |  |     HDFS partitions=1/1 files=1 size=2.15MB
 |  |  |  |     predicates: d_year IN (CAST(2000 AS INT), CAST(2001 AS INT), CAST(2002 AS INT), CAST(2003 AS INT))
@@ -4582,7 +4582,7 @@ max-parallelism=12 segment-costs=[202344, 202344, 584489, 1] cpu-comparison-resu
 |  |  |  |     parquet statistics predicates: d_year IN (CAST(2000 AS INT), CAST(2001 AS INT), CAST(2002 AS INT), CAST(2003 AS INT))
 |  |  |  |     parquet dictionary predicates: d_year IN (CAST(2000 AS INT), CAST(2001 AS INT), CAST(2002 AS INT), CAST(2003 AS INT))
 |  |  |  |     mem-estimate=16.00MB mem-reservation=2.00MB thread-reservation=0
-|  |  |  |     tuple-ids=25 row-size=30B cardinality=1.49K cost=75190
+|  |  |  |     tuple-ids=25 row-size=30B cardinality=1.49K cost=125190
 |  |  |  |     in pipelines: 28(GETNEXT)
 |  |  |  |
 |  |  |  27:SCAN HDFS [tpcds_parquet.store_sales, RANDOM]
@@ -4594,7 +4594,7 @@ max-parallelism=12 segment-costs=[202344, 202344, 584489, 1] cpu-comparison-resu
 |  |  |       columns: all
 |  |  |     extrapolated-rows=disabled max-scan-range-rows=130.09K
 |  |  |     mem-estimate=16.00MB mem-reservation=512.00KB thread-reservation=0
-|  |  |     tuple-ids=24 row-size=12B cardinality=2.88M cost=33755
+|  |  |     tuple-ids=24 row-size=12B cardinality=2.88M cost=91233752
 |  |  |     in pipelines: 27(GETNEXT)
 |  |  |
 |  |  45:HASH JOIN [INNER JOIN, BROADCAST]
@@ -4606,13 +4606,13 @@ max-parallelism=12 segment-costs=[202344, 202344, 584489, 1] cpu-comparison-resu
 |  |  |  in pipelines: 25(GETNEXT), 26(OPEN)
 |  |  |
 |  |  |--F44:PLAN FRAGMENT [RANDOM] hosts=2 instances=2
-|  |  |  |  Per-Instance Resources: mem-estimate=8.77MB mem-reservation=8.75MB thread-reservation=1 runtime-filters-memory=1.00MB
+|  |  |  |  Per-Instance Resources: mem-estimate=2.95MB mem-reservation=2.94MB thread-reservation=1 runtime-filters-memory=1.00MB
 |  |  |  |  max-parallelism=2 segment-costs=[112]
 |  |  |  JOIN BUILD
 |  |  |  |  join-table-id=12 plan-id=13 cohort-id=05
 |  |  |  |  build expressions: d_date_sk
 |  |  |  |  runtime filters: RF026[bloom] <- d_date_sk, RF027[min_max] <- d_date_sk
-|  |  |  |  mem-estimate=7.75MB mem-reservation=7.75MB spill-buffer=64.00KB thread-reservation=0 cost=108
+|  |  |  |  mem-estimate=1.94MB mem-reservation=1.94MB spill-buffer=64.00KB thread-reservation=0 cost=108
 |  |  |  |
 |  |  |  79:EXCHANGE [BROADCAST]
 |  |  |  |  mem-estimate=16.00KB mem-reservation=0B thread-reservation=0
@@ -4621,7 +4621,7 @@ max-parallelism=12 segment-costs=[202344, 202344, 584489, 1] cpu-comparison-resu
 |  |  |  |
 |  |  |  F24:PLAN FRAGMENT [RANDOM] hosts=1 instances=1
 |  |  |  Per-Instance Resources: mem-estimate=16.06MB mem-reservation=512.00KB thread-reservation=1
-|  |  |  max-parallelism=1 segment-costs=[146957]
+|  |  |  max-parallelism=1 segment-costs=[196957]
 |  |  |  26:SCAN HDFS [tpcds_parquet.date_dim, RANDOM]
 |  |  |     HDFS partitions=1/1 files=1 size=2.15MB
 |  |  |     predicates: d_year = CAST(2000 AS INT), d_moy = CAST(2 AS INT)
@@ -4632,7 +4632,7 @@ max-parallelism=12 segment-costs=[202344, 202344, 584489, 1] cpu-comparison-resu
 |  |  |     parquet statistics predicates: d_year = CAST(2000 AS INT), d_moy = CAST(2 AS INT)
 |  |  |     parquet dictionary predicates: d_year = CAST(2000 AS INT), d_moy = CAST(2 AS INT)
 |  |  |     mem-estimate=16.00MB mem-reservation=512.00KB thread-reservation=0
-|  |  |     tuple-ids=23 row-size=12B cardinality=108 cost=146955
+|  |  |     tuple-ids=23 row-size=12B cardinality=108 cost=196955
 |  |  |     in pipelines: 26(GETNEXT)
 |  |  |
 |  |  25:SCAN HDFS [tpcds_parquet.web_sales, RANDOM]
@@ -4642,8 +4642,8 @@ max-parallelism=12 segment-costs=[202344, 202344, 584489, 1] cpu-comparison-resu
 |  |       table: rows=719.38K size=45.09MB
 |  |       columns: all
 |  |     extrapolated-rows=disabled max-scan-range-rows=644.77K
-|  |     mem-estimate=32.00MB mem-reservation=8.00MB thread-reservation=0
-|  |     tuple-ids=22 row-size=24B cardinality=719.38K cost=16861
+|  |     mem-estimate=16.00MB mem-reservation=8.00MB thread-reservation=0
+|  |     tuple-ids=22 row-size=24B cardinality=719.38K cost=116861
 |  |     in pipelines: 25(GETNEXT)
 |  |
 |  44:NESTED LOOP JOIN [INNER JOIN, BROADCAST]
@@ -4667,7 +4667,7 @@ max-parallelism=12 segment-costs=[202344, 202344, 584489, 1] cpu-comparison-resu
 |  |  |
 |  |  F22:PLAN FRAGMENT [UNPARTITIONED] hosts=1 instances=1
 |  |  Per-Instance Resources: mem-estimate=96.00KB mem-reservation=0B thread-reservation=1
-|  |  max-parallelism=1 segment-costs=[2, 1] cpu-comparison-result=12 [max(2 (self) vs 12 (sum children))]
+|  |  max-parallelism=2 segment-costs=[2, 1] cpu-comparison-result=12 [max(2 (self) vs 12 (sum children))]
 |  |  77:AGGREGATE [FINALIZE]
 |  |  |  output: max:merge(csales)
 |  |  |  mem-estimate=16.00KB mem-reservation=0B spill-buffer=2.00MB thread-reservation=0
@@ -4679,9 +4679,9 @@ max-parallelism=12 segment-costs=[202344, 202344, 584489, 1] cpu-comparison-resu
 |  |  |  tuple-ids=39 row-size=16B cardinality=1 cost=1
 |  |  |  in pipelines: 43(GETNEXT)
 |  |  |
-|  |  F21:PLAN FRAGMENT [HASH(c_customer_sk)] hosts=3 instances=6 (adjusted from 12)
+|  |  F21:PLAN FRAGMENT [HASH(c_customer_sk)] hosts=3 instances=6 (adjusted from 48)
 |  |  Per-Instance Resources: mem-estimate=10.92MB mem-reservation=1.94MB thread-reservation=1
-|  |  max-parallelism=3 segment-costs=[202344, 100000, 1] cpu-comparison-result=12 [max(6 (self) vs 12 (sum children))]
+|  |  max-parallelism=6 segment-costs=[202344, 100000, 1] cpu-comparison-result=12 [max(6 (self) vs 12 (sum children))]
 |  |  43:AGGREGATE
 |  |  |  output: max(sum(ss_quantity * ss_sales_price))
 |  |  |  mem-estimate=16.00KB mem-reservation=0B spill-buffer=2.00MB thread-reservation=0
@@ -4700,10 +4700,10 @@ max-parallelism=12 segment-costs=[202344, 202344, 584489, 1] cpu-comparison-resu
 |  |  |  tuple-ids=37 row-size=20B cardinality=100.00K cost=2344
 |  |  |  in pipelines: 37(GETNEXT)
 |  |  |
-|  |  F18:PLAN FRAGMENT [RANDOM] hosts=3 instances=12
+|  |  F18:PLAN FRAGMENT [RANDOM] hosts=3 instances=12 (adjusted from 48)
 |  |  Per-Host Shared Resources: mem-estimate=1.00MB mem-reservation=1.00MB thread-reservation=0 runtime-filters-memory=1.00MB
 |  |  Per-Instance Resources: mem-estimate=26.56MB mem-reservation=6.00MB thread-reservation=1
-|  |  max-parallelism=12 segment-costs=[9989034, 2344] cpu-comparison-result=12 [max(12 (self) vs 8 (sum children))]
+|  |  max-parallelism=12 segment-costs=[101189027, 2344] cpu-comparison-result=12 [max(12 (self) vs 8 (sum children))]
 |  |  42:AGGREGATE [STREAMING]
 |  |  |  output: sum(CAST(ss_quantity AS DECIMAL(10,0)) * ss_sales_price)
 |  |  |  group by: c_customer_sk
@@ -4735,7 +4735,7 @@ max-parallelism=12 segment-costs=[202344, 202344, 584489, 1] cpu-comparison-resu
 |  |  |  |
 |  |  |  F20:PLAN FRAGMENT [RANDOM] hosts=1 instances=1
 |  |  |  Per-Instance Resources: mem-estimate=16.03MB mem-reservation=512.00KB thread-reservation=1
-|  |  |  max-parallelism=1 segment-costs=[1173]
+|  |  |  max-parallelism=1 segment-costs=[51173]
 |  |  |  38:SCAN HDFS [tpcds_parquet.customer, RANDOM]
 |  |  |     HDFS partitions=1/1 files=1 size=5.49MB
 |  |  |     stored statistics:
@@ -4743,7 +4743,7 @@ max-parallelism=12 segment-costs=[202344, 202344, 584489, 1] cpu-comparison-resu
 |  |  |       columns: all
 |  |  |     extrapolated-rows=disabled max-scan-range-rows=100.00K
 |  |  |     mem-estimate=16.00MB mem-reservation=512.00KB thread-reservation=0
-|  |  |     tuple-ids=35 row-size=4B cardinality=100.00K cost=391
+|  |  |     tuple-ids=35 row-size=4B cardinality=100.00K cost=50391
 |  |  |     in pipelines: 38(GETNEXT)
 |  |  |
 |  |  40:HASH JOIN [INNER JOIN, BROADCAST]
@@ -4770,7 +4770,7 @@ max-parallelism=12 segment-costs=[202344, 202344, 584489, 1] cpu-comparison-resu
 |  |  |  |
 |  |  |  F19:PLAN FRAGMENT [RANDOM] hosts=1 instances=1
 |  |  |  Per-Instance Resources: mem-estimate=16.05MB mem-reservation=512.00KB thread-reservation=1
-|  |  |  max-parallelism=1 segment-costs=[73638]
+|  |  |  max-parallelism=1 segment-costs=[123638]
 |  |  |  39:SCAN HDFS [tpcds_parquet.date_dim, RANDOM]
 |  |  |     HDFS partitions=1/1 files=1 size=2.15MB
 |  |  |     predicates: d_year IN (CAST(2000 AS INT), CAST(2001 AS INT), CAST(2002 AS INT), CAST(2003 AS INT))
@@ -4781,7 +4781,7 @@ max-parallelism=12 segment-costs=[202344, 202344, 584489, 1] cpu-comparison-resu
 |  |  |     parquet statistics predicates: d_year IN (CAST(2000 AS INT), CAST(2001 AS INT), CAST(2002 AS INT), CAST(2003 AS INT))
 |  |  |     parquet dictionary predicates: d_year IN (CAST(2000 AS INT), CAST(2001 AS INT), CAST(2002 AS INT), CAST(2003 AS INT))
 |  |  |     mem-estimate=16.00MB mem-reservation=512.00KB thread-reservation=0
-|  |  |     tuple-ids=36 row-size=8B cardinality=1.49K cost=73620
+|  |  |     tuple-ids=36 row-size=8B cardinality=1.49K cost=123620
 |  |  |     in pipelines: 39(GETNEXT)
 |  |  |
 |  |  37:SCAN HDFS [tpcds_parquet.store_sales, RANDOM]
@@ -4793,7 +4793,7 @@ max-parallelism=12 segment-costs=[202344, 202344, 584489, 1] cpu-comparison-resu
 |  |       columns: all
 |  |     extrapolated-rows=disabled max-scan-range-rows=130.09K
 |  |     mem-estimate=16.00MB mem-reservation=1.00MB thread-reservation=0
-|  |     tuple-ids=34 row-size=16B cardinality=2.88M cost=45007
+|  |     tuple-ids=34 row-size=16B cardinality=2.88M cost=91245000
 |  |     in pipelines: 37(GETNEXT)
 |  |
 |  71:AGGREGATE [FINALIZE]
@@ -4808,10 +4808,10 @@ max-parallelism=12 segment-costs=[202344, 202344, 584489, 1] cpu-comparison-resu
 |  |  tuple-ids=32 row-size=20B cardinality=100.00K cost=2344
 |  |  in pipelines: 33(GETNEXT)
 |  |
-|  F15:PLAN FRAGMENT [RANDOM] hosts=3 instances=12
+|  F15:PLAN FRAGMENT [RANDOM] hosts=3 instances=12 (adjusted from 48)
 |  Per-Host Shared Resources: mem-estimate=1.00MB mem-reservation=1.00MB thread-reservation=0 runtime-filters-memory=1.00MB
 |  Per-Instance Resources: mem-estimate=27.12MB mem-reservation=6.00MB thread-reservation=1
-|  max-parallelism=12 segment-costs=[8674967, 2344] cpu-comparison-result=12 [max(12 (self) vs 4 (sum children))]
+|  max-parallelism=12 segment-costs=[99874964, 2344] cpu-comparison-result=12 [max(12 (self) vs 4 (sum children))]
 |  36:AGGREGATE [STREAMING]
 |  |  output: sum(CAST(ss_quantity AS DECIMAL(10,0)) * ss_sales_price)
 |  |  group by: c_customer_sk
@@ -4844,7 +4844,7 @@ max-parallelism=12 segment-costs=[202344, 202344, 584489, 1] cpu-comparison-resu
 |  |  F16:PLAN FRAGMENT [RANDOM] hosts=1 instances=1
 |  |  Per-Host Shared Resources: mem-estimate=1.00MB mem-reservation=1.00MB thread-reservation=0 runtime-filters-memory=1.00MB
 |  |  Per-Instance Resources: mem-estimate=16.03MB mem-reservation=512.00KB thread-reservation=1
-|  |  max-parallelism=1 segment-costs=[1173]
+|  |  max-parallelism=1 segment-costs=[51173]
 |  |  34:SCAN HDFS [tpcds_parquet.customer, RANDOM]
 |  |     HDFS partitions=1/1 files=1 size=5.49MB
 |  |     runtime filters: RF017[min_max] -> tpcds_parquet.customer.c_customer_sk, RF016[bloom] -> tpcds_parquet.customer.c_customer_sk
@@ -4853,7 +4853,7 @@ max-parallelism=12 segment-costs=[202344, 202344, 584489, 1] cpu-comparison-resu
 |  |       columns: all
 |  |     extrapolated-rows=disabled max-scan-range-rows=100.00K
 |  |     mem-estimate=16.00MB mem-reservation=512.00KB thread-reservation=0
-|  |     tuple-ids=31 row-size=4B cardinality=100.00K cost=391
+|  |     tuple-ids=31 row-size=4B cardinality=100.00K cost=50391
 |  |     in pipelines: 34(GETNEXT)
 |  |
 |  33:SCAN HDFS [tpcds_parquet.store_sales, RANDOM]
@@ -4865,7 +4865,7 @@ max-parallelism=12 segment-costs=[202344, 202344, 584489, 1] cpu-comparison-resu
 |       columns: all
 |     extrapolated-rows=disabled max-scan-range-rows=130.09K
 |     mem-estimate=16.00MB mem-reservation=1.00MB thread-reservation=0
-|     tuple-ids=30 row-size=12B cardinality=2.88M cost=33755
+|     tuple-ids=30 row-size=12B cardinality=2.88M cost=91233752
 |     in pipelines: 33(GETNEXT)
 |
 24:HASH JOIN [RIGHT SEMI JOIN, PARTITIONED]
@@ -4875,7 +4875,7 @@ max-parallelism=12 segment-costs=[202344, 202344, 584489, 1] cpu-comparison-resu
 |  tuple-ids=0,1 row-size=36B cardinality=85.31K cost=100000
 |  in pipelines: 52(GETNEXT), 01(OPEN)
 |
-|--F32:PLAN FRAGMENT [RANDOM] hosts=3 instances=12
+|--F32:PLAN FRAGMENT [RANDOM] hosts=3 instances=12 (adjusted from 48)
 |  |  Per-Instance Resources: mem-estimate=4.04MB mem-reservation=2.94MB thread-reservation=1 runtime-filters-memory=1.00MB
 |  |  max-parallelism=12 segment-costs=[88975] cpu-comparison-result=16 [max(15 (self) vs 16 (sum children))]
 |  JOIN BUILD
@@ -4891,8 +4891,8 @@ max-parallelism=12 segment-costs=[202344, 202344, 584489, 1] cpu-comparison-resu
 |  |
 |  F08:PLAN FRAGMENT [RANDOM] hosts=3 instances=3
 |  Per-Host Shared Resources: mem-estimate=1.00MB mem-reservation=1.00MB thread-reservation=0 runtime-filters-memory=1.00MB
-|  Per-Instance Resources: mem-estimate=50.06MB mem-reservation=8.00MB thread-reservation=1
-|  max-parallelism=3 segment-costs=[1564310]
+|  Per-Instance Resources: mem-estimate=18.06MB mem-reservation=8.00MB thread-reservation=1
+|  max-parallelism=3 segment-costs=[1714310]
 |  23:HASH JOIN [LEFT SEMI JOIN, BROADCAST]
 |  |  hash-table-id=01
 |  |  hash predicates: cs_item_sk = i_item_sk
@@ -4901,22 +4901,22 @@ max-parallelism=12 segment-costs=[202344, 202344, 584489, 1] cpu-comparison-resu
 |  |  in pipelines: 01(GETNEXT), 66(OPEN)
 |  |
 |  |--F33:PLAN FRAGMENT [RANDOM] hosts=3 instances=3
-|  |  |  Per-Instance Resources: mem-estimate=7.96MB mem-reservation=7.75MB thread-reservation=1
+|  |  |  Per-Instance Resources: mem-estimate=2.14MB mem-reservation=1.94MB thread-reservation=1
 |  |  |  max-parallelism=3 segment-costs=[18608] cpu-comparison-result=12 [max(3 (self) vs 12 (sum children))]
 |  |  JOIN BUILD
 |  |  |  join-table-id=01 plan-id=02 cohort-id=02
 |  |  |  build expressions: i_item_sk
 |  |  |  runtime filters: RF009[min_max] <- i_item_sk
-|  |  |  mem-estimate=7.75MB mem-reservation=7.75MB spill-buffer=64.00KB thread-reservation=0 cost=17975
+|  |  |  mem-estimate=1.94MB mem-reservation=1.94MB spill-buffer=64.00KB thread-reservation=0 cost=17975
 |  |  |
 |  |  67:EXCHANGE [BROADCAST]
 |  |  |  mem-estimate=212.43KB mem-reservation=0B thread-reservation=0
 |  |  |  tuple-ids=57 row-size=8B cardinality=17.98K cost=633
 |  |  |  in pipelines: 66(GETNEXT)
 |  |  |
-|  |  F14:PLAN FRAGMENT [HASH(i_item_sk)] hosts=3 instances=6 (adjusted from 12)
+|  |  F14:PLAN FRAGMENT [HASH(i_item_sk)] hosts=3 instances=6 (adjusted from 48)
 |  |  Per-Instance Resources: mem-estimate=10.12MB mem-reservation=1.94MB thread-reservation=1
-|  |  max-parallelism=3 segment-costs=[18186, 211] cpu-comparison-result=12 [max(6 (self) vs 12 (sum children))]
+|  |  max-parallelism=6 segment-costs=[18186, 211] cpu-comparison-result=12 [max(6 (self) vs 12 (sum children))]
 |  |  66:AGGREGATE [FINALIZE]
 |  |  |  group by: i_item_sk
 |  |  |  mem-estimate=10.00MB mem-reservation=1.94MB spill-buffer=64.00KB thread-reservation=0
@@ -4928,9 +4928,9 @@ max-parallelism=12 segment-costs=[202344, 202344, 584489, 1] cpu-comparison-resu
 |  |  |  tuple-ids=57 row-size=8B cardinality=17.98K cost=211
 |  |  |  in pipelines: 64(GETNEXT)
 |  |  |
-|  |  F13:PLAN FRAGMENT [HASH(substr(i_item_desc, 1, 30),i_item_sk,d_date)] hosts=3 instances=6 (adjusted from 12)
+|  |  F13:PLAN FRAGMENT [HASH(substr(i_item_desc, 1, 30),i_item_sk,d_date)] hosts=3 instances=6 (adjusted from 48)
 |  |  Per-Instance Resources: mem-estimate=54.63MB mem-reservation=36.00MB thread-reservation=1
-|  |  max-parallelism=3 segment-costs=[9542330, 235454, 211] cpu-comparison-result=12 [max(6 (self) vs 12 (sum children))]
+|  |  max-parallelism=6 segment-costs=[9542330, 235454, 211] cpu-comparison-result=12 [max(6 (self) vs 12 (sum children))]
 |  |  22:AGGREGATE [STREAMING]
 |  |  |  group by: i_item_sk
 |  |  |  mem-estimate=10.00MB mem-reservation=2.00MB spill-buffer=64.00KB thread-reservation=0
@@ -4950,10 +4950,10 @@ max-parallelism=12 segment-costs=[202344, 202344, 584489, 1] cpu-comparison-resu
 |  |  |  tuple-ids=5 row-size=50B cardinality=2.35M cost=124166
 |  |  |  in pipelines: 03(GETNEXT)
 |  |  |
-|  |  F10:PLAN FRAGMENT [RANDOM] hosts=3 instances=12
+|  |  F10:PLAN FRAGMENT [RANDOM] hosts=3 instances=12 (adjusted from 48)
 |  |  Per-Host Shared Resources: mem-estimate=1.00MB mem-reservation=1.00MB thread-reservation=0 runtime-filters-memory=1.00MB
 |  |  Per-Instance Resources: mem-estimate=34.27MB mem-reservation=17.50MB thread-reservation=1
-|  |  max-parallelism=12 segment-costs=[14686864, 124166] cpu-comparison-result=12 [max(12 (self) vs 8 (sum children))]
+|  |  max-parallelism=12 segment-costs=[105886861, 124166] cpu-comparison-result=12 [max(12 (self) vs 8 (sum children))]
 |  |  08:AGGREGATE [STREAMING]
 |  |  |  output: count(*)
 |  |  |  group by: substr(i_item_desc, CAST(1 AS BIGINT), CAST(30 AS BIGINT)), i_item_sk, d_date
@@ -4985,7 +4985,7 @@ max-parallelism=12 segment-costs=[202344, 202344, 584489, 1] cpu-comparison-resu
 |  |  |  |
 |  |  |  F12:PLAN FRAGMENT [RANDOM] hosts=1 instances=1
 |  |  |  Per-Instance Resources: mem-estimate=16.49MB mem-reservation=2.00MB thread-reservation=1
-|  |  |  max-parallelism=1 segment-costs=[4306]
+|  |  |  max-parallelism=1 segment-costs=[54306]
 |  |  |  05:SCAN HDFS [tpcds_parquet.item, RANDOM]
 |  |  |     HDFS partitions=1/1 files=1 size=1.73MB
 |  |  |     stored statistics:
@@ -4993,7 +4993,7 @@ max-parallelism=12 segment-costs=[202344, 202344, 584489, 1] cpu-comparison-resu
 |  |  |       columns: all
 |  |  |     extrapolated-rows=disabled max-scan-range-rows=18.00K
 |  |  |     mem-estimate=16.00MB mem-reservation=2.00MB thread-reservation=0
-|  |  |     tuple-ids=4 row-size=120B cardinality=18.00K cost=2118
+|  |  |     tuple-ids=4 row-size=120B cardinality=18.00K cost=52118
 |  |  |     in pipelines: 05(GETNEXT)
 |  |  |
 |  |  06:HASH JOIN [INNER JOIN, BROADCAST]
@@ -5020,7 +5020,7 @@ max-parallelism=12 segment-costs=[202344, 202344, 584489, 1] cpu-comparison-resu
 |  |  |  |
 |  |  |  F11:PLAN FRAGMENT [RANDOM] hosts=1 instances=1
 |  |  |  Per-Instance Resources: mem-estimate=16.13MB mem-reservation=2.00MB thread-reservation=1
-|  |  |  max-parallelism=1 segment-costs=[75240]
+|  |  |  max-parallelism=1 segment-costs=[125240]
 |  |  |  04:SCAN HDFS [tpcds_parquet.date_dim, RANDOM]
 |  |  |     HDFS partitions=1/1 files=1 size=2.15MB
 |  |  |     predicates: d_year IN (CAST(2000 AS INT), CAST(2001 AS INT), CAST(2002 AS INT), CAST(2003 AS INT))
@@ -5031,7 +5031,7 @@ max-parallelism=12 segment-costs=[202344, 202344, 584489, 1] cpu-comparison-resu
 |  |  |     parquet statistics predicates: d_year IN (CAST(2000 AS INT), CAST(2001 AS INT), CAST(2002 AS INT), CAST(2003 AS INT))
 |  |  |     parquet dictionary predicates: d_year IN (CAST(2000 AS INT), CAST(2001 AS INT), CAST(2002 AS INT), CAST(2003 AS INT))
 |  |  |     mem-estimate=16.00MB mem-reservation=2.00MB thread-reservation=0
-|  |  |     tuple-ids=3 row-size=30B cardinality=1.49K cost=75190
+|  |  |     tuple-ids=3 row-size=30B cardinality=1.49K cost=125190
 |  |  |     in pipelines: 04(GETNEXT)
 |  |  |
 |  |  03:SCAN HDFS [tpcds_parquet.store_sales, RANDOM]
@@ -5043,7 +5043,7 @@ max-parallelism=12 segment-costs=[202344, 202344, 584489, 1] cpu-comparison-resu
 |  |       columns: all
 |  |     extrapolated-rows=disabled max-scan-range-rows=130.09K
 |  |     mem-estimate=16.00MB mem-reservation=512.00KB thread-reservation=0
-|  |     tuple-ids=2 row-size=12B cardinality=2.88M cost=33755
+|  |     tuple-ids=2 row-size=12B cardinality=2.88M cost=91233752
 |  |     in pipelines: 03(GETNEXT)
 |  |
 |  21:HASH JOIN [INNER JOIN, BROADCAST]
@@ -5055,13 +5055,13 @@ max-parallelism=12 segment-costs=[202344, 202344, 584489, 1] cpu-comparison-resu
 |  |  in pipelines: 01(GETNEXT), 02(OPEN)
 |  |
 |  |--F36:PLAN FRAGMENT [RANDOM] hosts=3 instances=3
-|  |  |  Per-Instance Resources: mem-estimate=8.77MB mem-reservation=8.75MB thread-reservation=1 runtime-filters-memory=1.00MB
+|  |  |  Per-Instance Resources: mem-estimate=2.95MB mem-reservation=2.94MB thread-reservation=1 runtime-filters-memory=1.00MB
 |  |  |  max-parallelism=3 segment-costs=[114]
 |  |  JOIN BUILD
 |  |  |  join-table-id=04 plan-id=05 cohort-id=02
 |  |  |  build expressions: d_date_sk
 |  |  |  runtime filters: RF010[bloom] <- d_date_sk, RF011[min_max] <- d_date_sk
-|  |  |  mem-estimate=7.75MB mem-reservation=7.75MB spill-buffer=64.00KB thread-reservation=0 cost=108
+|  |  |  mem-estimate=1.94MB mem-reservation=1.94MB spill-buffer=64.00KB thread-reservation=0 cost=108
 |  |  |
 |  |  60:EXCHANGE [BROADCAST]
 |  |  |  mem-estimate=16.00KB mem-reservation=0B thread-reservation=0
@@ -5070,7 +5070,7 @@ max-parallelism=12 segment-costs=[202344, 202344, 584489, 1] cpu-comparison-resu
 |  |  |
 |  |  F09:PLAN FRAGMENT [RANDOM] hosts=1 instances=1
 |  |  Per-Instance Resources: mem-estimate=16.06MB mem-reservation=512.00KB thread-reservation=1
-|  |  max-parallelism=1 segment-costs=[146957]
+|  |  max-parallelism=1 segment-costs=[196957]
 |  |  02:SCAN HDFS [tpcds_parquet.date_dim, RANDOM]
 |  |     HDFS partitions=1/1 files=1 size=2.15MB
 |  |     predicates: d_year = CAST(2000 AS INT), d_moy = CAST(2 AS INT)
@@ -5081,7 +5081,7 @@ max-parallelism=12 segment-costs=[202344, 202344, 584489, 1] cpu-comparison-resu
 |  |     parquet statistics predicates: d_year = CAST(2000 AS INT), d_moy = CAST(2 AS INT)
 |  |     parquet dictionary predicates: d_year = CAST(2000 AS INT), d_moy = CAST(2 AS INT)
 |  |     mem-estimate=16.00MB mem-reservation=512.00KB thread-reservation=0
-|  |     tuple-ids=1 row-size=12B cardinality=108 cost=146955
+|  |     tuple-ids=1 row-size=12B cardinality=108 cost=196955
 |  |     in pipelines: 02(GETNEXT)
 |  |
 |  01:SCAN HDFS [tpcds_parquet.catalog_sales, RANDOM]
@@ -5091,8 +5091,8 @@ max-parallelism=12 segment-costs=[202344, 202344, 584489, 1] cpu-comparison-resu
 |       table: rows=1.44M size=96.62MB
 |       columns: all
 |     extrapolated-rows=disabled max-scan-range-rows=650.14K
-|     mem-estimate=48.00MB mem-reservation=8.00MB thread-reservation=0
-|     tuple-ids=0 row-size=24B cardinality=1.44M cost=33787
+|     mem-estimate=16.00MB mem-reservation=8.00MB thread-reservation=0
+|     tuple-ids=0 row-size=24B cardinality=1.44M cost=183787
 |     in pipelines: 01(GETNEXT)
 |
 20:NESTED LOOP JOIN [INNER JOIN, BROADCAST]
@@ -5116,7 +5116,7 @@ max-parallelism=12 segment-costs=[202344, 202344, 584489, 1] cpu-comparison-resu
 |  |
 |  F07:PLAN FRAGMENT [UNPARTITIONED] hosts=1 instances=1
 |  Per-Instance Resources: mem-estimate=96.00KB mem-reservation=0B thread-reservation=1
-|  max-parallelism=1 segment-costs=[2, 1] cpu-comparison-result=12 [max(2 (self) vs 12 (sum children))]
+|  max-parallelism=2 segment-costs=[2, 1] cpu-comparison-result=12 [max(2 (self) vs 12 (sum children))]
 |  58:AGGREGATE [FINALIZE]
 |  |  output: max:merge(csales)
 |  |  mem-estimate=16.00KB mem-reservation=0B spill-buffer=2.00MB thread-reservation=0
@@ -5128,9 +5128,9 @@ max-parallelism=12 segment-costs=[202344, 202344, 584489, 1] cpu-comparison-resu
 |  |  tuple-ids=17 row-size=16B cardinality=1 cost=1
 |  |  in pipelines: 19(GETNEXT)
 |  |
-|  F06:PLAN FRAGMENT [HASH(c_customer_sk)] hosts=3 instances=6 (adjusted from 12)
+|  F06:PLAN FRAGMENT [HASH(c_customer_sk)] hosts=3 instances=6 (adjusted from 48)
 |  Per-Instance Resources: mem-estimate=10.92MB mem-reservation=1.94MB thread-reservation=1
-|  max-parallelism=3 segment-costs=[202344, 100000, 1] cpu-comparison-result=12 [max(6 (self) vs 12 (sum children))]
+|  max-parallelism=6 segment-costs=[202344, 100000, 1] cpu-comparison-result=12 [max(6 (self) vs 12 (sum children))]
 |  19:AGGREGATE
 |  |  output: max(sum(ss_quantity * ss_sales_price))
 |  |  mem-estimate=16.00KB mem-reservation=0B spill-buffer=2.00MB thread-reservation=0
@@ -5149,10 +5149,10 @@ max-parallelism=12 segment-costs=[202344, 202344, 584489, 1] cpu-comparison-resu
 |  |  tuple-ids=15 row-size=20B cardinality=100.00K cost=2344
 |  |  in pipelines: 13(GETNEXT)
 |  |
-|  F03:PLAN FRAGMENT [RANDOM] hosts=3 instances=12
+|  F03:PLAN FRAGMENT [RANDOM] hosts=3 instances=12 (adjusted from 48)
 |  Per-Host Shared Resources: mem-estimate=2.00MB mem-reservation=2.00MB thread-reservation=0 runtime-filters-memory=2.00MB
 |  Per-Instance Resources: mem-estimate=26.56MB mem-reservation=6.00MB thread-reservation=1
-|  max-parallelism=12 segment-costs=[9989034, 2344] cpu-comparison-result=12 [max(12 (self) vs 8 (sum children))]
+|  max-parallelism=12 segment-costs=[101189027, 2344] cpu-comparison-result=12 [max(12 (self) vs 8 (sum children))]
 |  18:AGGREGATE [STREAMING]
 |  |  output: sum(CAST(ss_quantity AS DECIMAL(10,0)) * ss_sales_price)
 |  |  group by: c_customer_sk
@@ -5184,7 +5184,7 @@ max-parallelism=12 segment-costs=[202344, 202344, 584489, 1] cpu-comparison-resu
 |  |  |
 |  |  F05:PLAN FRAGMENT [RANDOM] hosts=1 instances=1
 |  |  Per-Instance Resources: mem-estimate=16.03MB mem-reservation=512.00KB thread-reservation=1
-|  |  max-parallelism=1 segment-costs=[1173]
+|  |  max-parallelism=1 segment-costs=[51173]
 |  |  14:SCAN HDFS [tpcds_parquet.customer, RANDOM]
 |  |     HDFS partitions=1/1 files=1 size=5.49MB
 |  |     stored statistics:
@@ -5192,7 +5192,7 @@ max-parallelism=12 segment-costs=[202344, 202344, 584489, 1] cpu-comparison-resu
 |  |       columns: all
 |  |     extrapolated-rows=disabled max-scan-range-rows=100.00K
 |  |     mem-estimate=16.00MB mem-reservation=512.00KB thread-reservation=0
-|  |     tuple-ids=13 row-size=4B cardinality=100.00K cost=391
+|  |     tuple-ids=13 row-size=4B cardinality=100.00K cost=50391
 |  |     in pipelines: 14(GETNEXT)
 |  |
 |  16:HASH JOIN [INNER JOIN, BROADCAST]
@@ -5219,7 +5219,7 @@ max-parallelism=12 segment-costs=[202344, 202344, 584489, 1] cpu-comparison-resu
 |  |  |
 |  |  F04:PLAN FRAGMENT [RANDOM] hosts=1 instances=1
 |  |  Per-Instance Resources: mem-estimate=16.05MB mem-reservation=512.00KB thread-reservation=1
-|  |  max-parallelism=1 segment-costs=[73638]
+|  |  max-parallelism=1 segment-costs=[123638]
 |  |  15:SCAN HDFS [tpcds_parquet.date_dim, RANDOM]
 |  |     HDFS partitions=1/1 files=1 size=2.15MB
 |  |     predicates: d_year IN (CAST(2000 AS INT), CAST(2001 AS INT), CAST(2002 AS INT), CAST(2003 AS INT))
@@ -5230,7 +5230,7 @@ max-parallelism=12 segment-costs=[202344, 202344, 584489, 1] cpu-comparison-resu
 |  |     parquet statistics predicates: d_year IN (CAST(2000 AS INT), CAST(2001 AS INT), CAST(2002 AS INT), CAST(2003 AS INT))
 |  |     parquet dictionary predicates: d_year IN (CAST(2000 AS INT), CAST(2001 AS INT), CAST(2002 AS INT), CAST(2003 AS INT))
 |  |     mem-estimate=16.00MB mem-reservation=512.00KB thread-reservation=0
-|  |     tuple-ids=14 row-size=8B cardinality=1.49K cost=73620
+|  |     tuple-ids=14 row-size=8B cardinality=1.49K cost=123620
 |  |     in pipelines: 15(GETNEXT)
 |  |
 |  13:SCAN HDFS [tpcds_parquet.store_sales, RANDOM]
@@ -5242,7 +5242,7 @@ max-parallelism=12 segment-costs=[202344, 202344, 584489, 1] cpu-comparison-resu
 |       columns: all
 |     extrapolated-rows=disabled max-scan-range-rows=130.09K
 |     mem-estimate=16.00MB mem-reservation=1.00MB thread-reservation=0
-|     tuple-ids=12 row-size=16B cardinality=2.88M cost=45007
+|     tuple-ids=12 row-size=16B cardinality=2.88M cost=91245000
 |     in pipelines: 13(GETNEXT)
 |
 52:AGGREGATE [FINALIZE]
@@ -5257,10 +5257,10 @@ max-parallelism=12 segment-costs=[202344, 202344, 584489, 1] cpu-comparison-resu
 |  tuple-ids=10 row-size=20B cardinality=100.00K cost=2344
 |  in pipelines: 09(GETNEXT)
 |
-F00:PLAN FRAGMENT [RANDOM] hosts=3 instances=12
+F00:PLAN FRAGMENT [RANDOM] hosts=3 instances=12 (adjusted from 48)
 Per-Host Shared Resources: mem-estimate=2.00MB mem-reservation=2.00MB thread-reservation=0 runtime-filters-memory=2.00MB
 Per-Instance Resources: mem-estimate=27.12MB mem-reservation=6.00MB thread-reservation=1
-max-parallelism=12 segment-costs=[8674967, 2344] cpu-comparison-result=12 [max(12 (self) vs 4 (sum children))]
+max-parallelism=12 segment-costs=[99874964, 2344] cpu-comparison-result=12 [max(12 (self) vs 4 (sum children))]
 12:AGGREGATE [STREAMING]
 |  output: sum(CAST(ss_quantity AS DECIMAL(10,0)) * ss_sales_price)
 |  group by: c_customer_sk
@@ -5293,7 +5293,7 @@ max-parallelism=12 segment-costs=[8674967, 2344] cpu-comparison-result=12 [max(1
 |  F01:PLAN FRAGMENT [RANDOM] hosts=1 instances=1
 |  Per-Host Shared Resources: mem-estimate=1.00MB mem-reservation=1.00MB thread-reservation=0 runtime-filters-memory=1.00MB
 |  Per-Instance Resources: mem-estimate=16.03MB mem-reservation=512.00KB thread-reservation=1
-|  max-parallelism=1 segment-costs=[1173]
+|  max-parallelism=1 segment-costs=[51173]
 |  10:SCAN HDFS [tpcds_parquet.customer, RANDOM]
 |     HDFS partitions=1/1 files=1 size=5.49MB
 |     runtime filters: RF001[min_max] -> tpcds_parquet.customer.c_customer_sk, RF000[bloom] -> tpcds_parquet.customer.c_customer_sk
@@ -5302,7 +5302,7 @@ max-parallelism=12 segment-costs=[8674967, 2344] cpu-comparison-result=12 [max(1
 |       columns: all
 |     extrapolated-rows=disabled max-scan-range-rows=100.00K
 |     mem-estimate=16.00MB mem-reservation=512.00KB thread-reservation=0
-|     tuple-ids=9 row-size=4B cardinality=100.00K cost=391
+|     tuple-ids=9 row-size=4B cardinality=100.00K cost=50391
 |     in pipelines: 10(GETNEXT)
 |
 09:SCAN HDFS [tpcds_parquet.store_sales, RANDOM]
@@ -5314,7 +5314,7 @@ max-parallelism=12 segment-costs=[8674967, 2344] cpu-comparison-result=12 [max(1
      columns: all
    extrapolated-rows=disabled max-scan-range-rows=130.09K
    mem-estimate=16.00MB mem-reservation=1.00MB thread-reservation=0
-   tuple-ids=8 row-size=12B cardinality=2.88M cost=33755
+   tuple-ids=8 row-size=12B cardinality=2.88M cost=91233752
    in pipelines: 09(GETNEXT)
 ====
 # TPCDS-Q23b second of two queries
@@ -5403,10 +5403,10 @@ ORDER BY c_last_name,
          sales
 LIMIT 100;
 ---- PARALLELPLANS
-Max Per-Host Resource Reservation: Memory=701.75MB Threads=85
-Per-Host Resource Estimates: Memory=1.59GB
+Max Per-Host Resource Reservation: Memory=663.12MB Threads=83
+Per-Host Resource Estimates: Memory=1.49GB
 F35:PLAN FRAGMENT [UNPARTITIONED] hosts=1 instances=1
-|  Per-Instance Resources: mem-estimate=4.07MB mem-reservation=4.00MB thread-reservation=1
+|  Per-Instance Resources: mem-estimate=4.03MB mem-reservation=4.00MB thread-reservation=1
 |  max-parallelism=1 segment-costs=[306] cpu-comparison-result=75 [max(1 (self) vs 75 (sum children))]
 PLAN-ROOT SINK
 |  output exprs: c_last_name, c_first_name, sales
@@ -5415,13 +5415,13 @@ PLAN-ROOT SINK
 96:MERGING-EXCHANGE [UNPARTITIONED]
 |  order by: c_last_name ASC, c_first_name ASC, sales ASC
 |  limit: 100
-|  mem-estimate=67.28KB mem-reservation=0B thread-reservation=0
+|  mem-estimate=34.49KB mem-reservation=0B thread-reservation=0
 |  tuple-ids=44 row-size=52B cardinality=100 cost=6
 |  in pipelines: 53(GETNEXT)
 |
-F34:PLAN FRAGMENT [RANDOM] hosts=3 instances=12
+F34:PLAN FRAGMENT [RANDOM] hosts=3 instances=6 (adjusted from 48)
 Per-Instance Resources: mem-estimate=10.51MB mem-reservation=1.94MB thread-reservation=1
-max-parallelism=12 segment-costs=[32154, 29405, 300, 6] cpu-comparison-result=75 [max(12 (self) vs 75 (sum children))]
+max-parallelism=6 segment-costs=[32154, 29405, 300, 6] cpu-comparison-result=75 [max(6 (self) vs 75 (sum children))]
 53:TOP-N [LIMIT=100]
 |  order by: c_last_name ASC, c_first_name ASC, sales ASC
 |  mem-estimate=5.08KB mem-reservation=0B thread-reservation=0
@@ -5446,9 +5446,9 @@ max-parallelism=12 segment-costs=[32154, 29405, 300, 6] cpu-comparison-result=75
 |  |  tuple-ids=41 row-size=52B cardinality=9.63K cost=527
 |  |  in pipelines: 78(GETNEXT)
 |  |
-|  F20:PLAN FRAGMENT [HASH(itemdesc,i_item_sk,d_date)] hosts=3 instances=6 (adjusted from 12)
+|  F20:PLAN FRAGMENT [HASH(itemdesc,i_item_sk,d_date)] hosts=3 instances=6 (adjusted from 48)
 |  Per-Instance Resources: mem-estimate=54.63MB mem-reservation=36.00MB thread-reservation=1
-|  max-parallelism=3 segment-costs=[9542330, 264332, 527] cpu-comparison-result=36 [max(6 (self) vs 36 (sum children))]
+|  max-parallelism=6 segment-costs=[9542330, 264332, 527] cpu-comparison-result=36 [max(6 (self) vs 36 (sum children))]
 |  52:AGGREGATE [STREAMING]
 |  |  output: sum(CAST(ws_quantity AS DECIMAL(10,0)) * ws_list_price)
 |  |  group by: c_last_name, c_first_name
@@ -5465,13 +5465,13 @@ max-parallelism=12 segment-costs=[32154, 29405, 300, 6] cpu-comparison-result=75
 |  |  in pipelines: 78(GETNEXT), 27(OPEN)
 |  |
 |  |--F46:PLAN FRAGMENT [HASH(itemdesc,i_item_sk,d_date)] hosts=3 instances=3
-|  |  |  Per-Instance Resources: mem-estimate=14.03MB mem-reservation=12.50MB thread-reservation=1 runtime-filters-memory=1.00MB
+|  |  |  Per-Instance Resources: mem-estimate=8.28MB mem-reservation=6.75MB thread-reservation=1 runtime-filters-memory=1.00MB
 |  |  |  max-parallelism=3 segment-costs=[13235] cpu-comparison-result=24 [max(9 (self) vs 24 (sum children))]
 |  |  JOIN BUILD
 |  |  |  join-table-id=10 plan-id=11 cohort-id=05
 |  |  |  build expressions: ws_item_sk
 |  |  |  runtime filters: RF018[bloom] <- ws_item_sk, RF019[min_max] <- ws_item_sk
-|  |  |  mem-estimate=11.50MB mem-reservation=11.50MB spill-buffer=128.00KB thread-reservation=0 cost=9626
+|  |  |  mem-estimate=5.75MB mem-reservation=5.75MB spill-buffer=128.00KB thread-reservation=0 cost=9626
 |  |  |
 |  |  93:EXCHANGE [BROADCAST]
 |  |  |  mem-estimate=1.53MB mem-reservation=0B thread-reservation=0
@@ -5480,7 +5480,7 @@ max-parallelism=12 segment-costs=[32154, 29405, 300, 6] cpu-comparison-result=75
 |  |  |
 |  |  F32:PLAN FRAGMENT [HASH(ws_bill_customer_sk)] hosts=2 instances=4 (adjusted from 2)
 |  |  Per-Instance Resources: mem-estimate=1018.27KB mem-reservation=0B thread-reservation=1
-|  |  max-parallelism=2 segment-costs=[11619]
+|  |  max-parallelism=4 segment-costs=[11619]
 |  |  50:HASH JOIN [INNER JOIN, PARTITIONED]
 |  |  |  hash-table-id=11
 |  |  |  hash predicates: ws_bill_customer_sk = customer.c_customer_sk
@@ -5505,7 +5505,7 @@ max-parallelism=12 segment-costs=[32154, 29405, 300, 6] cpu-comparison-result=75
 |  |  |  |
 |  |  |  F31:PLAN FRAGMENT [RANDOM] hosts=1 instances=1
 |  |  |  Per-Instance Resources: mem-estimate=16.69MB mem-reservation=1.00MB thread-reservation=1
-|  |  |  max-parallelism=1 segment-costs=[8197]
+|  |  |  max-parallelism=1 segment-costs=[58197]
 |  |  |  28:SCAN HDFS [tpcds_parquet.customer, RANDOM]
 |  |  |     HDFS partitions=1/1 files=1 size=5.49MB
 |  |  |     stored statistics:
@@ -5513,7 +5513,7 @@ max-parallelism=12 segment-costs=[32154, 29405, 300, 6] cpu-comparison-result=75
 |  |  |       columns: all
 |  |  |     extrapolated-rows=disabled max-scan-range-rows=100.00K
 |  |  |     mem-estimate=16.00MB mem-reservation=1.00MB thread-reservation=0
-|  |  |     tuple-ids=22 row-size=40B cardinality=100.00K cost=3903
+|  |  |     tuple-ids=22 row-size=40B cardinality=100.00K cost=53903
 |  |  |     in pipelines: 28(GETNEXT)
 |  |  |
 |  |  91:EXCHANGE [HASH(ws_bill_customer_sk)]
@@ -5523,8 +5523,8 @@ max-parallelism=12 segment-costs=[32154, 29405, 300, 6] cpu-comparison-result=75
 |  |  |
 |  |  F21:PLAN FRAGMENT [RANDOM] hosts=2 instances=2
 |  |  Per-Host Shared Resources: mem-estimate=2.00MB mem-reservation=2.00MB thread-reservation=0 runtime-filters-memory=2.00MB
-|  |  Per-Instance Resources: mem-estimate=33.31MB mem-reservation=8.00MB thread-reservation=1
-|  |  max-parallelism=2 segment-costs=[779889]
+|  |  Per-Instance Resources: mem-estimate=17.31MB mem-reservation=8.00MB thread-reservation=1
+|  |  max-parallelism=2 segment-costs=[879889]
 |  |  49:HASH JOIN [INNER JOIN, BROADCAST]
 |  |  |  hash-table-id=12
 |  |  |  hash predicates: ws_bill_customer_sk = c_customer_sk
@@ -5534,22 +5534,22 @@ max-parallelism=12 segment-costs=[32154, 29405, 300, 6] cpu-comparison-result=75
 |  |  |  in pipelines: 27(GETNEXT), 89(OPEN)
 |  |  |
 |  |  |--F48:PLAN FRAGMENT [RANDOM] hosts=2 instances=2
-|  |  |  |  Per-Instance Resources: mem-estimate=9.33MB mem-reservation=8.75MB thread-reservation=1 runtime-filters-memory=1.00MB
+|  |  |  |  Per-Instance Resources: mem-estimate=3.52MB mem-reservation=2.94MB thread-reservation=1 runtime-filters-memory=1.00MB
 |  |  |  |  max-parallelism=2 segment-costs=[10782] cpu-comparison-result=16 [max(2 (self) vs 16 (sum children))]
 |  |  |  JOIN BUILD
 |  |  |  |  join-table-id=12 plan-id=13 cohort-id=06
 |  |  |  |  build expressions: c_customer_sk
 |  |  |  |  runtime filters: RF026[bloom] <- c_customer_sk, RF027[min_max] <- c_customer_sk
-|  |  |  |  mem-estimate=7.75MB mem-reservation=7.75MB spill-buffer=64.00KB thread-reservation=0 cost=10000
+|  |  |  |  mem-estimate=1.94MB mem-reservation=1.94MB spill-buffer=64.00KB thread-reservation=0 cost=10000
 |  |  |  |
 |  |  |  90:EXCHANGE [BROADCAST]
 |  |  |  |  mem-estimate=591.56KB mem-reservation=0B thread-reservation=0
 |  |  |  |  tuple-ids=39 row-size=36B cardinality=10.00K cost=782
 |  |  |  |  in pipelines: 89(GETNEXT)
 |  |  |  |
-|  |  |  F30:PLAN FRAGMENT [HASH(c_customer_sk)] hosts=3 instances=6 (adjusted from 12)
+|  |  |  F30:PLAN FRAGMENT [HASH(c_customer_sk)] hosts=3 instances=6 (adjusted from 48)
 |  |  |  Per-Instance Resources: mem-estimate=11.61MB mem-reservation=1.94MB thread-reservation=1
-|  |  |  max-parallelism=3 segment-costs=[303907, 391] cpu-comparison-result=16 [max(6 (self) vs 16 (sum children))]
+|  |  |  max-parallelism=6 segment-costs=[303907, 391] cpu-comparison-result=16 [max(6 (self) vs 16 (sum children))]
 |  |  |  89:AGGREGATE [FINALIZE]
 |  |  |  |  output: sum:merge(ss_quantity * ss_sales_price), max:merge(tpcds_cmax)
 |  |  |  |  group by: c_customer_sk
@@ -5563,9 +5563,9 @@ max-parallelism=12 segment-costs=[32154, 29405, 300, 6] cpu-comparison-result=75
 |  |  |  |  tuple-ids=39 row-size=36B cardinality=100.00K cost=3907
 |  |  |  |  in pipelines: 36(GETNEXT)
 |  |  |  |
-|  |  |  F23:PLAN FRAGMENT [RANDOM] hosts=3 instances=12
+|  |  |  F23:PLAN FRAGMENT [RANDOM] hosts=3 instances=12 (adjusted from 48)
 |  |  |  Per-Instance Resources: mem-estimate=26.94MB mem-reservation=10.00MB thread-reservation=1
-|  |  |  max-parallelism=12 segment-costs=[11555371, 3907] cpu-comparison-result=16 [max(12 (self) vs 16 (sum children))]
+|  |  |  max-parallelism=12 segment-costs=[102755368, 3907] cpu-comparison-result=16 [max(12 (self) vs 16 (sum children))]
 |  |  |  47:AGGREGATE [STREAMING]
 |  |  |  |  output: sum(CAST(ss_quantity AS DECIMAL(10,0)) * ss_sales_price), max(max(csales))
 |  |  |  |  group by: c_customer_sk
@@ -5593,7 +5593,7 @@ max-parallelism=12 segment-costs=[32154, 29405, 300, 6] cpu-comparison-result=75
 |  |  |  |  |
 |  |  |  |  F29:PLAN FRAGMENT [UNPARTITIONED] hosts=1 instances=1
 |  |  |  |  Per-Instance Resources: mem-estimate=96.00KB mem-reservation=0B thread-reservation=1
-|  |  |  |  max-parallelism=1 segment-costs=[2, 1] cpu-comparison-result=12 [max(2 (self) vs 12 (sum children))]
+|  |  |  |  max-parallelism=2 segment-costs=[2, 1] cpu-comparison-result=12 [max(2 (self) vs 12 (sum children))]
 |  |  |  |  86:AGGREGATE [FINALIZE]
 |  |  |  |  |  output: max:merge(csales)
 |  |  |  |  |  mem-estimate=16.00KB mem-reservation=0B spill-buffer=2.00MB thread-reservation=0
@@ -5605,9 +5605,9 @@ max-parallelism=12 segment-costs=[32154, 29405, 300, 6] cpu-comparison-result=75
 |  |  |  |  |  tuple-ids=37 row-size=16B cardinality=1 cost=1
 |  |  |  |  |  in pipelines: 44(GETNEXT)
 |  |  |  |  |
-|  |  |  |  F28:PLAN FRAGMENT [HASH(c_customer_sk)] hosts=3 instances=6 (adjusted from 12)
+|  |  |  |  F28:PLAN FRAGMENT [HASH(c_customer_sk)] hosts=3 instances=6 (adjusted from 48)
 |  |  |  |  Per-Instance Resources: mem-estimate=10.92MB mem-reservation=1.94MB thread-reservation=1
-|  |  |  |  max-parallelism=3 segment-costs=[202344, 100000, 1] cpu-comparison-result=12 [max(6 (self) vs 12 (sum children))]
+|  |  |  |  max-parallelism=6 segment-costs=[202344, 100000, 1] cpu-comparison-result=12 [max(6 (self) vs 12 (sum children))]
 |  |  |  |  44:AGGREGATE
 |  |  |  |  |  output: max(sum(ss_quantity * ss_sales_price))
 |  |  |  |  |  mem-estimate=16.00KB mem-reservation=0B spill-buffer=2.00MB thread-reservation=0
@@ -5626,10 +5626,10 @@ max-parallelism=12 segment-costs=[32154, 29405, 300, 6] cpu-comparison-result=75
 |  |  |  |  |  tuple-ids=35 row-size=20B cardinality=100.00K cost=2344
 |  |  |  |  |  in pipelines: 38(GETNEXT)
 |  |  |  |  |
-|  |  |  |  F25:PLAN FRAGMENT [RANDOM] hosts=3 instances=12
+|  |  |  |  F25:PLAN FRAGMENT [RANDOM] hosts=3 instances=12 (adjusted from 48)
 |  |  |  |  Per-Host Shared Resources: mem-estimate=1.00MB mem-reservation=1.00MB thread-reservation=0 runtime-filters-memory=1.00MB
 |  |  |  |  Per-Instance Resources: mem-estimate=26.56MB mem-reservation=6.00MB thread-reservation=1
-|  |  |  |  max-parallelism=12 segment-costs=[9989034, 2344] cpu-comparison-result=12 [max(12 (self) vs 8 (sum children))]
+|  |  |  |  max-parallelism=12 segment-costs=[101189027, 2344] cpu-comparison-result=12 [max(12 (self) vs 8 (sum children))]
 |  |  |  |  43:AGGREGATE [STREAMING]
 |  |  |  |  |  output: sum(CAST(ss_quantity AS DECIMAL(10,0)) * ss_sales_price)
 |  |  |  |  |  group by: c_customer_sk
@@ -5661,7 +5661,7 @@ max-parallelism=12 segment-costs=[32154, 29405, 300, 6] cpu-comparison-result=75
 |  |  |  |  |  |
 |  |  |  |  |  F27:PLAN FRAGMENT [RANDOM] hosts=1 instances=1
 |  |  |  |  |  Per-Instance Resources: mem-estimate=16.03MB mem-reservation=512.00KB thread-reservation=1
-|  |  |  |  |  max-parallelism=1 segment-costs=[1173]
+|  |  |  |  |  max-parallelism=1 segment-costs=[51173]
 |  |  |  |  |  39:SCAN HDFS [tpcds_parquet.customer, RANDOM]
 |  |  |  |  |     HDFS partitions=1/1 files=1 size=5.49MB
 |  |  |  |  |     stored statistics:
@@ -5669,7 +5669,7 @@ max-parallelism=12 segment-costs=[32154, 29405, 300, 6] cpu-comparison-result=75
 |  |  |  |  |       columns: all
 |  |  |  |  |     extrapolated-rows=disabled max-scan-range-rows=100.00K
 |  |  |  |  |     mem-estimate=16.00MB mem-reservation=512.00KB thread-reservation=0
-|  |  |  |  |     tuple-ids=33 row-size=4B cardinality=100.00K cost=391
+|  |  |  |  |     tuple-ids=33 row-size=4B cardinality=100.00K cost=50391
 |  |  |  |  |     in pipelines: 39(GETNEXT)
 |  |  |  |  |
 |  |  |  |  41:HASH JOIN [INNER JOIN, BROADCAST]
@@ -5696,7 +5696,7 @@ max-parallelism=12 segment-costs=[32154, 29405, 300, 6] cpu-comparison-result=75
 |  |  |  |  |  |
 |  |  |  |  |  F26:PLAN FRAGMENT [RANDOM] hosts=1 instances=1
 |  |  |  |  |  Per-Instance Resources: mem-estimate=16.05MB mem-reservation=512.00KB thread-reservation=1
-|  |  |  |  |  max-parallelism=1 segment-costs=[73638]
+|  |  |  |  |  max-parallelism=1 segment-costs=[123638]
 |  |  |  |  |  40:SCAN HDFS [tpcds_parquet.date_dim, RANDOM]
 |  |  |  |  |     HDFS partitions=1/1 files=1 size=2.15MB
 |  |  |  |  |     predicates: d_year IN (CAST(2000 AS INT), CAST(2001 AS INT), CAST(2002 AS INT), CAST(2003 AS INT))
@@ -5707,7 +5707,7 @@ max-parallelism=12 segment-costs=[32154, 29405, 300, 6] cpu-comparison-result=75
 |  |  |  |  |     parquet statistics predicates: d_year IN (CAST(2000 AS INT), CAST(2001 AS INT), CAST(2002 AS INT), CAST(2003 AS INT))
 |  |  |  |  |     parquet dictionary predicates: d_year IN (CAST(2000 AS INT), CAST(2001 AS INT), CAST(2002 AS INT), CAST(2003 AS INT))
 |  |  |  |  |     mem-estimate=16.00MB mem-reservation=512.00KB thread-reservation=0
-|  |  |  |  |     tuple-ids=34 row-size=8B cardinality=1.49K cost=73620
+|  |  |  |  |     tuple-ids=34 row-size=8B cardinality=1.49K cost=123620
 |  |  |  |  |     in pipelines: 40(GETNEXT)
 |  |  |  |  |
 |  |  |  |  38:SCAN HDFS [tpcds_parquet.store_sales, RANDOM]
@@ -5719,7 +5719,7 @@ max-parallelism=12 segment-costs=[32154, 29405, 300, 6] cpu-comparison-result=75
 |  |  |  |       columns: all
 |  |  |  |     extrapolated-rows=disabled max-scan-range-rows=130.09K
 |  |  |  |     mem-estimate=16.00MB mem-reservation=1.00MB thread-reservation=0
-|  |  |  |     tuple-ids=32 row-size=16B cardinality=2.88M cost=45007
+|  |  |  |     tuple-ids=32 row-size=16B cardinality=2.88M cost=91245000
 |  |  |  |     in pipelines: 38(GETNEXT)
 |  |  |  |
 |  |  |  45:HASH JOIN [INNER JOIN, BROADCAST]
@@ -5746,7 +5746,7 @@ max-parallelism=12 segment-costs=[32154, 29405, 300, 6] cpu-comparison-result=75
 |  |  |  |  |
 |  |  |  |  F24:PLAN FRAGMENT [RANDOM] hosts=1 instances=1
 |  |  |  |  Per-Instance Resources: mem-estimate=16.03MB mem-reservation=512.00KB thread-reservation=1
-|  |  |  |  max-parallelism=1 segment-costs=[1173]
+|  |  |  |  max-parallelism=1 segment-costs=[51173]
 |  |  |  |  37:SCAN HDFS [tpcds_parquet.customer, RANDOM]
 |  |  |  |     HDFS partitions=1/1 files=1 size=5.49MB
 |  |  |  |     runtime filters: RF025[min_max] -> tpcds_parquet.customer.c_customer_sk
@@ -5755,7 +5755,7 @@ max-parallelism=12 segment-costs=[32154, 29405, 300, 6] cpu-comparison-result=75
 |  |  |  |       columns: all
 |  |  |  |     extrapolated-rows=disabled max-scan-range-rows=100.00K
 |  |  |  |     mem-estimate=16.00MB mem-reservation=512.00KB thread-reservation=0
-|  |  |  |     tuple-ids=31 row-size=4B cardinality=100.00K cost=391
+|  |  |  |     tuple-ids=31 row-size=4B cardinality=100.00K cost=50391
 |  |  |  |     in pipelines: 37(GETNEXT)
 |  |  |  |
 |  |  |  36:SCAN HDFS [tpcds_parquet.store_sales, RANDOM]
@@ -5767,7 +5767,7 @@ max-parallelism=12 segment-costs=[32154, 29405, 300, 6] cpu-comparison-result=75
 |  |  |       columns: all
 |  |  |     extrapolated-rows=disabled max-scan-range-rows=130.09K
 |  |  |     mem-estimate=16.00MB mem-reservation=1.00MB thread-reservation=0
-|  |  |     tuple-ids=30 row-size=12B cardinality=2.88M cost=33755
+|  |  |     tuple-ids=30 row-size=12B cardinality=2.88M cost=91233752
 |  |  |     in pipelines: 36(GETNEXT)
 |  |  |
 |  |  48:HASH JOIN [INNER JOIN, BROADCAST]
@@ -5779,13 +5779,13 @@ max-parallelism=12 segment-costs=[32154, 29405, 300, 6] cpu-comparison-result=75
 |  |  |  in pipelines: 27(GETNEXT), 29(OPEN)
 |  |  |
 |  |  |--F53:PLAN FRAGMENT [RANDOM] hosts=2 instances=2
-|  |  |  |  Per-Instance Resources: mem-estimate=8.77MB mem-reservation=8.75MB thread-reservation=1 runtime-filters-memory=1.00MB
+|  |  |  |  Per-Instance Resources: mem-estimate=2.95MB mem-reservation=2.94MB thread-reservation=1 runtime-filters-memory=1.00MB
 |  |  |  |  max-parallelism=2 segment-costs=[112]
 |  |  |  JOIN BUILD
 |  |  |  |  join-table-id=17 plan-id=18 cohort-id=06
 |  |  |  |  build expressions: d_date_sk
 |  |  |  |  runtime filters: RF028[bloom] <- d_date_sk, RF029[min_max] <- d_date_sk
-|  |  |  |  mem-estimate=7.75MB mem-reservation=7.75MB spill-buffer=64.00KB thread-reservation=0 cost=108
+|  |  |  |  mem-estimate=1.94MB mem-reservation=1.94MB spill-buffer=64.00KB thread-reservation=0 cost=108
 |  |  |  |
 |  |  |  79:EXCHANGE [BROADCAST]
 |  |  |  |  mem-estimate=16.00KB mem-reservation=0B thread-reservation=0
@@ -5794,7 +5794,7 @@ max-parallelism=12 segment-costs=[32154, 29405, 300, 6] cpu-comparison-result=75
 |  |  |  |
 |  |  |  F22:PLAN FRAGMENT [RANDOM] hosts=1 instances=1
 |  |  |  Per-Instance Resources: mem-estimate=16.06MB mem-reservation=512.00KB thread-reservation=1
-|  |  |  max-parallelism=1 segment-costs=[146957]
+|  |  |  max-parallelism=1 segment-costs=[196957]
 |  |  |  29:SCAN HDFS [tpcds_parquet.date_dim, RANDOM]
 |  |  |     HDFS partitions=1/1 files=1 size=2.15MB
 |  |  |     predicates: d_year = CAST(2000 AS INT), d_moy = CAST(2 AS INT)
@@ -5805,7 +5805,7 @@ max-parallelism=12 segment-costs=[32154, 29405, 300, 6] cpu-comparison-result=75
 |  |  |     parquet statistics predicates: d_year = CAST(2000 AS INT), d_moy = CAST(2 AS INT)
 |  |  |     parquet dictionary predicates: d_year = CAST(2000 AS INT), d_moy = CAST(2 AS INT)
 |  |  |     mem-estimate=16.00MB mem-reservation=512.00KB thread-reservation=0
-|  |  |     tuple-ids=23 row-size=12B cardinality=108 cost=146955
+|  |  |     tuple-ids=23 row-size=12B cardinality=108 cost=196955
 |  |  |     in pipelines: 29(GETNEXT)
 |  |  |
 |  |  27:SCAN HDFS [tpcds_parquet.web_sales, RANDOM]
@@ -5815,8 +5815,8 @@ max-parallelism=12 segment-costs=[32154, 29405, 300, 6] cpu-comparison-result=75
 |  |       table: rows=719.38K size=45.09MB
 |  |       columns: all
 |  |     extrapolated-rows=disabled max-scan-range-rows=644.77K
-|  |     mem-estimate=32.00MB mem-reservation=8.00MB thread-reservation=0
-|  |     tuple-ids=21 row-size=24B cardinality=719.38K cost=16861
+|  |     mem-estimate=16.00MB mem-reservation=8.00MB thread-reservation=0
+|  |     tuple-ids=21 row-size=24B cardinality=719.38K cost=116861
 |  |     in pipelines: 27(GETNEXT)
 |  |
 |  78:AGGREGATE [FINALIZE]
@@ -5832,10 +5832,10 @@ max-parallelism=12 segment-costs=[32154, 29405, 300, 6] cpu-comparison-result=75
 |  |  tuple-ids=28 row-size=50B cardinality=2.35M cost=124166
 |  |  in pipelines: 30(GETNEXT)
 |  |
-|  F17:PLAN FRAGMENT [RANDOM] hosts=3 instances=12
+|  F17:PLAN FRAGMENT [RANDOM] hosts=3 instances=12 (adjusted from 48)
 |  Per-Host Shared Resources: mem-estimate=2.00MB mem-reservation=2.00MB thread-reservation=0 runtime-filters-memory=2.00MB
 |  Per-Instance Resources: mem-estimate=34.27MB mem-reservation=17.50MB thread-reservation=1
-|  max-parallelism=12 segment-costs=[14686864, 124166] cpu-comparison-result=12 [max(12 (self) vs 8 (sum children))]
+|  max-parallelism=12 segment-costs=[105886861, 124166] cpu-comparison-result=12 [max(12 (self) vs 8 (sum children))]
 |  35:AGGREGATE [STREAMING]
 |  |  output: count(*)
 |  |  group by: substring(i_item_desc, CAST(1 AS BIGINT), CAST(30 AS BIGINT)), tpcds_parquet.item.i_item_sk, d_date
@@ -5868,7 +5868,7 @@ max-parallelism=12 segment-costs=[32154, 29405, 300, 6] cpu-comparison-result=75
 |  |  F19:PLAN FRAGMENT [RANDOM] hosts=1 instances=1
 |  |  Per-Host Shared Resources: mem-estimate=1.00MB mem-reservation=1.00MB thread-reservation=0 runtime-filters-memory=1.00MB
 |  |  Per-Instance Resources: mem-estimate=16.49MB mem-reservation=2.00MB thread-reservation=1
-|  |  max-parallelism=1 segment-costs=[4306]
+|  |  max-parallelism=1 segment-costs=[54306]
 |  |  32:SCAN HDFS [tpcds_parquet.item, RANDOM]
 |  |     HDFS partitions=1/1 files=1 size=1.73MB
 |  |     runtime filters: RF019[min_max] -> tpcds_parquet.item.i_item_sk, RF018[bloom] -> tpcds_parquet.item.i_item_sk
@@ -5877,7 +5877,7 @@ max-parallelism=12 segment-costs=[32154, 29405, 300, 6] cpu-comparison-result=75
 |  |       columns: all
 |  |     extrapolated-rows=disabled max-scan-range-rows=18.00K
 |  |     mem-estimate=16.00MB mem-reservation=2.00MB thread-reservation=0
-|  |     tuple-ids=26 row-size=120B cardinality=18.00K cost=2118
+|  |     tuple-ids=26 row-size=120B cardinality=18.00K cost=52118
 |  |     in pipelines: 32(GETNEXT)
 |  |
 |  33:HASH JOIN [INNER JOIN, BROADCAST]
@@ -5904,7 +5904,7 @@ max-parallelism=12 segment-costs=[32154, 29405, 300, 6] cpu-comparison-result=75
 |  |  |
 |  |  F18:PLAN FRAGMENT [RANDOM] hosts=1 instances=1
 |  |  Per-Instance Resources: mem-estimate=16.13MB mem-reservation=2.00MB thread-reservation=1
-|  |  max-parallelism=1 segment-costs=[75240]
+|  |  max-parallelism=1 segment-costs=[125240]
 |  |  31:SCAN HDFS [tpcds_parquet.date_dim, RANDOM]
 |  |     HDFS partitions=1/1 files=1 size=2.15MB
 |  |     predicates: d_year IN (CAST(2000 AS INT), CAST(2001 AS INT), CAST(2002 AS INT), CAST(2003 AS INT))
@@ -5915,7 +5915,7 @@ max-parallelism=12 segment-costs=[32154, 29405, 300, 6] cpu-comparison-result=75
 |  |     parquet statistics predicates: d_year IN (CAST(2000 AS INT), CAST(2001 AS INT), CAST(2002 AS INT), CAST(2003 AS INT))
 |  |     parquet dictionary predicates: d_year IN (CAST(2000 AS INT), CAST(2001 AS INT), CAST(2002 AS INT), CAST(2003 AS INT))
 |  |     mem-estimate=16.00MB mem-reservation=2.00MB thread-reservation=0
-|  |     tuple-ids=25 row-size=30B cardinality=1.49K cost=75190
+|  |     tuple-ids=25 row-size=30B cardinality=1.49K cost=125190
 |  |     in pipelines: 31(GETNEXT)
 |  |
 |  30:SCAN HDFS [tpcds_parquet.store_sales, RANDOM]
@@ -5927,7 +5927,7 @@ max-parallelism=12 segment-costs=[32154, 29405, 300, 6] cpu-comparison-result=75
 |       columns: all
 |     extrapolated-rows=disabled max-scan-range-rows=130.09K
 |     mem-estimate=16.00MB mem-reservation=512.00KB thread-reservation=0
-|     tuple-ids=24 row-size=12B cardinality=2.88M cost=33755
+|     tuple-ids=24 row-size=12B cardinality=2.88M cost=91233752
 |     in pipelines: 30(GETNEXT)
 |
 74:AGGREGATE [FINALIZE]
@@ -5942,9 +5942,9 @@ max-parallelism=12 segment-costs=[32154, 29405, 300, 6] cpu-comparison-result=75
 |  tuple-ids=20 row-size=52B cardinality=10.53K cost=576
 |  in pipelines: 57(GETNEXT)
 |
-F03:PLAN FRAGMENT [HASH(itemdesc,i_item_sk,d_date)] hosts=3 instances=6 (adjusted from 12)
+F03:PLAN FRAGMENT [HASH(itemdesc,i_item_sk,d_date)] hosts=3 instances=6 (adjusted from 48)
 Per-Instance Resources: mem-estimate=54.63MB mem-reservation=36.00MB thread-reservation=1
-max-parallelism=3 segment-costs=[9542330, 267032, 576] cpu-comparison-result=39 [max(6 (self) vs 39 (sum children))]
+max-parallelism=6 segment-costs=[9542330, 267032, 576] cpu-comparison-result=39 [max(6 (self) vs 39 (sum children))]
 26:AGGREGATE [STREAMING]
 |  output: sum(CAST(cs_quantity AS DECIMAL(10,0)) * cs_list_price)
 |  group by: c_last_name, c_first_name
@@ -5961,13 +5961,13 @@ max-parallelism=3 segment-costs=[9542330, 267032, 576] cpu-comparison-result=39
 |  in pipelines: 57(GETNEXT), 01(OPEN)
 |
 |--F36:PLAN FRAGMENT [HASH(itemdesc,i_item_sk,d_date)] hosts=3 instances=3
-|  |  Per-Instance Resources: mem-estimate=14.37MB mem-reservation=12.50MB thread-reservation=1 runtime-filters-memory=1.00MB
+|  |  Per-Instance Resources: mem-estimate=8.62MB mem-reservation=6.75MB thread-reservation=1 runtime-filters-memory=1.00MB
 |  |  max-parallelism=3 segment-costs=[14474] cpu-comparison-result=27 [max(12 (self) vs 27 (sum children))]
 |  JOIN BUILD
 |  |  join-table-id=00 plan-id=01 cohort-id=01
 |  |  build expressions: cs_item_sk
 |  |  runtime filters: RF000[bloom] <- cs_item_sk, RF001[min_max] <- cs_item_sk
-|  |  mem-estimate=11.50MB mem-reservation=11.50MB spill-buffer=128.00KB thread-reservation=0 cost=10526
+|  |  mem-estimate=5.75MB mem-reservation=5.75MB spill-buffer=128.00KB thread-reservation=0 cost=10526
 |  |
 |  72:EXCHANGE [BROADCAST]
 |  |  mem-estimate=1.87MB mem-reservation=0B thread-reservation=0
@@ -5976,7 +5976,7 @@ max-parallelism=3 segment-costs=[9542330, 267032, 576] cpu-comparison-result=39
 |  |
 |  F15:PLAN FRAGMENT [HASH(cs_bill_customer_sk)] hosts=3 instances=6 (adjusted from 3)
 |  Per-Instance Resources: mem-estimate=1010.56KB mem-reservation=0B thread-reservation=1
-|  max-parallelism=3 segment-costs=[12706]
+|  max-parallelism=6 segment-costs=[12706]
 |  24:HASH JOIN [INNER JOIN, PARTITIONED]
 |  |  hash-table-id=01
 |  |  hash predicates: cs_bill_customer_sk = customer.c_customer_sk
@@ -6001,7 +6001,7 @@ max-parallelism=3 segment-costs=[9542330, 267032, 576] cpu-comparison-result=39
 |  |  |
 |  |  F14:PLAN FRAGMENT [RANDOM] hosts=1 instances=1
 |  |  Per-Instance Resources: mem-estimate=17.03MB mem-reservation=1.00MB thread-reservation=1
-|  |  max-parallelism=1 segment-costs=[8197]
+|  |  max-parallelism=1 segment-costs=[58197]
 |  |  02:SCAN HDFS [tpcds_parquet.customer, RANDOM]
 |  |     HDFS partitions=1/1 files=1 size=5.49MB
 |  |     stored statistics:
@@ -6009,7 +6009,7 @@ max-parallelism=3 segment-costs=[9542330, 267032, 576] cpu-comparison-result=39
 |  |       columns: all
 |  |     extrapolated-rows=disabled max-scan-range-rows=100.00K
 |  |     mem-estimate=16.00MB mem-reservation=1.00MB thread-reservation=0
-|  |     tuple-ids=1 row-size=40B cardinality=100.00K cost=3903
+|  |     tuple-ids=1 row-size=40B cardinality=100.00K cost=53903
 |  |     in pipelines: 02(GETNEXT)
 |  |
 |  70:EXCHANGE [HASH(cs_bill_customer_sk)]
@@ -6019,8 +6019,8 @@ max-parallelism=3 segment-costs=[9542330, 267032, 576] cpu-comparison-result=39
 |  |
 |  F04:PLAN FRAGMENT [RANDOM] hosts=3 instances=3
 |  Per-Host Shared Resources: mem-estimate=2.00MB mem-reservation=2.00MB thread-reservation=0 runtime-filters-memory=2.00MB
-|  Per-Instance Resources: mem-estimate=49.97MB mem-reservation=8.00MB thread-reservation=1
-|  max-parallelism=3 segment-costs=[1561508]
+|  Per-Instance Resources: mem-estimate=17.97MB mem-reservation=8.00MB thread-reservation=1
+|  max-parallelism=3 segment-costs=[1711508]
 |  23:HASH JOIN [INNER JOIN, BROADCAST]
 |  |  hash-table-id=02
 |  |  hash predicates: cs_bill_customer_sk = c_customer_sk
@@ -6030,22 +6030,22 @@ max-parallelism=3 segment-costs=[9542330, 267032, 576] cpu-comparison-result=39
 |  |  in pipelines: 01(GETNEXT), 68(OPEN)
 |  |
 |  |--F38:PLAN FRAGMENT [RANDOM] hosts=3 instances=3
-|  |  |  Per-Instance Resources: mem-estimate=9.33MB mem-reservation=8.75MB thread-reservation=1 runtime-filters-memory=1.00MB
+|  |  |  Per-Instance Resources: mem-estimate=3.52MB mem-reservation=2.94MB thread-reservation=1 runtime-filters-memory=1.00MB
 |  |  |  max-parallelism=3 segment-costs=[11173] cpu-comparison-result=16 [max(3 (self) vs 16 (sum children))]
 |  |  JOIN BUILD
 |  |  |  join-table-id=02 plan-id=03 cohort-id=02
 |  |  |  build expressions: c_customer_sk
 |  |  |  runtime filters: RF008[bloom] <- c_customer_sk, RF009[min_max] <- c_customer_sk
-|  |  |  mem-estimate=7.75MB mem-reservation=7.75MB spill-buffer=64.00KB thread-reservation=0 cost=10000
+|  |  |  mem-estimate=1.94MB mem-reservation=1.94MB spill-buffer=64.00KB thread-reservation=0 cost=10000
 |  |  |
 |  |  69:EXCHANGE [BROADCAST]
 |  |  |  mem-estimate=591.56KB mem-reservation=0B thread-reservation=0
 |  |  |  tuple-ids=18 row-size=36B cardinality=10.00K cost=1173
 |  |  |  in pipelines: 68(GETNEXT)
 |  |  |
-|  |  F13:PLAN FRAGMENT [HASH(c_customer_sk)] hosts=3 instances=6 (adjusted from 12)
+|  |  F13:PLAN FRAGMENT [HASH(c_customer_sk)] hosts=3 instances=6 (adjusted from 48)
 |  |  Per-Instance Resources: mem-estimate=11.61MB mem-reservation=1.94MB thread-reservation=1
-|  |  max-parallelism=3 segment-costs=[303907, 391] cpu-comparison-result=16 [max(6 (self) vs 16 (sum children))]
+|  |  max-parallelism=6 segment-costs=[303907, 391] cpu-comparison-result=16 [max(6 (self) vs 16 (sum children))]
 |  |  68:AGGREGATE [FINALIZE]
 |  |  |  output: sum:merge(ss_quantity * ss_sales_price), max:merge(tpcds_cmax)
 |  |  |  group by: c_customer_sk
@@ -6059,9 +6059,9 @@ max-parallelism=3 segment-costs=[9542330, 267032, 576] cpu-comparison-result=39
 |  |  |  tuple-ids=18 row-size=36B cardinality=100.00K cost=3907
 |  |  |  in pipelines: 10(GETNEXT)
 |  |  |
-|  |  F06:PLAN FRAGMENT [RANDOM] hosts=3 instances=12
+|  |  F06:PLAN FRAGMENT [RANDOM] hosts=3 instances=12 (adjusted from 48)
 |  |  Per-Instance Resources: mem-estimate=26.94MB mem-reservation=10.00MB thread-reservation=1
-|  |  max-parallelism=12 segment-costs=[11555371, 3907] cpu-comparison-result=16 [max(12 (self) vs 16 (sum children))]
+|  |  max-parallelism=12 segment-costs=[102755368, 3907] cpu-comparison-result=16 [max(12 (self) vs 16 (sum children))]
 |  |  21:AGGREGATE [STREAMING]
 |  |  |  output: sum(CAST(ss_quantity AS DECIMAL(10,0)) * ss_sales_price), max(max(csales))
 |  |  |  group by: c_customer_sk
@@ -6089,7 +6089,7 @@ max-parallelism=3 segment-costs=[9542330, 267032, 576] cpu-comparison-result=39
 |  |  |  |
 |  |  |  F12:PLAN FRAGMENT [UNPARTITIONED] hosts=1 instances=1
 |  |  |  Per-Instance Resources: mem-estimate=96.00KB mem-reservation=0B thread-reservation=1
-|  |  |  max-parallelism=1 segment-costs=[2, 1] cpu-comparison-result=12 [max(2 (self) vs 12 (sum children))]
+|  |  |  max-parallelism=2 segment-costs=[2, 1] cpu-comparison-result=12 [max(2 (self) vs 12 (sum children))]
 |  |  |  65:AGGREGATE [FINALIZE]
 |  |  |  |  output: max:merge(csales)
 |  |  |  |  mem-estimate=16.00KB mem-reservation=0B spill-buffer=2.00MB thread-reservation=0
@@ -6101,9 +6101,9 @@ max-parallelism=3 segment-costs=[9542330, 267032, 576] cpu-comparison-result=39
 |  |  |  |  tuple-ids=16 row-size=16B cardinality=1 cost=1
 |  |  |  |  in pipelines: 18(GETNEXT)
 |  |  |  |
-|  |  |  F11:PLAN FRAGMENT [HASH(c_customer_sk)] hosts=3 instances=6 (adjusted from 12)
+|  |  |  F11:PLAN FRAGMENT [HASH(c_customer_sk)] hosts=3 instances=6 (adjusted from 48)
 |  |  |  Per-Instance Resources: mem-estimate=10.92MB mem-reservation=1.94MB thread-reservation=1
-|  |  |  max-parallelism=3 segment-costs=[202344, 100000, 1] cpu-comparison-result=12 [max(6 (self) vs 12 (sum children))]
+|  |  |  max-parallelism=6 segment-costs=[202344, 100000, 1] cpu-comparison-result=12 [max(6 (self) vs 12 (sum children))]
 |  |  |  18:AGGREGATE
 |  |  |  |  output: max(sum(ss_quantity * ss_sales_price))
 |  |  |  |  mem-estimate=16.00KB mem-reservation=0B spill-buffer=2.00MB thread-reservation=0
@@ -6122,10 +6122,10 @@ max-parallelism=3 segment-costs=[9542330, 267032, 576] cpu-comparison-result=39
 |  |  |  |  tuple-ids=14 row-size=20B cardinality=100.00K cost=2344
 |  |  |  |  in pipelines: 12(GETNEXT)
 |  |  |  |
-|  |  |  F08:PLAN FRAGMENT [RANDOM] hosts=3 instances=12
+|  |  |  F08:PLAN FRAGMENT [RANDOM] hosts=3 instances=12 (adjusted from 48)
 |  |  |  Per-Host Shared Resources: mem-estimate=1.00MB mem-reservation=1.00MB thread-reservation=0 runtime-filters-memory=1.00MB
 |  |  |  Per-Instance Resources: mem-estimate=26.56MB mem-reservation=6.00MB thread-reservation=1
-|  |  |  max-parallelism=12 segment-costs=[9989034, 2344] cpu-comparison-result=12 [max(12 (self) vs 8 (sum children))]
+|  |  |  max-parallelism=12 segment-costs=[101189027, 2344] cpu-comparison-result=12 [max(12 (self) vs 8 (sum children))]
 |  |  |  17:AGGREGATE [STREAMING]
 |  |  |  |  output: sum(CAST(ss_quantity AS DECIMAL(10,0)) * ss_sales_price)
 |  |  |  |  group by: c_customer_sk
@@ -6157,7 +6157,7 @@ max-parallelism=3 segment-costs=[9542330, 267032, 576] cpu-comparison-result=39
 |  |  |  |  |
 |  |  |  |  F10:PLAN FRAGMENT [RANDOM] hosts=1 instances=1
 |  |  |  |  Per-Instance Resources: mem-estimate=16.03MB mem-reservation=512.00KB thread-reservation=1
-|  |  |  |  max-parallelism=1 segment-costs=[1173]
+|  |  |  |  max-parallelism=1 segment-costs=[51173]
 |  |  |  |  13:SCAN HDFS [tpcds_parquet.customer, RANDOM]
 |  |  |  |     HDFS partitions=1/1 files=1 size=5.49MB
 |  |  |  |     stored statistics:
@@ -6165,7 +6165,7 @@ max-parallelism=3 segment-costs=[9542330, 267032, 576] cpu-comparison-result=39
 |  |  |  |       columns: all
 |  |  |  |     extrapolated-rows=disabled max-scan-range-rows=100.00K
 |  |  |  |     mem-estimate=16.00MB mem-reservation=512.00KB thread-reservation=0
-|  |  |  |     tuple-ids=12 row-size=4B cardinality=100.00K cost=391
+|  |  |  |     tuple-ids=12 row-size=4B cardinality=100.00K cost=50391
 |  |  |  |     in pipelines: 13(GETNEXT)
 |  |  |  |
 |  |  |  15:HASH JOIN [INNER JOIN, BROADCAST]
@@ -6192,7 +6192,7 @@ max-parallelism=3 segment-costs=[9542330, 267032, 576] cpu-comparison-result=39
 |  |  |  |  |
 |  |  |  |  F09:PLAN FRAGMENT [RANDOM] hosts=1 instances=1
 |  |  |  |  Per-Instance Resources: mem-estimate=16.05MB mem-reservation=512.00KB thread-reservation=1
-|  |  |  |  max-parallelism=1 segment-costs=[73638]
+|  |  |  |  max-parallelism=1 segment-costs=[123638]
 |  |  |  |  14:SCAN HDFS [tpcds_parquet.date_dim, RANDOM]
 |  |  |  |     HDFS partitions=1/1 files=1 size=2.15MB
 |  |  |  |     predicates: d_year IN (CAST(2000 AS INT), CAST(2001 AS INT), CAST(2002 AS INT), CAST(2003 AS INT))
@@ -6203,7 +6203,7 @@ max-parallelism=3 segment-costs=[9542330, 267032, 576] cpu-comparison-result=39
 |  |  |  |     parquet statistics predicates: d_year IN (CAST(2000 AS INT), CAST(2001 AS INT), CAST(2002 AS INT), CAST(2003 AS INT))
 |  |  |  |     parquet dictionary predicates: d_year IN (CAST(2000 AS INT), CAST(2001 AS INT), CAST(2002 AS INT), CAST(2003 AS INT))
 |  |  |  |     mem-estimate=16.00MB mem-reservation=512.00KB thread-reservation=0
-|  |  |  |     tuple-ids=13 row-size=8B cardinality=1.49K cost=73620
+|  |  |  |     tuple-ids=13 row-size=8B cardinality=1.49K cost=123620
 |  |  |  |     in pipelines: 14(GETNEXT)
 |  |  |  |
 |  |  |  12:SCAN HDFS [tpcds_parquet.store_sales, RANDOM]
@@ -6215,7 +6215,7 @@ max-parallelism=3 segment-costs=[9542330, 267032, 576] cpu-comparison-result=39
 |  |  |       columns: all
 |  |  |     extrapolated-rows=disabled max-scan-range-rows=130.09K
 |  |  |     mem-estimate=16.00MB mem-reservation=1.00MB thread-reservation=0
-|  |  |     tuple-ids=11 row-size=16B cardinality=2.88M cost=45007
+|  |  |     tuple-ids=11 row-size=16B cardinality=2.88M cost=91245000
 |  |  |     in pipelines: 12(GETNEXT)
 |  |  |
 |  |  19:HASH JOIN [INNER JOIN, BROADCAST]
@@ -6242,7 +6242,7 @@ max-parallelism=3 segment-costs=[9542330, 267032, 576] cpu-comparison-result=39
 |  |  |  |
 |  |  |  F07:PLAN FRAGMENT [RANDOM] hosts=1 instances=1
 |  |  |  Per-Instance Resources: mem-estimate=16.03MB mem-reservation=512.00KB thread-reservation=1
-|  |  |  max-parallelism=1 segment-costs=[1173]
+|  |  |  max-parallelism=1 segment-costs=[51173]
 |  |  |  11:SCAN HDFS [tpcds_parquet.customer, RANDOM]
 |  |  |     HDFS partitions=1/1 files=1 size=5.49MB
 |  |  |     runtime filters: RF007[min_max] -> tpcds_parquet.customer.c_customer_sk
@@ -6251,7 +6251,7 @@ max-parallelism=3 segment-costs=[9542330, 267032, 576] cpu-comparison-result=39
 |  |  |       columns: all
 |  |  |     extrapolated-rows=disabled max-scan-range-rows=100.00K
 |  |  |     mem-estimate=16.00MB mem-reservation=512.00KB thread-reservation=0
-|  |  |     tuple-ids=10 row-size=4B cardinality=100.00K cost=391
+|  |  |     tuple-ids=10 row-size=4B cardinality=100.00K cost=50391
 |  |  |     in pipelines: 11(GETNEXT)
 |  |  |
 |  |  10:SCAN HDFS [tpcds_parquet.store_sales, RANDOM]
@@ -6263,7 +6263,7 @@ max-parallelism=3 segment-costs=[9542330, 267032, 576] cpu-comparison-result=39
 |  |       columns: all
 |  |     extrapolated-rows=disabled max-scan-range-rows=130.09K
 |  |     mem-estimate=16.00MB mem-reservation=1.00MB thread-reservation=0
-|  |     tuple-ids=9 row-size=12B cardinality=2.88M cost=33755
+|  |     tuple-ids=9 row-size=12B cardinality=2.88M cost=91233752
 |  |     in pipelines: 10(GETNEXT)
 |  |
 |  22:HASH JOIN [INNER JOIN, BROADCAST]
@@ -6275,13 +6275,13 @@ max-parallelism=3 segment-costs=[9542330, 267032, 576] cpu-comparison-result=39
 |  |  in pipelines: 01(GETNEXT), 03(OPEN)
 |  |
 |  |--F43:PLAN FRAGMENT [RANDOM] hosts=3 instances=3
-|  |  |  Per-Instance Resources: mem-estimate=8.77MB mem-reservation=8.75MB thread-reservation=1 runtime-filters-memory=1.00MB
+|  |  |  Per-Instance Resources: mem-estimate=2.95MB mem-reservation=2.94MB thread-reservation=1 runtime-filters-memory=1.00MB
 |  |  |  max-parallelism=3 segment-costs=[114]
 |  |  JOIN BUILD
 |  |  |  join-table-id=07 plan-id=08 cohort-id=02
 |  |  |  build expressions: d_date_sk
 |  |  |  runtime filters: RF010[bloom] <- d_date_sk, RF011[min_max] <- d_date_sk
-|  |  |  mem-estimate=7.75MB mem-reservation=7.75MB spill-buffer=64.00KB thread-reservation=0 cost=108
+|  |  |  mem-estimate=1.94MB mem-reservation=1.94MB spill-buffer=64.00KB thread-reservation=0 cost=108
 |  |  |
 |  |  58:EXCHANGE [BROADCAST]
 |  |  |  mem-estimate=16.00KB mem-reservation=0B thread-reservation=0
@@ -6290,7 +6290,7 @@ max-parallelism=3 segment-costs=[9542330, 267032, 576] cpu-comparison-result=39
 |  |  |
 |  |  F05:PLAN FRAGMENT [RANDOM] hosts=1 instances=1
 |  |  Per-Instance Resources: mem-estimate=16.06MB mem-reservation=512.00KB thread-reservation=1
-|  |  max-parallelism=1 segment-costs=[146957]
+|  |  max-parallelism=1 segment-costs=[196957]
 |  |  03:SCAN HDFS [tpcds_parquet.date_dim, RANDOM]
 |  |     HDFS partitions=1/1 files=1 size=2.15MB
 |  |     predicates: d_year = CAST(2000 AS INT), d_moy = CAST(2 AS INT)
@@ -6301,7 +6301,7 @@ max-parallelism=3 segment-costs=[9542330, 267032, 576] cpu-comparison-result=39
 |  |     parquet statistics predicates: d_year = CAST(2000 AS INT), d_moy = CAST(2 AS INT)
 |  |     parquet dictionary predicates: d_year = CAST(2000 AS INT), d_moy = CAST(2 AS INT)
 |  |     mem-estimate=16.00MB mem-reservation=512.00KB thread-reservation=0
-|  |     tuple-ids=2 row-size=12B cardinality=108 cost=146955
+|  |     tuple-ids=2 row-size=12B cardinality=108 cost=196955
 |  |     in pipelines: 03(GETNEXT)
 |  |
 |  01:SCAN HDFS [tpcds_parquet.catalog_sales, RANDOM]
@@ -6311,8 +6311,8 @@ max-parallelism=3 segment-costs=[9542330, 267032, 576] cpu-comparison-result=39
 |       table: rows=1.44M size=96.62MB
 |       columns: all
 |     extrapolated-rows=disabled max-scan-range-rows=650.14K
-|     mem-estimate=48.00MB mem-reservation=8.00MB thread-reservation=0
-|     tuple-ids=0 row-size=24B cardinality=1.44M cost=33787
+|     mem-estimate=16.00MB mem-reservation=8.00MB thread-reservation=0
+|     tuple-ids=0 row-size=24B cardinality=1.44M cost=183787
 |     in pipelines: 01(GETNEXT)
 |
 57:AGGREGATE [FINALIZE]
@@ -6328,10 +6328,10 @@ max-parallelism=3 segment-costs=[9542330, 267032, 576] cpu-comparison-result=39
 |  tuple-ids=7 row-size=50B cardinality=2.35M cost=124166
 |  in pipelines: 04(GETNEXT)
 |
-F00:PLAN FRAGMENT [RANDOM] hosts=3 instances=12
+F00:PLAN FRAGMENT [RANDOM] hosts=3 instances=12 (adjusted from 48)
 Per-Host Shared Resources: mem-estimate=2.00MB mem-reservation=2.00MB thread-reservation=0 runtime-filters-memory=2.00MB
 Per-Instance Resources: mem-estimate=34.27MB mem-reservation=17.50MB thread-reservation=1
-max-parallelism=12 segment-costs=[14686864, 124166] cpu-comparison-result=12 [max(12 (self) vs 8 (sum children))]
+max-parallelism=12 segment-costs=[105886861, 124166] cpu-comparison-result=12 [max(12 (self) vs 8 (sum children))]
 09:AGGREGATE [STREAMING]
 |  output: count(*)
 |  group by: substring(i_item_desc, CAST(1 AS BIGINT), CAST(30 AS BIGINT)), tpcds_parquet.item.i_item_sk, d_date
@@ -6364,7 +6364,7 @@ max-parallelism=12 segment-costs=[14686864, 124166] cpu-comparison-result=12 [ma
 |  F02:PLAN FRAGMENT [RANDOM] hosts=1 instances=1
 |  Per-Host Shared Resources: mem-estimate=1.00MB mem-reservation=1.00MB thread-reservation=0 runtime-filters-memory=1.00MB
 |  Per-Instance Resources: mem-estimate=16.49MB mem-reservation=2.00MB thread-reservation=1
-|  max-parallelism=1 segment-costs=[4306]
+|  max-parallelism=1 segment-costs=[54306]
 |  06:SCAN HDFS [tpcds_parquet.item, RANDOM]
 |     HDFS partitions=1/1 files=1 size=1.73MB
 |     runtime filters: RF001[min_max] -> tpcds_parquet.item.i_item_sk, RF000[bloom] -> tpcds_parquet.item.i_item_sk
@@ -6373,7 +6373,7 @@ max-parallelism=12 segment-costs=[14686864, 124166] cpu-comparison-result=12 [ma
 |       columns: all
 |     extrapolated-rows=disabled max-scan-range-rows=18.00K
 |     mem-estimate=16.00MB mem-reservation=2.00MB thread-reservation=0
-|     tuple-ids=5 row-size=120B cardinality=18.00K cost=2118
+|     tuple-ids=5 row-size=120B cardinality=18.00K cost=52118
 |     in pipelines: 06(GETNEXT)
 |
 07:HASH JOIN [INNER JOIN, BROADCAST]
@@ -6400,7 +6400,7 @@ max-parallelism=12 segment-costs=[14686864, 124166] cpu-comparison-result=12 [ma
 |  |
 |  F01:PLAN FRAGMENT [RANDOM] hosts=1 instances=1
 |  Per-Instance Resources: mem-estimate=16.13MB mem-reservation=2.00MB thread-reservation=1
-|  max-parallelism=1 segment-costs=[75240]
+|  max-parallelism=1 segment-costs=[125240]
 |  05:SCAN HDFS [tpcds_parquet.date_dim, RANDOM]
 |     HDFS partitions=1/1 files=1 size=2.15MB
 |     predicates: d_year IN (CAST(2000 AS INT), CAST(2001 AS INT), CAST(2002 AS INT), CAST(2003 AS INT))
@@ -6411,7 +6411,7 @@ max-parallelism=12 segment-costs=[14686864, 124166] cpu-comparison-result=12 [ma
 |     parquet statistics predicates: d_year IN (CAST(2000 AS INT), CAST(2001 AS INT), CAST(2002 AS INT), CAST(2003 AS INT))
 |     parquet dictionary predicates: d_year IN (CAST(2000 AS INT), CAST(2001 AS INT), CAST(2002 AS INT), CAST(2003 AS INT))
 |     mem-estimate=16.00MB mem-reservation=2.00MB thread-reservation=0
-|     tuple-ids=4 row-size=30B cardinality=1.49K cost=75190
+|     tuple-ids=4 row-size=30B cardinality=1.49K cost=125190
 |     in pipelines: 05(GETNEXT)
 |
 04:SCAN HDFS [tpcds_parquet.store_sales, RANDOM]
@@ -6423,7 +6423,7 @@ max-parallelism=12 segment-costs=[14686864, 124166] cpu-comparison-result=12 [ma
      columns: all
    extrapolated-rows=disabled max-scan-range-rows=130.09K
    mem-estimate=16.00MB mem-reservation=512.00KB thread-reservation=0
-   tuple-ids=3 row-size=12B cardinality=2.88M cost=33755
+   tuple-ids=3 row-size=12B cardinality=2.88M cost=91233752
    in pipelines: 04(GETNEXT)
 ====
 # TPCDS-Q49
@@ -6530,8 +6530,8 @@ ORDER BY 1,
 LIMIT 100;
 
 ---- PARALLELPLANS
-Max Per-Host Resource Reservation: Memory=191.31MB Threads=25
-Per-Host Resource Estimates: Memory=503MB
+Max Per-Host Resource Reservation: Memory=168.06MB Threads=25
+Per-Host Resource Estimates: Memory=416MB
 F15:PLAN FRAGMENT [UNPARTITIONED] hosts=1 instances=1
 |  Per-Instance Resources: mem-estimate=24.84MB mem-reservation=15.94MB thread-reservation=1
 |  max-parallelism=1 segment-costs=[8891, 17696, 35376, 119504, 400, 500] cpu-comparison-result=26 [max(1 (self) vs 26 (sum children))]
@@ -6591,9 +6591,9 @@ PLAN-ROOT SINK
 |  |  tuple-ids=56 row-size=72B cardinality=17.05K cost=1266
 |  |  in pipelines: 29(GETNEXT)
 |  |
-|  F13:PLAN FRAGMENT [HASH(sts.ss_item_sk)] hosts=3 instances=6 (adjusted from 12)
+|  F13:PLAN FRAGMENT [HASH(sts.ss_item_sk)] hosts=3 instances=6 (adjusted from 48)
 |  Per-Instance Resources: mem-estimate=16.00MB mem-reservation=7.94MB thread-reservation=1
-|  max-parallelism=3 segment-costs=[86275, 17055, 1266] cpu-comparison-result=12 [max(6 (self) vs 12 (sum children))]
+|  max-parallelism=6 segment-costs=[86275, 17055, 1266] cpu-comparison-result=12 [max(6 (self) vs 12 (sum children))]
 |  29:SORT
 |  |  order by: (CAST(sum(coalesce(sr.sr_return_quantity, 0)) AS DECIMAL(15,4)) / CAST(sum(coalesce(sts.ss_quantity, 0)) AS DECIMAL(15,4))) ASC
 |  |  materialized: (CAST(sum(coalesce(sr.sr_return_quantity, 0)) AS DECIMAL(15,4)) / CAST(sum(coalesce(sts.ss_quantity, 0)) AS DECIMAL(15,4)))
@@ -6613,10 +6613,10 @@ PLAN-ROOT SINK
 |  |  tuple-ids=19 row-size=56B cardinality=17.05K cost=1000
 |  |  in pipelines: 23(GETNEXT)
 |  |
-|  F10:PLAN FRAGMENT [RANDOM] hosts=3 instances=12
+|  F10:PLAN FRAGMENT [RANDOM] hosts=3 instances=12 (adjusted from 48)
 |  Per-Host Shared Resources: mem-estimate=1.00MB mem-reservation=1.00MB thread-reservation=0 runtime-filters-memory=1.00MB
 |  Per-Instance Resources: mem-estimate=27.41MB mem-reservation=6.00MB thread-reservation=1
-|  max-parallelism=12 segment-costs=[9680620, 1000] cpu-comparison-result=12 [max(12 (self) vs 8 (sum children))]
+|  max-parallelism=12 segment-costs=[100880619, 1000] cpu-comparison-result=12 [max(12 (self) vs 8 (sum children))]
 |  28:AGGREGATE [STREAMING]
 |  |  output: sum(CAST(coalesce(sr.sr_return_quantity, CAST(0 AS INT)) AS BIGINT)), sum(CAST(coalesce(sts.ss_quantity, CAST(0 AS INT)) AS BIGINT)), sum(coalesce(sr.sr_return_amt, CAST(0 AS DECIMAL(7,2)))), sum(coalesce(sts.ss_net_paid, CAST(0 AS DECIMAL(7,2))))
 |  |  group by: sts.ss_item_sk
@@ -6648,7 +6648,7 @@ PLAN-ROOT SINK
 |  |  |
 |  |  F12:PLAN FRAGMENT [RANDOM] hosts=1 instances=1
 |  |  Per-Instance Resources: mem-estimate=16.06MB mem-reservation=512.00KB thread-reservation=1
-|  |  max-parallelism=1 segment-costs=[146957]
+|  |  max-parallelism=1 segment-costs=[196957]
 |  |  25:SCAN HDFS [tpcds_parquet.date_dim, RANDOM]
 |  |     HDFS partitions=1/1 files=1 size=2.15MB
 |  |     predicates: d_year = CAST(2001 AS INT), d_moy = CAST(12 AS INT)
@@ -6659,7 +6659,7 @@ PLAN-ROOT SINK
 |  |     parquet statistics predicates: d_year = CAST(2001 AS INT), d_moy = CAST(12 AS INT)
 |  |     parquet dictionary predicates: d_year = CAST(2001 AS INT), d_moy = CAST(12 AS INT)
 |  |     mem-estimate=16.00MB mem-reservation=512.00KB thread-reservation=0
-|  |     tuple-ids=18 row-size=12B cardinality=108 cost=146955
+|  |     tuple-ids=18 row-size=12B cardinality=108 cost=196955
 |  |     in pipelines: 25(GETNEXT)
 |  |
 |  26:HASH JOIN [LEFT OUTER JOIN, BROADCAST]
@@ -6685,8 +6685,8 @@ PLAN-ROOT SINK
 |  |  |  in pipelines: 24(GETNEXT)
 |  |  |
 |  |  F11:PLAN FRAGMENT [RANDOM] hosts=1 instances=1
-|  |  Per-Instance Resources: mem-estimate=24.11MB mem-reservation=4.00MB thread-reservation=1
-|  |  max-parallelism=1 segment-costs=[295040]
+|  |  Per-Instance Resources: mem-estimate=16.11MB mem-reservation=4.00MB thread-reservation=1
+|  |  max-parallelism=1 segment-costs=[345040]
 |  |  24:SCAN HDFS [tpcds_parquet.store_returns sr, RANDOM]
 |  |     HDFS partitions=1/1 files=1 size=15.43MB
 |  |     predicates: sr.sr_return_amt > CAST(10000 AS DECIMAL(5,0))
@@ -6696,8 +6696,8 @@ PLAN-ROOT SINK
 |  |     extrapolated-rows=disabled max-scan-range-rows=287.51K
 |  |     parquet statistics predicates: sr.sr_return_amt > CAST(10000 AS DECIMAL(5,0))
 |  |     parquet dictionary predicates: sr.sr_return_amt > CAST(10000 AS DECIMAL(5,0))
-|  |     mem-estimate=24.00MB mem-reservation=4.00MB thread-reservation=0
-|  |     tuple-ids=17 row-size=24B cardinality=28.75K cost=294253
+|  |     mem-estimate=16.00MB mem-reservation=4.00MB thread-reservation=0
+|  |     tuple-ids=17 row-size=24B cardinality=28.75K cost=344253
 |  |     in pipelines: 24(GETNEXT)
 |  |
 |  23:SCAN HDFS [tpcds_parquet.store_sales sts, RANDOM]
@@ -6712,7 +6712,7 @@ PLAN-ROOT SINK
 |     parquet statistics predicates: sts.ss_net_paid > CAST(0 AS DECIMAL(3,0)), sts.ss_net_profit > CAST(1 AS DECIMAL(3,0)), sts.ss_quantity > CAST(0 AS INT)
 |     parquet dictionary predicates: sts.ss_net_paid > CAST(0 AS DECIMAL(3,0)), sts.ss_net_profit > CAST(1 AS DECIMAL(3,0)), sts.ss_quantity > CAST(0 AS INT)
 |     mem-estimate=16.00MB mem-reservation=4.00MB thread-reservation=0
-|     tuple-ids=16 row-size=32B cardinality=288.04K cost=8731225
+|     tuple-ids=16 row-size=32B cardinality=288.04K cost=99931224
 |     in pipelines: 23(GETNEXT)
 |
 |--22:SELECT
@@ -6752,7 +6752,7 @@ PLAN-ROOT SINK
 |  |
 |  F08:PLAN FRAGMENT [HASH(cs.cs_item_sk)] hosts=3 instances=6 (adjusted from 3)
 |  Per-Instance Resources: mem-estimate=16.00MB mem-reservation=7.94MB thread-reservation=1
-|  max-parallelism=3 segment-costs=[43155, 8531, 634] cpu-comparison-result=8 [max(6 (self) vs 8 (sum children))]
+|  max-parallelism=6 segment-costs=[43155, 8531, 634] cpu-comparison-result=8 [max(6 (self) vs 8 (sum children))]
 |  18:SORT
 |  |  order by: (CAST(sum(coalesce(cr.cr_return_quantity, 0)) AS DECIMAL(15,4)) / CAST(sum(coalesce(cs.cs_quantity, 0)) AS DECIMAL(15,4))) ASC
 |  |  materialized: (CAST(sum(coalesce(cr.cr_return_quantity, 0)) AS DECIMAL(15,4)) / CAST(sum(coalesce(cs.cs_quantity, 0)) AS DECIMAL(15,4)))
@@ -6774,8 +6774,8 @@ PLAN-ROOT SINK
 |  |
 |  F05:PLAN FRAGMENT [RANDOM] hosts=3 instances=3
 |  Per-Host Shared Resources: mem-estimate=1.00MB mem-reservation=1.00MB thread-reservation=0 runtime-filters-memory=1.00MB
-|  Per-Instance Resources: mem-estimate=59.41MB mem-reservation=18.00MB thread-reservation=1
-|  max-parallelism=3 segment-costs=[4844813, 500] cpu-comparison-result=8 [max(3 (self) vs 8 (sum children))]
+|  Per-Instance Resources: mem-estimate=27.41MB mem-reservation=18.00MB thread-reservation=1
+|  max-parallelism=3 segment-costs=[4994813, 500] cpu-comparison-result=8 [max(3 (self) vs 8 (sum children))]
 |  17:AGGREGATE [STREAMING]
 |  |  output: sum(CAST(coalesce(cr.cr_return_quantity, CAST(0 AS INT)) AS BIGINT)), sum(CAST(coalesce(cs.cs_quantity, CAST(0 AS INT)) AS BIGINT)), sum(coalesce(cr.cr_return_amount, CAST(0 AS DECIMAL(7,2)))), sum(coalesce(cs.cs_net_paid, CAST(0 AS DECIMAL(7,2))))
 |  |  group by: cs.cs_item_sk
@@ -6792,13 +6792,13 @@ PLAN-ROOT SINK
 |  |  in pipelines: 12(GETNEXT), 14(OPEN)
 |  |
 |  |--F18:PLAN FRAGMENT [RANDOM] hosts=3 instances=3
-|  |  |  Per-Instance Resources: mem-estimate=8.77MB mem-reservation=8.75MB thread-reservation=1 runtime-filters-memory=1.00MB
+|  |  |  Per-Instance Resources: mem-estimate=2.95MB mem-reservation=2.94MB thread-reservation=1 runtime-filters-memory=1.00MB
 |  |  |  max-parallelism=3 segment-costs=[114]
 |  |  JOIN BUILD
 |  |  |  join-table-id=02 plan-id=03 cohort-id=02
 |  |  |  build expressions: d_date_sk
 |  |  |  runtime filters: RF002[bloom] <- d_date_sk, RF003[min_max] <- d_date_sk
-|  |  |  mem-estimate=7.75MB mem-reservation=7.75MB spill-buffer=64.00KB thread-reservation=0 cost=108
+|  |  |  mem-estimate=1.94MB mem-reservation=1.94MB spill-buffer=64.00KB thread-reservation=0 cost=108
 |  |  |
 |  |  42:EXCHANGE [BROADCAST]
 |  |  |  mem-estimate=16.00KB mem-reservation=0B thread-reservation=0
@@ -6807,7 +6807,7 @@ PLAN-ROOT SINK
 |  |  |
 |  |  F07:PLAN FRAGMENT [RANDOM] hosts=1 instances=1
 |  |  Per-Instance Resources: mem-estimate=16.06MB mem-reservation=512.00KB thread-reservation=1
-|  |  max-parallelism=1 segment-costs=[146957]
+|  |  max-parallelism=1 segment-costs=[196957]
 |  |  14:SCAN HDFS [tpcds_parquet.date_dim, RANDOM]
 |  |     HDFS partitions=1/1 files=1 size=2.15MB
 |  |     predicates: d_year = CAST(2001 AS INT), d_moy = CAST(12 AS INT)
@@ -6818,7 +6818,7 @@ PLAN-ROOT SINK
 |  |     parquet statistics predicates: d_year = CAST(2001 AS INT), d_moy = CAST(12 AS INT)
 |  |     parquet dictionary predicates: d_year = CAST(2001 AS INT), d_moy = CAST(12 AS INT)
 |  |     mem-estimate=16.00MB mem-reservation=512.00KB thread-reservation=0
-|  |     tuple-ids=10 row-size=12B cardinality=108 cost=146955
+|  |     tuple-ids=10 row-size=12B cardinality=108 cost=196955
 |  |     in pipelines: 14(GETNEXT)
 |  |
 |  15:HASH JOIN [LEFT OUTER JOIN, BROADCAST]
@@ -6831,12 +6831,12 @@ PLAN-ROOT SINK
 |  |  in pipelines: 12(GETNEXT), 13(OPEN)
 |  |
 |  |--F19:PLAN FRAGMENT [RANDOM] hosts=3 instances=3
-|  |  |  Per-Instance Resources: mem-estimate=8.11MB mem-reservation=7.75MB thread-reservation=1
+|  |  |  Per-Instance Resources: mem-estimate=2.29MB mem-reservation=1.94MB thread-reservation=1
 |  |  |  max-parallelism=3 segment-costs=[29996]
 |  |  JOIN BUILD
 |  |  |  join-table-id=03 plan-id=04 cohort-id=02
 |  |  |  build expressions: cr.cr_item_sk, cr.cr_order_number
-|  |  |  mem-estimate=7.75MB mem-reservation=7.75MB spill-buffer=64.00KB thread-reservation=0 cost=28814
+|  |  |  mem-estimate=1.94MB mem-reservation=1.94MB spill-buffer=64.00KB thread-reservation=0 cost=28814
 |  |  |
 |  |  41:EXCHANGE [BROADCAST]
 |  |  |  mem-estimate=365.66KB mem-reservation=0B thread-reservation=0
@@ -6844,8 +6844,8 @@ PLAN-ROOT SINK
 |  |  |  in pipelines: 13(GETNEXT)
 |  |  |
 |  |  F06:PLAN FRAGMENT [RANDOM] hosts=1 instances=1
-|  |  Per-Instance Resources: mem-estimate=24.11MB mem-reservation=4.00MB thread-reservation=1
-|  |  max-parallelism=1 segment-costs=[147838]
+|  |  Per-Instance Resources: mem-estimate=16.11MB mem-reservation=4.00MB thread-reservation=1
+|  |  max-parallelism=1 segment-costs=[197838]
 |  |  13:SCAN HDFS [tpcds_parquet.catalog_returns cr, RANDOM]
 |  |     HDFS partitions=1/1 files=1 size=10.62MB
 |  |     predicates: cr.cr_return_amount > CAST(10000 AS DECIMAL(5,0))
@@ -6855,8 +6855,8 @@ PLAN-ROOT SINK
 |  |     extrapolated-rows=disabled max-scan-range-rows=144.07K
 |  |     parquet statistics predicates: cr.cr_return_amount > CAST(10000 AS DECIMAL(5,0))
 |  |     parquet dictionary predicates: cr.cr_return_amount > CAST(10000 AS DECIMAL(5,0))
-|  |     mem-estimate=24.00MB mem-reservation=4.00MB thread-reservation=0
-|  |     tuple-ids=9 row-size=24B cardinality=14.41K cost=147444
+|  |     mem-estimate=16.00MB mem-reservation=4.00MB thread-reservation=0
+|  |     tuple-ids=9 row-size=24B cardinality=14.41K cost=197444
 |  |     in pipelines: 13(GETNEXT)
 |  |
 |  12:SCAN HDFS [tpcds_parquet.catalog_sales cs, RANDOM]
@@ -6869,8 +6869,8 @@ PLAN-ROOT SINK
 |     extrapolated-rows=disabled max-scan-range-rows=650.14K
 |     parquet statistics predicates: cs.cs_net_paid > CAST(0 AS DECIMAL(3,0)), cs.cs_net_profit > CAST(1 AS DECIMAL(3,0)), cs.cs_quantity > CAST(0 AS INT)
 |     parquet dictionary predicates: cs.cs_net_paid > CAST(0 AS DECIMAL(3,0)), cs.cs_net_profit > CAST(1 AS DECIMAL(3,0)), cs.cs_quantity > CAST(0 AS INT)
-|     mem-estimate=48.00MB mem-reservation=16.00MB thread-reservation=0
-|     tuple-ids=8 row-size=32B cardinality=144.16K cost=4369693
+|     mem-estimate=16.00MB mem-reservation=16.00MB thread-reservation=0
+|     tuple-ids=8 row-size=32B cardinality=144.16K cost=4519693
 |     in pipelines: 12(GETNEXT)
 |
 11:SELECT
@@ -6910,7 +6910,7 @@ PLAN-ROOT SINK
 |
 F03:PLAN FRAGMENT [HASH(ws.ws_item_sk)] hosts=2 instances=4 (adjusted from 2)
 Per-Instance Resources: mem-estimate=16.00MB mem-reservation=7.94MB thread-reservation=1
-max-parallelism=2 segment-costs=[21682, 4286, 319] cpu-comparison-result=6 [max(4 (self) vs 6 (sum children))]
+max-parallelism=4 segment-costs=[21682, 4286, 319] cpu-comparison-result=6 [max(4 (self) vs 6 (sum children))]
 07:SORT
 |  order by: (CAST(sum(coalesce(wr.wr_return_quantity, 0)) AS DECIMAL(15,4)) / CAST(sum(coalesce(ws.ws_quantity, 0)) AS DECIMAL(15,4))) ASC
 |  materialized: (CAST(sum(coalesce(wr.wr_return_quantity, 0)) AS DECIMAL(15,4)) / CAST(sum(coalesce(ws.ws_quantity, 0)) AS DECIMAL(15,4)))
@@ -6932,8 +6932,8 @@ max-parallelism=2 segment-costs=[21682, 4286, 319] cpu-comparison-result=6 [max(
 |
 F00:PLAN FRAGMENT [RANDOM] hosts=2 instances=2
 Per-Host Shared Resources: mem-estimate=1.00MB mem-reservation=1.00MB thread-reservation=0 runtime-filters-memory=1.00MB
-Per-Instance Resources: mem-estimate=42.94MB mem-reservation=18.00MB thread-reservation=1
-max-parallelism=2 segment-costs=[2417877, 252] cpu-comparison-result=6 [max(2 (self) vs 6 (sum children))]
+Per-Instance Resources: mem-estimate=26.94MB mem-reservation=18.00MB thread-reservation=1
+max-parallelism=2 segment-costs=[2517877, 252] cpu-comparison-result=6 [max(2 (self) vs 6 (sum children))]
 06:AGGREGATE [STREAMING]
 |  output: sum(CAST(coalesce(wr.wr_return_quantity, CAST(0 AS INT)) AS BIGINT)), sum(CAST(coalesce(ws.ws_quantity, CAST(0 AS INT)) AS BIGINT)), sum(coalesce(wr.wr_return_amt, CAST(0 AS DECIMAL(7,2)))), sum(coalesce(ws.ws_net_paid, CAST(0 AS DECIMAL(7,2))))
 |  group by: ws.ws_item_sk
@@ -6950,13 +6950,13 @@ max-parallelism=2 segment-costs=[2417877, 252] cpu-comparison-result=6 [max(2 (s
 |  in pipelines: 01(GETNEXT), 03(OPEN)
 |
 |--F16:PLAN FRAGMENT [RANDOM] hosts=2 instances=2
-|  |  Per-Instance Resources: mem-estimate=8.77MB mem-reservation=8.75MB thread-reservation=1 runtime-filters-memory=1.00MB
+|  |  Per-Instance Resources: mem-estimate=2.95MB mem-reservation=2.94MB thread-reservation=1 runtime-filters-memory=1.00MB
 |  |  max-parallelism=2 segment-costs=[112]
 |  JOIN BUILD
 |  |  join-table-id=00 plan-id=01 cohort-id=01
 |  |  build expressions: d_date_sk
 |  |  runtime filters: RF000[bloom] <- d_date_sk, RF001[min_max] <- d_date_sk
-|  |  mem-estimate=7.75MB mem-reservation=7.75MB spill-buffer=64.00KB thread-reservation=0 cost=108
+|  |  mem-estimate=1.94MB mem-reservation=1.94MB spill-buffer=64.00KB thread-reservation=0 cost=108
 |  |
 |  37:EXCHANGE [BROADCAST]
 |  |  mem-estimate=16.00KB mem-reservation=0B thread-reservation=0
@@ -6965,7 +6965,7 @@ max-parallelism=2 segment-costs=[2417877, 252] cpu-comparison-result=6 [max(2 (s
 |  |
 |  F02:PLAN FRAGMENT [RANDOM] hosts=1 instances=1
 |  Per-Instance Resources: mem-estimate=16.06MB mem-reservation=512.00KB thread-reservation=1
-|  max-parallelism=1 segment-costs=[146957]
+|  max-parallelism=1 segment-costs=[196957]
 |  03:SCAN HDFS [tpcds_parquet.date_dim, RANDOM]
 |     HDFS partitions=1/1 files=1 size=2.15MB
 |     predicates: d_year = CAST(2001 AS INT), d_moy = CAST(12 AS INT)
@@ -6976,7 +6976,7 @@ max-parallelism=2 segment-costs=[2417877, 252] cpu-comparison-result=6 [max(2 (s
 |     parquet statistics predicates: d_year = CAST(2001 AS INT), d_moy = CAST(12 AS INT)
 |     parquet dictionary predicates: d_year = CAST(2001 AS INT), d_moy = CAST(12 AS INT)
 |     mem-estimate=16.00MB mem-reservation=512.00KB thread-reservation=0
-|     tuple-ids=2 row-size=12B cardinality=108 cost=146955
+|     tuple-ids=2 row-size=12B cardinality=108 cost=196955
 |     in pipelines: 03(GETNEXT)
 |
 04:HASH JOIN [LEFT OUTER JOIN, BROADCAST]
@@ -6989,12 +6989,12 @@ max-parallelism=2 segment-costs=[2417877, 252] cpu-comparison-result=6 [max(2 (s
 |  in pipelines: 01(GETNEXT), 02(OPEN)
 |
 |--F17:PLAN FRAGMENT [RANDOM] hosts=2 instances=2
-|  |  Per-Instance Resources: mem-estimate=7.94MB mem-reservation=7.75MB thread-reservation=1
+|  |  Per-Instance Resources: mem-estimate=2.13MB mem-reservation=1.94MB thread-reservation=1
 |  |  max-parallelism=2 segment-costs=[14746]
 |  JOIN BUILD
 |  |  join-table-id=01 plan-id=02 cohort-id=01
 |  |  build expressions: wr.wr_item_sk, wr.wr_order_number
-|  |  mem-estimate=7.75MB mem-reservation=7.75MB spill-buffer=64.00KB thread-reservation=0 cost=14352
+|  |  mem-estimate=1.94MB mem-reservation=1.94MB spill-buffer=64.00KB thread-reservation=0 cost=14352
 |  |
 |  36:EXCHANGE [BROADCAST]
 |  |  mem-estimate=196.19KB mem-reservation=0B thread-reservation=0
@@ -7003,7 +7003,7 @@ max-parallelism=2 segment-costs=[2417877, 252] cpu-comparison-result=6 [max(2 (s
 |  |
 |  F01:PLAN FRAGMENT [RANDOM] hosts=1 instances=1
 |  Per-Instance Resources: mem-estimate=16.11MB mem-reservation=2.00MB thread-reservation=1
-|  max-parallelism=1 segment-costs=[73642]
+|  max-parallelism=1 segment-costs=[123642]
 |  02:SCAN HDFS [tpcds_parquet.web_returns wr, RANDOM]
 |     HDFS partitions=1/1 files=1 size=5.66MB
 |     predicates: wr.wr_return_amt > CAST(10000 AS DECIMAL(5,0))
@@ -7014,7 +7014,7 @@ max-parallelism=2 segment-costs=[2417877, 252] cpu-comparison-result=6 [max(2 (s
 |     parquet statistics predicates: wr.wr_return_amt > CAST(10000 AS DECIMAL(5,0))
 |     parquet dictionary predicates: wr.wr_return_amt > CAST(10000 AS DECIMAL(5,0))
 |     mem-estimate=16.00MB mem-reservation=2.00MB thread-reservation=0
-|     tuple-ids=1 row-size=24B cardinality=7.18K cost=73445
+|     tuple-ids=1 row-size=24B cardinality=7.18K cost=123445
 |     in pipelines: 02(GETNEXT)
 |
 01:SCAN HDFS [tpcds_parquet.web_sales ws, RANDOM]
@@ -7027,8 +7027,8 @@ max-parallelism=2 segment-costs=[2417877, 252] cpu-comparison-result=6 [max(2 (s
    extrapolated-rows=disabled max-scan-range-rows=644.77K
    parquet statistics predicates: ws.ws_net_paid > CAST(0 AS DECIMAL(3,0)), ws.ws_net_profit > CAST(1 AS DECIMAL(3,0)), ws.ws_quantity > CAST(0 AS INT)
    parquet dictionary predicates: ws.ws_net_paid > CAST(0 AS DECIMAL(3,0)), ws.ws_net_profit > CAST(1 AS DECIMAL(3,0)), ws.ws_quantity > CAST(0 AS INT)
-   mem-estimate=32.00MB mem-reservation=16.00MB thread-reservation=0
-   tuple-ids=0 row-size=32B cardinality=71.94K cost=2180633
+   mem-estimate=16.00MB mem-reservation=16.00MB thread-reservation=0
+   tuple-ids=0 row-size=32B cardinality=71.94K cost=2280633
    in pipelines: 01(GETNEXT)
 ====
 # TPCDS-Q76
@@ -7089,47 +7089,47 @@ ORDER BY channel,
 LIMIT 100;
 
 ---- PARALLELPLANS
-Max Per-Host Resource Reservation: Memory=99.50MB Threads=36
-Per-Host Resource Estimates: Memory=452MB
-F15:PLAN FRAGMENT [UNPARTITIONED] hosts=1 instances=1
+Max Per-Host Resource Reservation: Memory=103.81MB Threads=26
+Per-Host Resource Estimates: Memory=331MB
+F13:PLAN FRAGMENT [UNPARTITIONED] hosts=1 instances=1
 |  Per-Instance Resources: mem-estimate=4.05MB mem-reservation=4.00MB thread-reservation=1
-|  max-parallelism=1 segment-costs=[708] cpu-comparison-result=44 [max(1 (self) vs 44 (sum children))]
+|  max-parallelism=1 segment-costs=[708] cpu-comparison-result=32 [max(1 (self) vs 32 (sum children))]
 PLAN-ROOT SINK
 |  output exprs: channel, col_name, d_year, d_qoy, i_category, count(*), sum(ext_sales_price)
 |  mem-estimate=4.00MB mem-reservation=4.00MB spill-buffer=2.00MB thread-reservation=0 cost=700
 |
-30:MERGING-EXCHANGE [UNPARTITIONED]
+28:MERGING-EXCHANGE [UNPARTITIONED]
 |  order by: channel ASC, col_name ASC, d_year ASC, d_qoy ASC, i_category ASC
 |  limit: 100
 |  mem-estimate=48.05KB mem-reservation=0B thread-reservation=0
 |  tuple-ids=12 row-size=74B cardinality=100 cost=8
 |  in pipelines: 17(GETNEXT)
 |
-F14:PLAN FRAGMENT [HASH(channel,col_name,d_year,d_qoy,i_category)] hosts=3 instances=6 (adjusted from 12)
+F12:PLAN FRAGMENT [HASH(channel,col_name,d_year,d_qoy,i_category)] hosts=3 instances=6 (adjusted from 48)
 Per-Instance Resources: mem-estimate=14.14MB mem-reservation=2.88MB thread-reservation=1
-max-parallelism=3 segment-costs=[972054, 500, 8] cpu-comparison-result=44 [max(6 (self) vs 44 (sum children))]
+max-parallelism=6 segment-costs=[972054, 500, 8] cpu-comparison-result=32 [max(6 (self) vs 32 (sum children))]
 17:TOP-N [LIMIT=100]
 |  order by: channel ASC, col_name ASC, d_year ASC, d_qoy ASC, i_category ASC
 |  mem-estimate=7.22KB mem-reservation=0B thread-reservation=0
 |  tuple-ids=12 row-size=74B cardinality=100 cost=500
-|  in pipelines: 17(GETNEXT), 29(OPEN)
+|  in pipelines: 17(GETNEXT), 27(OPEN)
 |
-29:AGGREGATE [FINALIZE]
+27:AGGREGATE [FINALIZE]
 |  output: count:merge(*), sum:merge(ext_sales_price)
 |  group by: channel, col_name, d_year, d_qoy, i_category
 |  mem-estimate=10.00MB mem-reservation=2.88MB spill-buffer=128.00KB thread-reservation=0
 |  tuple-ids=11 row-size=74B cardinality=137.37K cost=961604
-|  in pipelines: 29(GETNEXT), 01(OPEN), 07(OPEN), 11(OPEN)
+|  in pipelines: 27(GETNEXT), 01(OPEN), 07(OPEN), 11(OPEN)
 |
-28:EXCHANGE [HASH(channel,col_name,d_year,d_qoy,i_category)]
+26:EXCHANGE [HASH(channel,col_name,d_year,d_qoy,i_category)]
 |  mem-estimate=4.14MB mem-reservation=0B thread-reservation=0
 |  tuple-ids=11 row-size=74B cardinality=137.37K cost=10450
 |  in pipelines: 01(GETNEXT), 07(GETNEXT), 11(GETNEXT)
 |
-F13:PLAN FRAGMENT [RANDOM] hosts=3 instances=12
-Per-Host Shared Resources: mem-estimate=1.00MB mem-reservation=1.00MB thread-reservation=0 runtime-filters-memory=1.00MB
-Per-Instance Resources: mem-estimate=27.83MB mem-reservation=2.25MB thread-reservation=1
-max-parallelism=12 segment-costs=[3597079, 10450] cpu-comparison-result=44 [max(39 (self) vs 44 (sum children))]
+F11:PLAN FRAGMENT [RANDOM] hosts=3 instances=12 (adjusted from 48)
+Per-Host Shared Resources: mem-estimate=3.00MB mem-reservation=3.00MB thread-reservation=0 runtime-filters-memory=3.00MB
+Per-Instance Resources: mem-estimate=27.83MB mem-reservation=3.00MB thread-reservation=1
+max-parallelism=12 segment-costs=[97906925, 10450] cpu-comparison-result=32 [max(21 (self) vs 32 (sum children))]
 16:AGGREGATE [STREAMING]
 |  output: count(*), sum(ext_sales_price)
 |  group by: channel, col_name, d_year, d_qoy, i_category
@@ -7143,30 +7143,30 @@ max-parallelism=12 segment-costs=[3597079, 10450] cpu-comparison-result=44 [max(
 |  in pipelines: 01(GETNEXT), 07(GETNEXT), 11(GETNEXT)
 |
 |--15:HASH JOIN [INNER JOIN, PARTITIONED]
-|  |  hash-table-id=03
+|  |  hash-table-id=04
 |  |  hash predicates: cs_item_sk = i_item_sk
 |  |  fk/pk conjuncts: cs_item_sk = i_item_sk
 |  |  mem-estimate=0B mem-reservation=0B spill-buffer=64.00KB thread-reservation=0
 |  |  tuple-ids=6,8,7 row-size=58B cardinality=7.17K cost=7165
 |  |  in pipelines: 11(GETNEXT), 12(OPEN)
 |  |
-|  |--F19:PLAN FRAGMENT [RANDOM] hosts=3 instances=12
+|  |--F18:PLAN FRAGMENT [RANDOM] hosts=3 instances=12 (adjusted from 48)
 |  |  |  Per-Instance Resources: mem-estimate=3.41MB mem-reservation=2.94MB thread-reservation=1 runtime-filters-memory=1.00MB
 |  |  |  max-parallelism=12 segment-costs=[18526]
 |  |  JOIN BUILD
-|  |  |  join-table-id=03 plan-id=04 cohort-id=01
+|  |  |  join-table-id=04 plan-id=05 cohort-id=01
 |  |  |  build expressions: i_item_sk
 |  |  |  runtime filters: RF008[bloom] <- i_item_sk, RF009[min_max] <- i_item_sk
 |  |  |  mem-estimate=1.94MB mem-reservation=1.94MB spill-buffer=64.00KB thread-reservation=0 cost=18000
 |  |  |
-|  |  27:EXCHANGE [HASH(i_item_sk)]
+|  |  25:EXCHANGE [HASH(i_item_sk)]
 |  |  |  mem-estimate=485.07KB mem-reservation=0B thread-reservation=0
 |  |  |  tuple-ids=7 row-size=26B cardinality=18.00K cost=526
 |  |  |  in pipelines: 12(GETNEXT)
 |  |  |
-|  |  F11:PLAN FRAGMENT [RANDOM] hosts=1 instances=1
+|  |  F09:PLAN FRAGMENT [RANDOM] hosts=1 instances=1
 |  |  Per-Instance Resources: mem-estimate=17.40MB mem-reservation=256.00KB thread-reservation=1
-|  |  max-parallelism=1 segment-costs=[982]
+|  |  max-parallelism=1 segment-costs=[50982]
 |  |  12:SCAN HDFS [tpcds_parquet.item, RANDOM]
 |  |     HDFS partitions=1/1 files=1 size=1.73MB
 |  |     stored statistics:
@@ -7174,17 +7174,17 @@ max-parallelism=12 segment-costs=[3597079, 10450] cpu-comparison-result=44 [max(
 |  |       columns: all
 |  |     extrapolated-rows=disabled max-scan-range-rows=18.00K
 |  |     mem-estimate=16.00MB mem-reservation=256.00KB thread-reservation=0
-|  |     tuple-ids=7 row-size=26B cardinality=18.00K cost=456
+|  |     tuple-ids=7 row-size=26B cardinality=18.00K cost=50456
 |  |     in pipelines: 12(GETNEXT)
 |  |
-|  26:EXCHANGE [HASH(cs_item_sk)]
+|  24:EXCHANGE [HASH(cs_item_sk)]
 |  |  mem-estimate=314.63KB mem-reservation=0B thread-reservation=0
 |  |  tuple-ids=6,8 row-size=32B cardinality=7.17K cost=280
 |  |  in pipelines: 11(GETNEXT)
 |  |
-|  F10:PLAN FRAGMENT [HASH(cs_sold_date_sk)] hosts=3 instances=6 (adjusted from 3)
+|  F08:PLAN FRAGMENT [HASH(cs_sold_date_sk)] hosts=3 instances=6 (adjusted from 3)
 |  Per-Instance Resources: mem-estimate=1.99MB mem-reservation=0B thread-reservation=1
-|  max-parallelism=3 segment-costs=[7613]
+|  max-parallelism=6 segment-costs=[7613]
 |  14:HASH JOIN [INNER JOIN, PARTITIONED]
 |  |  hash-table-id=05
 |  |  hash predicates: cs_sold_date_sk = d_date_sk
@@ -7193,7 +7193,7 @@ max-parallelism=12 segment-costs=[3597079, 10450] cpu-comparison-result=44 [max(
 |  |  tuple-ids=6,8 row-size=32B cardinality=7.17K cost=7165
 |  |  in pipelines: 11(GETNEXT), 13(OPEN)
 |  |
-|  |--F21:PLAN FRAGMENT [HASH(cs_sold_date_sk)] hosts=3 instances=6 (adjusted from 3)
+|  |--F19:PLAN FRAGMENT [HASH(cs_sold_date_sk)] hosts=3 instances=6 (adjusted from 3)
 |  |  |  Per-Instance Resources: mem-estimate=3.79MB mem-reservation=2.94MB thread-reservation=1 runtime-filters-memory=1.00MB
 |  |  |  max-parallelism=6 segment-costs=[74191]
 |  |  JOIN BUILD
@@ -7202,14 +7202,14 @@ max-parallelism=12 segment-costs=[3597079, 10450] cpu-comparison-result=44 [max(
 |  |  |  runtime filters: RF010[bloom] <- d_date_sk, RF011[min_max] <- d_date_sk
 |  |  |  mem-estimate=1.94MB mem-reservation=1.94MB spill-buffer=64.00KB thread-reservation=0 cost=73049
 |  |  |
-|  |  25:EXCHANGE [HASH(d_date_sk)]
+|  |  23:EXCHANGE [HASH(d_date_sk)]
 |  |  |  mem-estimate=872.04KB mem-reservation=0B thread-reservation=0
 |  |  |  tuple-ids=8 row-size=12B cardinality=73.05K cost=1142
 |  |  |  in pipelines: 13(GETNEXT)
 |  |  |
-|  |  F09:PLAN FRAGMENT [RANDOM] hosts=1 instances=1
+|  |  F07:PLAN FRAGMENT [RANDOM] hosts=1 instances=1
 |  |  Per-Instance Resources: mem-estimate=16.38MB mem-reservation=512.00KB thread-reservation=1
-|  |  max-parallelism=1 segment-costs=[1999]
+|  |  max-parallelism=1 segment-costs=[51999]
 |  |  13:SCAN HDFS [tpcds_parquet.date_dim, RANDOM]
 |  |     HDFS partitions=1/1 files=1 size=2.15MB
 |  |     stored statistics:
@@ -7217,18 +7217,18 @@ max-parallelism=12 segment-costs=[3597079, 10450] cpu-comparison-result=44 [max(
 |  |       columns: all
 |  |     extrapolated-rows=disabled max-scan-range-rows=73.05K
 |  |     mem-estimate=16.00MB mem-reservation=512.00KB thread-reservation=0
-|  |     tuple-ids=8 row-size=12B cardinality=73.05K cost=857
+|  |     tuple-ids=8 row-size=12B cardinality=73.05K cost=50857
 |  |     in pipelines: 13(GETNEXT)
 |  |
-|  24:EXCHANGE [HASH(cs_sold_date_sk)]
+|  22:EXCHANGE [HASH(cs_sold_date_sk)]
 |  |  mem-estimate=118.65KB mem-reservation=0B thread-reservation=0
 |  |  tuple-ids=6 row-size=20B cardinality=7.17K cost=168
 |  |  in pipelines: 11(GETNEXT)
 |  |
-|  F08:PLAN FRAGMENT [RANDOM] hosts=3 instances=3
+|  F06:PLAN FRAGMENT [RANDOM] hosts=3 instances=3
 |  Per-Host Shared Resources: mem-estimate=2.00MB mem-reservation=2.00MB thread-reservation=0 runtime-filters-memory=2.00MB
-|  Per-Instance Resources: mem-estimate=48.56MB mem-reservation=8.00MB thread-reservation=1
-|  max-parallelism=3 segment-costs=[1469872]
+|  Per-Instance Resources: mem-estimate=16.56MB mem-reservation=8.00MB thread-reservation=1
+|  max-parallelism=3 segment-costs=[1619872]
 |  11:SCAN HDFS [tpcds_parquet.catalog_sales, RANDOM]
 |     HDFS partitions=1/1 files=3 size=96.62MB
 |     predicates: cs_ship_addr_sk IS NULL
@@ -7237,61 +7237,61 @@ max-parallelism=12 segment-costs=[3597079, 10450] cpu-comparison-result=44 [max(
 |       table: rows=1.44M size=96.62MB
 |       columns: all
 |     extrapolated-rows=disabled max-scan-range-rows=650.14K
-|     mem-estimate=48.00MB mem-reservation=8.00MB thread-reservation=0
-|     tuple-ids=6 row-size=20B cardinality=7.17K cost=1469704
+|     mem-estimate=16.00MB mem-reservation=8.00MB thread-reservation=0
+|     tuple-ids=6 row-size=20B cardinality=7.17K cost=1619704
 |     in pipelines: 11(GETNEXT)
 |
 |--10:HASH JOIN [INNER JOIN, BROADCAST]
-|  |  hash-table-id=01
+|  |  hash-table-id=02
 |  |  hash predicates: i_item_sk = ws_item_sk
 |  |  fk/pk conjuncts: i_item_sk = ws_item_sk
 |  |  mem-estimate=0B mem-reservation=0B spill-buffer=64.00KB thread-reservation=0
 |  |  tuple-ids=4,5,3 row-size=58B cardinality=173 cost=18000
 |  |  in pipelines: 07(GETNEXT), 08(OPEN)
 |  |
-|  |--F17:PLAN FRAGMENT [RANDOM] hosts=3 instances=3
+|  |--F16:PLAN FRAGMENT [RANDOM] hosts=3 instances=3
 |  |  |  Per-Instance Resources: mem-estimate=8.77MB mem-reservation=8.75MB thread-reservation=1 runtime-filters-memory=1.00MB
 |  |  |  max-parallelism=3 segment-costs=[194] cpu-comparison-result=4 [max(4 (self) vs 3 (sum children))]
 |  |  JOIN BUILD
-|  |  |  join-table-id=01 plan-id=02 cohort-id=01
+|  |  |  join-table-id=02 plan-id=03 cohort-id=01
 |  |  |  build expressions: ws_item_sk
 |  |  |  runtime filters: RF004[bloom] <- ws_item_sk, RF005[min_max] <- ws_item_sk
 |  |  |  mem-estimate=7.75MB mem-reservation=7.75MB spill-buffer=64.00KB thread-reservation=0 cost=173
 |  |  |
-|  |  23:EXCHANGE [BROADCAST]
+|  |  21:EXCHANGE [BROADCAST]
 |  |  |  mem-estimate=16.00KB mem-reservation=0B thread-reservation=0
 |  |  |  tuple-ids=5,3 row-size=32B cardinality=173 cost=21
 |  |  |  in pipelines: 08(GETNEXT)
 |  |  |
-|  |  F06:PLAN FRAGMENT [RANDOM] hosts=1 instances=1
+|  |  F04:PLAN FRAGMENT [RANDOM] hosts=1 instances=1
 |  |  Per-Host Shared Resources: mem-estimate=1.00MB mem-reservation=1.00MB thread-reservation=0 runtime-filters-memory=1.00MB
 |  |  Per-Instance Resources: mem-estimate=16.16MB mem-reservation=512.00KB thread-reservation=1
-|  |  max-parallelism=1 segment-costs=[73913]
+|  |  max-parallelism=1 segment-costs=[123913]
 |  |  09:HASH JOIN [INNER JOIN, BROADCAST]
-|  |  |  hash-table-id=02
+|  |  |  hash-table-id=03
 |  |  |  hash predicates: d_date_sk = ws_sold_date_sk
 |  |  |  fk/pk conjuncts: none
 |  |  |  mem-estimate=0B mem-reservation=0B spill-buffer=64.00KB thread-reservation=0
 |  |  |  tuple-ids=5,3 row-size=32B cardinality=173 cost=73049
 |  |  |  in pipelines: 08(GETNEXT), 06(OPEN)
 |  |  |
-|  |  |--F18:PLAN FRAGMENT [RANDOM] hosts=1 instances=1
-|  |  |  |  Per-Instance Resources: mem-estimate=8.77MB mem-reservation=8.75MB thread-reservation=1 runtime-filters-memory=1.00MB
+|  |  |--F17:PLAN FRAGMENT [RANDOM] hosts=1 instances=1
+|  |  |  |  Per-Instance Resources: mem-estimate=2.95MB mem-reservation=2.94MB thread-reservation=1 runtime-filters-memory=1.00MB
 |  |  |  |  max-parallelism=1 segment-costs=[178]
 |  |  |  JOIN BUILD
-|  |  |  |  join-table-id=02 plan-id=03 cohort-id=02
+|  |  |  |  join-table-id=03 plan-id=04 cohort-id=02
 |  |  |  |  build expressions: ws_sold_date_sk
 |  |  |  |  runtime filters: RF006[bloom] <- ws_sold_date_sk, RF007[min_max] <- ws_sold_date_sk
-|  |  |  |  mem-estimate=7.75MB mem-reservation=7.75MB spill-buffer=64.00KB thread-reservation=0 cost=173
+|  |  |  |  mem-estimate=1.94MB mem-reservation=1.94MB spill-buffer=64.00KB thread-reservation=0 cost=173
 |  |  |  |
-|  |  |  22:EXCHANGE [BROADCAST]
+|  |  |  20:EXCHANGE [BROADCAST]
 |  |  |  |  mem-estimate=16.00KB mem-reservation=0B thread-reservation=0
 |  |  |  |  tuple-ids=3 row-size=20B cardinality=173 cost=5
 |  |  |  |  in pipelines: 06(GETNEXT)
 |  |  |  |
-|  |  |  F07:PLAN FRAGMENT [RANDOM] hosts=2 instances=2
-|  |  |  Per-Instance Resources: mem-estimate=32.09MB mem-reservation=8.00MB thread-reservation=1
-|  |  |  max-parallelism=2 segment-costs=[733440]
+|  |  |  F05:PLAN FRAGMENT [RANDOM] hosts=2 instances=2
+|  |  |  Per-Instance Resources: mem-estimate=16.09MB mem-reservation=8.00MB thread-reservation=1
+|  |  |  max-parallelism=2 segment-costs=[833440]
 |  |  |  06:SCAN HDFS [tpcds_parquet.web_sales, RANDOM]
 |  |  |     HDFS partitions=1/1 files=2 size=45.09MB
 |  |  |     predicates: ws_ship_customer_sk IS NULL
@@ -7299,8 +7299,8 @@ max-parallelism=12 segment-costs=[3597079, 10450] cpu-comparison-result=44 [max(
 |  |  |       table: rows=719.38K size=45.09MB
 |  |  |       columns: all
 |  |  |     extrapolated-rows=disabled max-scan-range-rows=644.77K
-|  |  |     mem-estimate=32.00MB mem-reservation=8.00MB thread-reservation=0
-|  |  |     tuple-ids=3 row-size=20B cardinality=173 cost=733435
+|  |  |     mem-estimate=16.00MB mem-reservation=8.00MB thread-reservation=0
+|  |  |     tuple-ids=3 row-size=20B cardinality=173 cost=833435
 |  |  |     in pipelines: 06(GETNEXT)
 |  |  |
 |  |  08:SCAN HDFS [tpcds_parquet.date_dim, RANDOM]
@@ -7311,7 +7311,7 @@ max-parallelism=12 segment-costs=[3597079, 10450] cpu-comparison-result=44 [max(
 |  |       columns: all
 |  |     extrapolated-rows=disabled max-scan-range-rows=73.05K
 |  |     mem-estimate=16.00MB mem-reservation=512.00KB thread-reservation=0
-|  |     tuple-ids=5 row-size=12B cardinality=73.05K cost=857
+|  |     tuple-ids=5 row-size=12B cardinality=73.05K cost=50857
 |  |     in pipelines: 08(GETNEXT)
 |  |
 |  07:SCAN HDFS [tpcds_parquet.item, RANDOM]
@@ -7322,34 +7322,34 @@ max-parallelism=12 segment-costs=[3597079, 10450] cpu-comparison-result=44 [max(
 |       columns: all
 |     extrapolated-rows=disabled max-scan-range-rows=18.00K
 |     mem-estimate=16.00MB mem-reservation=256.00KB thread-reservation=0
-|     tuple-ids=4 row-size=26B cardinality=18.00K cost=456
+|     tuple-ids=4 row-size=26B cardinality=18.00K cost=50456
 |     in pipelines: 07(GETNEXT)
 |
-05:HASH JOIN [INNER JOIN, PARTITIONED]
+05:HASH JOIN [INNER JOIN, BROADCAST]
 |  hash-table-id=00
 |  hash predicates: ss_sold_date_sk = d_date_sk
 |  fk/pk conjuncts: ss_sold_date_sk = d_date_sk
-|  mem-estimate=0B mem-reservation=0B spill-buffer=64.00KB thread-reservation=0
+|  mem-estimate=0B mem-reservation=0B spill-buffer=256.00KB thread-reservation=0
 |  tuple-ids=0,1,2 row-size=58B cardinality=130.03K cost=130034
 |  in pipelines: 01(GETNEXT), 03(OPEN)
 |
-|--F16:PLAN FRAGMENT [RANDOM] hosts=3 instances=12
-|  |  Per-Instance Resources: mem-estimate=3.79MB mem-reservation=2.94MB thread-reservation=1 runtime-filters-memory=1.00MB
-|  |  max-parallelism=12 segment-costs=[74191]
+|--F14:PLAN FRAGMENT [RANDOM] hosts=3 instances=3
+|  |  Per-Instance Resources: mem-estimate=20.85MB mem-reservation=20.00MB thread-reservation=1 runtime-filters-memory=1.00MB
+|  |  max-parallelism=3 segment-costs=[76475]
 |  JOIN BUILD
 |  |  join-table-id=00 plan-id=01 cohort-id=01
 |  |  build expressions: d_date_sk
 |  |  runtime filters: RF000[bloom] <- d_date_sk
-|  |  mem-estimate=1.94MB mem-reservation=1.94MB spill-buffer=64.00KB thread-reservation=0 cost=73049
+|  |  mem-estimate=19.00MB mem-reservation=19.00MB spill-buffer=256.00KB thread-reservation=0 cost=73049
 |  |
-|  21:EXCHANGE [HASH(d_date_sk)]
+|  19:EXCHANGE [BROADCAST]
 |  |  mem-estimate=872.04KB mem-reservation=0B thread-reservation=0
-|  |  tuple-ids=2 row-size=12B cardinality=73.05K cost=1142
+|  |  tuple-ids=2 row-size=12B cardinality=73.05K cost=3426
 |  |  in pipelines: 03(GETNEXT)
 |  |
-|  F03:PLAN FRAGMENT [RANDOM] hosts=1 instances=1
-|  Per-Instance Resources: mem-estimate=16.75MB mem-reservation=512.00KB thread-reservation=1
-|  max-parallelism=1 segment-costs=[1999]
+|  F02:PLAN FRAGMENT [RANDOM] hosts=1 instances=1
+|  Per-Instance Resources: mem-estimate=16.06MB mem-reservation=512.00KB thread-reservation=1
+|  max-parallelism=1 segment-costs=[51999]
 |  03:SCAN HDFS [tpcds_parquet.date_dim, RANDOM]
 |     HDFS partitions=1/1 files=1 size=2.15MB
 |     stored statistics:
@@ -7357,42 +7357,34 @@ max-parallelism=12 segment-costs=[3597079, 10450] cpu-comparison-result=44 [max(
 |       columns: all
 |     extrapolated-rows=disabled max-scan-range-rows=73.05K
 |     mem-estimate=16.00MB mem-reservation=512.00KB thread-reservation=0
-|     tuple-ids=2 row-size=12B cardinality=73.05K cost=857
+|     tuple-ids=2 row-size=12B cardinality=73.05K cost=50857
 |     in pipelines: 03(GETNEXT)
 |
-20:EXCHANGE [HASH(ss_sold_date_sk)]
-|  mem-estimate=2.21MB mem-reservation=0B thread-reservation=0
-|  tuple-ids=0,1 row-size=46B cardinality=130.03K cost=6844
-|  in pipelines: 01(GETNEXT)
-|
-F02:PLAN FRAGMENT [HASH(ss_item_sk)] hosts=3 instances=6 (adjusted from 12)
-Per-Instance Resources: mem-estimate=3.63MB mem-reservation=0B thread-reservation=1
-max-parallelism=3 segment-costs=[139926]
-04:HASH JOIN [INNER JOIN, PARTITIONED]
-|  hash-table-id=04
+04:HASH JOIN [INNER JOIN, BROADCAST]
+|  hash-table-id=01
 |  hash predicates: ss_item_sk = i_item_sk
 |  fk/pk conjuncts: ss_item_sk = i_item_sk
 |  mem-estimate=0B mem-reservation=0B spill-buffer=64.00KB thread-reservation=0
 |  tuple-ids=0,1 row-size=46B cardinality=130.03K cost=130034
 |  in pipelines: 01(GETNEXT), 02(OPEN)
 |
-|--F20:PLAN FRAGMENT [HASH(ss_item_sk)] hosts=3 instances=6 (adjusted from 12)
-|  |  Per-Instance Resources: mem-estimate=3.41MB mem-reservation=2.94MB thread-reservation=1 runtime-filters-memory=1.00MB
-|  |  max-parallelism=6 segment-costs=[18526]
+|--F15:PLAN FRAGMENT [RANDOM] hosts=3 instances=3
+|  |  Per-Instance Resources: mem-estimate=9.22MB mem-reservation=8.75MB thread-reservation=1 runtime-filters-memory=1.00MB
+|  |  max-parallelism=3 segment-costs=[19578]
 |  JOIN BUILD
-|  |  join-table-id=04 plan-id=05 cohort-id=01
+|  |  join-table-id=01 plan-id=02 cohort-id=01
 |  |  build expressions: i_item_sk
 |  |  runtime filters: RF002[bloom] <- i_item_sk, RF003[min_max] <- i_item_sk
-|  |  mem-estimate=1.94MB mem-reservation=1.94MB spill-buffer=64.00KB thread-reservation=0 cost=18000
+|  |  mem-estimate=7.75MB mem-reservation=7.75MB spill-buffer=64.00KB thread-reservation=0 cost=18000
 |  |
-|  19:EXCHANGE [HASH(i_item_sk)]
+|  18:EXCHANGE [BROADCAST]
 |  |  mem-estimate=485.07KB mem-reservation=0B thread-reservation=0
-|  |  tuple-ids=1 row-size=26B cardinality=18.00K cost=526
+|  |  tuple-ids=1 row-size=26B cardinality=18.00K cost=1578
 |  |  in pipelines: 02(GETNEXT)
 |  |
 |  F01:PLAN FRAGMENT [RANDOM] hosts=1 instances=1
-|  Per-Instance Resources: mem-estimate=16.70MB mem-reservation=256.00KB thread-reservation=1
-|  max-parallelism=1 segment-costs=[982]
+|  Per-Instance Resources: mem-estimate=16.12MB mem-reservation=256.00KB thread-reservation=1
+|  max-parallelism=1 segment-costs=[50982]
 |  02:SCAN HDFS [tpcds_parquet.item, RANDOM]
 |     HDFS partitions=1/1 files=1 size=1.73MB
 |     stored statistics:
@@ -7400,18 +7392,9 @@ max-parallelism=3 segment-costs=[139926]
 |       columns: all
 |     extrapolated-rows=disabled max-scan-range-rows=18.00K
 |     mem-estimate=16.00MB mem-reservation=256.00KB thread-reservation=0
-|     tuple-ids=1 row-size=26B cardinality=18.00K cost=456
+|     tuple-ids=1 row-size=26B cardinality=18.00K cost=50456
 |     in pipelines: 02(GETNEXT)
 |
-18:EXCHANGE [HASH(ss_item_sk)]
-|  mem-estimate=1.11MB mem-reservation=0B thread-reservation=0
-|  tuple-ids=0 row-size=20B cardinality=130.03K cost=3048
-|  in pipelines: 01(GETNEXT)
-|
-F00:PLAN FRAGMENT [RANDOM] hosts=3 instances=12
-Per-Host Shared Resources: mem-estimate=2.00MB mem-reservation=2.00MB thread-reservation=0 runtime-filters-memory=2.00MB
-Per-Instance Resources: mem-estimate=16.56MB mem-reservation=1.00MB thread-reservation=1
-max-parallelism=12 segment-costs=[2939710]
 01:SCAN HDFS [tpcds_parquet.store_sales, RANDOM]
    HDFS partitions=1824/1824 files=1824 size=199.44MB
    predicates: ss_store_sk IS NULL
@@ -7422,7 +7405,7 @@ max-parallelism=12 segment-costs=[2939710]
      columns: all
    extrapolated-rows=disabled max-scan-range-rows=130.09K
    mem-estimate=16.00MB mem-reservation=1.00MB thread-reservation=0
-   tuple-ids=0 row-size=20B cardinality=130.03K cost=2936662
+   tuple-ids=0 row-size=20B cardinality=130.03K cost=94136656
    in pipelines: 01(GETNEXT)
 ====
 # TPCDS-Q78
@@ -7503,8 +7486,8 @@ ORDER BY ss_sold_year,
          ratio
 LIMIT 100;
 ---- PARALLELPLANS
-Max Per-Host Resource Reservation: Memory=308.50MB Threads=29
-Per-Host Resource Estimates: Memory=617MB
+Max Per-Host Resource Reservation: Memory=257.12MB Threads=29
+Per-Host Resource Estimates: Memory=501MB
 F12:PLAN FRAGMENT [UNPARTITIONED] hosts=1 instances=1
 |  Per-Instance Resources: mem-estimate=4.07MB mem-reservation=4.00MB thread-reservation=1
 |  max-parallelism=1 segment-costs=[1012] cpu-comparison-result=26 [max(1 (self) vs 26 (sum children))]
@@ -7521,7 +7504,7 @@ PLAN-ROOT SINK
 |
 F03:PLAN FRAGMENT [HASH(d_year,cs_item_sk,cs_bill_customer_sk)] hosts=3 instances=6 (adjusted from 3)
 Per-Instance Resources: mem-estimate=15.42MB mem-reservation=4.75MB thread-reservation=1
-max-parallelism=3 segment-costs=[1785038, 884887, 12] cpu-comparison-result=26 [max(6 (self) vs 26 (sum children))]
+max-parallelism=6 segment-costs=[1785038, 884887, 12] cpu-comparison-result=26 [max(6 (self) vs 26 (sum children))]
 20:TOP-N [LIMIT=100]
 |  order by: ss_sold_year ASC, ss_item_sk ASC, ss_customer_sk ASC, ss_qty DESC, ss_wc DESC, ss_sp DESC, coalesce(ws_qty, 0) + coalesce(cs_qty, 0) ASC, coalesce(ws_wc, 0) + coalesce(cs_wc, 0) ASC, coalesce(ws_sp, 0) + coalesce(cs_sp, 0) ASC, round((ss_qty * 1.00) / (coalesce(ws_qty, 0) + coalesce(cs_qty, 0)), 2) ASC
 |  materialized: coalesce(ws_qty, 0) + coalesce(cs_qty, 0), coalesce(ws_wc, 0) + coalesce(cs_wc, 0), coalesce(ws_sp, 0) + coalesce(cs_sp, 0), round((ss_qty * 1.00) / (coalesce(ws_qty, 0) + coalesce(cs_qty, 0)), 2)
@@ -7554,7 +7537,7 @@ max-parallelism=3 segment-costs=[1785038, 884887, 12] cpu-comparison-result=26 [
 |  |
 |  F07:PLAN FRAGMENT [HASH(d_year,ws_item_sk,ws_bill_customer_sk)] hosts=2 instances=4 (adjusted from 2)
 |  Per-Instance Resources: mem-estimate=14.07MB mem-reservation=4.75MB thread-reservation=1
-|  max-parallelism=2 segment-costs=[896697, 444365] cpu-comparison-result=18 [max(4 (self) vs 18 (sum children))]
+|  max-parallelism=4 segment-costs=[896697, 444365] cpu-comparison-result=18 [max(4 (self) vs 18 (sum children))]
 |  18:HASH JOIN [RIGHT OUTER JOIN, PARTITIONED]
 |  |  hash-table-id=01
 |  |  hash predicates: d_year = d_year, ws_bill_customer_sk = ss_customer_sk, ws_item_sk = ss_item_sk
@@ -7577,9 +7560,9 @@ max-parallelism=3 segment-costs=[1785038, 884887, 12] cpu-comparison-result=26 [
 |  |  |  tuple-ids=3 row-size=56B cardinality=3.00K cost=177
 |  |  |  in pipelines: 32(GETNEXT)
 |  |  |
-|  |  F11:PLAN FRAGMENT [HASH(d_year,ss_item_sk,ss_customer_sk)] hosts=3 instances=6 (adjusted from 12)
+|  |  F11:PLAN FRAGMENT [HASH(d_year,ss_item_sk,ss_customer_sk)] hosts=3 instances=6 (adjusted from 48)
 |  |  Per-Instance Resources: mem-estimate=20.70MB mem-reservation=8.50MB thread-reservation=1
-|  |  max-parallelism=3 segment-costs=[3568694, 177] cpu-comparison-result=12 [max(6 (self) vs 12 (sum children))]
+|  |  max-parallelism=6 segment-costs=[3568694, 177] cpu-comparison-result=12 [max(6 (self) vs 12 (sum children))]
 |  |  32:AGGREGATE [FINALIZE]
 |  |  |  output: sum:merge(ss_quantity), sum:merge(ss_wholesale_cost), sum:merge(ss_sales_price)
 |  |  |  group by: d_year, ss_item_sk, ss_customer_sk
@@ -7593,10 +7576,10 @@ max-parallelism=3 segment-costs=[1785038, 884887, 12] cpu-comparison-result=26 [
 |  |  |  tuple-ids=3 row-size=56B cardinality=589.03K cost=34514
 |  |  |  in pipelines: 00(GETNEXT)
 |  |  |
-|  |  F08:PLAN FRAGMENT [RANDOM] hosts=3 instances=12
+|  |  F08:PLAN FRAGMENT [RANDOM] hosts=3 instances=12 (adjusted from 48)
 |  |  Per-Host Shared Resources: mem-estimate=1.00MB mem-reservation=1.00MB thread-reservation=0 runtime-filters-memory=1.00MB
 |  |  Per-Instance Resources: mem-estimate=27.41MB mem-reservation=9.00MB thread-reservation=1
-|  |  max-parallelism=12 segment-costs=[12276657, 34514] cpu-comparison-result=12 [max(12 (self) vs 8 (sum children))]
+|  |  max-parallelism=12 segment-costs=[103476656, 34514] cpu-comparison-result=12 [max(12 (self) vs 8 (sum children))]
 |  |  05:AGGREGATE [STREAMING]
 |  |  |  output: sum(CAST(ss_quantity AS BIGINT)), sum(ss_wholesale_cost), sum(ss_sales_price)
 |  |  |  group by: d_year, ss_item_sk, ss_customer_sk
@@ -7628,7 +7611,7 @@ max-parallelism=3 segment-costs=[1785038, 884887, 12] cpu-comparison-result=26 [
 |  |  |  |
 |  |  |  F10:PLAN FRAGMENT [RANDOM] hosts=1 instances=1
 |  |  |  Per-Instance Resources: mem-estimate=16.05MB mem-reservation=512.00KB thread-reservation=1
-|  |  |  max-parallelism=1 segment-costs=[73625]
+|  |  |  max-parallelism=1 segment-costs=[123625]
 |  |  |  02:SCAN HDFS [tpcds_parquet.date_dim, RANDOM]
 |  |  |     HDFS partitions=1/1 files=1 size=2.15MB
 |  |  |     predicates: tpcds_parquet.date_dim.d_year = CAST(2000 AS INT)
@@ -7639,7 +7622,7 @@ max-parallelism=3 segment-costs=[1785038, 884887, 12] cpu-comparison-result=26 [
 |  |  |     parquet statistics predicates: tpcds_parquet.date_dim.d_year = CAST(2000 AS INT)
 |  |  |     parquet dictionary predicates: tpcds_parquet.date_dim.d_year = CAST(2000 AS INT)
 |  |  |     mem-estimate=16.00MB mem-reservation=512.00KB thread-reservation=0
-|  |  |     tuple-ids=2 row-size=8B cardinality=373 cost=73620
+|  |  |     tuple-ids=2 row-size=8B cardinality=373 cost=123620
 |  |  |     in pipelines: 02(GETNEXT)
 |  |  |
 |  |  03:HASH JOIN [LEFT OUTER JOIN, BROADCAST]
@@ -7665,16 +7648,16 @@ max-parallelism=3 segment-costs=[1785038, 884887, 12] cpu-comparison-result=26 [
 |  |  |  |  in pipelines: 01(GETNEXT)
 |  |  |  |
 |  |  |  F09:PLAN FRAGMENT [RANDOM] hosts=1 instances=1
-|  |  |  Per-Instance Resources: mem-estimate=24.08MB mem-reservation=4.00MB thread-reservation=1
-|  |  |  max-parallelism=1 segment-costs=[10109]
+|  |  |  Per-Instance Resources: mem-estimate=16.08MB mem-reservation=4.00MB thread-reservation=1
+|  |  |  max-parallelism=1 segment-costs=[60109]
 |  |  |  01:SCAN HDFS [tpcds_parquet.store_returns, RANDOM]
 |  |  |     HDFS partitions=1/1 files=1 size=15.43MB
 |  |  |     stored statistics:
 |  |  |       table: rows=287.51K size=15.43MB
 |  |  |       columns: all
 |  |  |     extrapolated-rows=disabled max-scan-range-rows=287.51K
-|  |  |     mem-estimate=24.00MB mem-reservation=4.00MB thread-reservation=0
-|  |  |     tuple-ids=1 row-size=16B cardinality=287.51K cost=4493
+|  |  |     mem-estimate=16.00MB mem-reservation=4.00MB thread-reservation=0
+|  |  |     tuple-ids=1 row-size=16B cardinality=287.51K cost=54493
 |  |  |     in pipelines: 01(GETNEXT)
 |  |  |
 |  |  00:SCAN HDFS [tpcds_parquet.store_sales, RANDOM]
@@ -7686,7 +7669,7 @@ max-parallelism=3 segment-costs=[1785038, 884887, 12] cpu-comparison-result=26 [
 |  |       columns: all
 |  |     extrapolated-rows=disabled max-scan-range-rows=130.09K
 |  |     mem-estimate=16.00MB mem-reservation=4.00MB thread-reservation=0
-|  |     tuple-ids=0 row-size=36B cardinality=2.88M cost=101265
+|  |     tuple-ids=0 row-size=36B cardinality=2.88M cost=91301264
 |  |     in pipelines: 00(GETNEXT)
 |  |
 |  28:AGGREGATE [FINALIZE]
@@ -7703,8 +7686,8 @@ max-parallelism=3 segment-costs=[1785038, 884887, 12] cpu-comparison-result=26 [
 |  |
 |  F04:PLAN FRAGMENT [RANDOM] hosts=2 instances=2
 |  Per-Host Shared Resources: mem-estimate=3.00MB mem-reservation=3.00MB thread-reservation=0 runtime-filters-memory=3.00MB
-|  Per-Instance Resources: mem-estimate=42.94MB mem-reservation=21.00MB thread-reservation=1
-|  max-parallelism=2 segment-costs=[3071467, 8673] cpu-comparison-result=6 [max(2 (self) vs 6 (sum children))]
+|  Per-Instance Resources: mem-estimate=26.94MB mem-reservation=21.00MB thread-reservation=1
+|  max-parallelism=2 segment-costs=[3171467, 8673] cpu-comparison-result=6 [max(2 (self) vs 6 (sum children))]
 |  11:AGGREGATE [STREAMING]
 |  |  output: sum(CAST(ws_quantity AS BIGINT)), sum(ws_wholesale_cost), sum(ws_sales_price)
 |  |  group by: d_year, ws_item_sk, ws_bill_customer_sk
@@ -7721,13 +7704,13 @@ max-parallelism=3 segment-costs=[1785038, 884887, 12] cpu-comparison-result=26 [
 |  |  in pipelines: 06(GETNEXT), 08(OPEN)
 |  |
 |  |--F17:PLAN FRAGMENT [RANDOM] hosts=2 instances=2
-|  |  |  Per-Instance Resources: mem-estimate=8.77MB mem-reservation=8.75MB thread-reservation=1 runtime-filters-memory=1.00MB
+|  |  |  Per-Instance Resources: mem-estimate=2.95MB mem-reservation=2.94MB thread-reservation=1 runtime-filters-memory=1.00MB
 |  |  |  max-parallelism=2 segment-costs=[383]
 |  |  JOIN BUILD
 |  |  |  join-table-id=04 plan-id=05 cohort-id=02
 |  |  |  build expressions: d_date_sk
 |  |  |  runtime filters: RF014[bloom] <- d_date_sk, RF015[min_max] <- d_date_sk
-|  |  |  mem-estimate=7.75MB mem-reservation=7.75MB spill-buffer=64.00KB thread-reservation=0 cost=373
+|  |  |  mem-estimate=1.94MB mem-reservation=1.94MB spill-buffer=64.00KB thread-reservation=0 cost=373
 |  |  |
 |  |  26:EXCHANGE [BROADCAST]
 |  |  |  mem-estimate=16.00KB mem-reservation=0B thread-reservation=0
@@ -7737,7 +7720,7 @@ max-parallelism=3 segment-costs=[1785038, 884887, 12] cpu-comparison-result=26 [
 |  |  F06:PLAN FRAGMENT [RANDOM] hosts=1 instances=1
 |  |  Per-Host Shared Resources: mem-estimate=1.00MB mem-reservation=1.00MB thread-reservation=0 runtime-filters-memory=1.00MB
 |  |  Per-Instance Resources: mem-estimate=16.05MB mem-reservation=512.00KB thread-reservation=1
-|  |  max-parallelism=1 segment-costs=[73625]
+|  |  max-parallelism=1 segment-costs=[123625]
 |  |  08:SCAN HDFS [tpcds_parquet.date_dim, RANDOM]
 |  |     HDFS partitions=1/1 files=1 size=2.15MB
 |  |     predicates: tpcds_parquet.date_dim.d_year = CAST(2000 AS INT)
@@ -7749,7 +7732,7 @@ max-parallelism=3 segment-costs=[1785038, 884887, 12] cpu-comparison-result=26 [
 |  |     parquet statistics predicates: tpcds_parquet.date_dim.d_year = CAST(2000 AS INT)
 |  |     parquet dictionary predicates: tpcds_parquet.date_dim.d_year = CAST(2000 AS INT)
 |  |     mem-estimate=16.00MB mem-reservation=512.00KB thread-reservation=0
-|  |     tuple-ids=7 row-size=8B cardinality=373 cost=73620
+|  |     tuple-ids=7 row-size=8B cardinality=373 cost=123620
 |  |     in pipelines: 08(GETNEXT)
 |  |
 |  09:HASH JOIN [LEFT OUTER JOIN, BROADCAST]
@@ -7762,12 +7745,12 @@ max-parallelism=3 segment-costs=[1785038, 884887, 12] cpu-comparison-result=26 [
 |  |  in pipelines: 06(GETNEXT), 07(OPEN)
 |  |
 |  |--F18:PLAN FRAGMENT [RANDOM] hosts=2 instances=2
-|  |  |  Per-Instance Resources: mem-estimate=20.11MB mem-reservation=19.00MB thread-reservation=1
+|  |  |  Per-Instance Resources: mem-estimate=5.86MB mem-reservation=4.75MB thread-reservation=1
 |  |  |  max-parallelism=2 segment-costs=[146330]
 |  |  JOIN BUILD
 |  |  |  join-table-id=05 plan-id=06 cohort-id=02
 |  |  |  build expressions: wr_item_sk, wr_order_number
-|  |  |  mem-estimate=19.00MB mem-reservation=19.00MB spill-buffer=256.00KB thread-reservation=0 cost=143526
+|  |  |  mem-estimate=4.75MB mem-reservation=4.75MB spill-buffer=256.00KB thread-reservation=0 cost=143526
 |  |  |
 |  |  25:EXCHANGE [BROADCAST]
 |  |  |  mem-estimate=1.11MB mem-reservation=0B thread-reservation=0
@@ -7777,7 +7760,7 @@ max-parallelism=3 segment-costs=[1785038, 884887, 12] cpu-comparison-result=26 [
 |  |  F05:PLAN FRAGMENT [RANDOM] hosts=1 instances=1
 |  |  Per-Host Shared Resources: mem-estimate=1.00MB mem-reservation=1.00MB thread-reservation=0 runtime-filters-memory=1.00MB
 |  |  Per-Instance Resources: mem-estimate=16.08MB mem-reservation=1.00MB thread-reservation=1
-|  |  max-parallelism=1 segment-costs=[2524]
+|  |  max-parallelism=1 segment-costs=[52524]
 |  |  07:SCAN HDFS [tpcds_parquet.web_returns, RANDOM]
 |  |     HDFS partitions=1/1 files=1 size=5.66MB
 |  |     runtime filters: RF013[min_max] -> tpcds_parquet.web_returns.wr_item_sk, RF010[bloom] -> tpcds_parquet.web_returns.wr_item_sk
@@ -7786,7 +7769,7 @@ max-parallelism=3 segment-costs=[1785038, 884887, 12] cpu-comparison-result=26 [
 |  |       columns: all
 |  |     extrapolated-rows=disabled max-scan-range-rows=71.76K
 |  |     mem-estimate=16.00MB mem-reservation=1.00MB thread-reservation=0
-|  |     tuple-ids=6 row-size=16B cardinality=71.76K cost=1122
+|  |     tuple-ids=6 row-size=16B cardinality=71.76K cost=51122
 |  |     in pipelines: 07(GETNEXT)
 |  |
 |  06:SCAN HDFS [tpcds_parquet.web_sales, RANDOM]
@@ -7796,8 +7779,8 @@ max-parallelism=3 segment-costs=[1785038, 884887, 12] cpu-comparison-result=26 [
 |       table: rows=719.38K size=45.09MB
 |       columns: all
 |     extrapolated-rows=disabled max-scan-range-rows=644.77K
-|     mem-estimate=32.00MB mem-reservation=16.00MB thread-reservation=0
-|     tuple-ids=5 row-size=36B cardinality=719.38K cost=25291
+|     mem-estimate=16.00MB mem-reservation=16.00MB thread-reservation=0
+|     tuple-ids=5 row-size=36B cardinality=719.38K cost=125291
 |     in pipelines: 06(GETNEXT)
 |
 24:AGGREGATE [FINALIZE]
@@ -7814,8 +7797,8 @@ max-parallelism=3 segment-costs=[1785038, 884887, 12] cpu-comparison-result=26 [
 |
 F00:PLAN FRAGMENT [RANDOM] hosts=3 instances=3
 Per-Host Shared Resources: mem-estimate=3.00MB mem-reservation=3.00MB thread-reservation=0 runtime-filters-memory=3.00MB
-Per-Instance Resources: mem-estimate=59.41MB mem-reservation=25.00MB thread-reservation=1
-max-parallelism=3 segment-costs=[6143098, 17264] cpu-comparison-result=8 [max(3 (self) vs 8 (sum children))]
+Per-Instance Resources: mem-estimate=27.41MB mem-reservation=25.00MB thread-reservation=1
+max-parallelism=3 segment-costs=[6293098, 17264] cpu-comparison-result=8 [max(3 (self) vs 8 (sum children))]
 17:AGGREGATE [STREAMING]
 |  output: sum(CAST(cs_quantity AS BIGINT)), sum(cs_wholesale_cost), sum(cs_sales_price)
 |  group by: d_year, cs_item_sk, cs_bill_customer_sk
@@ -7832,13 +7815,13 @@ max-parallelism=3 segment-costs=[6143098, 17264] cpu-comparison-result=8 [max(3
 |  in pipelines: 12(GETNEXT), 14(OPEN)
 |
 |--F19:PLAN FRAGMENT [RANDOM] hosts=3 instances=3
-|  |  Per-Instance Resources: mem-estimate=8.77MB mem-reservation=8.75MB thread-reservation=1 runtime-filters-memory=1.00MB
+|  |  Per-Instance Resources: mem-estimate=2.95MB mem-reservation=2.94MB thread-reservation=1 runtime-filters-memory=1.00MB
 |  |  max-parallelism=3 segment-costs=[388]
 |  JOIN BUILD
 |  |  join-table-id=06 plan-id=07 cohort-id=01
 |  |  build expressions: d_date_sk
 |  |  runtime filters: RF006[bloom] <- d_date_sk, RF007[min_max] <- d_date_sk
-|  |  mem-estimate=7.75MB mem-reservation=7.75MB spill-buffer=64.00KB thread-reservation=0 cost=373
+|  |  mem-estimate=1.94MB mem-reservation=1.94MB spill-buffer=64.00KB thread-reservation=0 cost=373
 |  |
 |  22:EXCHANGE [BROADCAST]
 |  |  mem-estimate=16.00KB mem-reservation=0B thread-reservation=0
@@ -7848,7 +7831,7 @@ max-parallelism=3 segment-costs=[6143098, 17264] cpu-comparison-result=8 [max(3
 |  F02:PLAN FRAGMENT [RANDOM] hosts=1 instances=1
 |  Per-Host Shared Resources: mem-estimate=1.00MB mem-reservation=1.00MB thread-reservation=0 runtime-filters-memory=1.00MB
 |  Per-Instance Resources: mem-estimate=16.05MB mem-reservation=512.00KB thread-reservation=1
-|  max-parallelism=1 segment-costs=[73625]
+|  max-parallelism=1 segment-costs=[123625]
 |  14:SCAN HDFS [tpcds_parquet.date_dim, RANDOM]
 |     HDFS partitions=1/1 files=1 size=2.15MB
 |     predicates: tpcds_parquet.date_dim.d_year = CAST(2000 AS INT)
@@ -7860,7 +7843,7 @@ max-parallelism=3 segment-costs=[6143098, 17264] cpu-comparison-result=8 [max(3
 |     parquet statistics predicates: tpcds_parquet.date_dim.d_year = CAST(2000 AS INT)
 |     parquet dictionary predicates: tpcds_parquet.date_dim.d_year = CAST(2000 AS INT)
 |     mem-estimate=16.00MB mem-reservation=512.00KB thread-reservation=0
-|     tuple-ids=12 row-size=8B cardinality=373 cost=73620
+|     tuple-ids=12 row-size=8B cardinality=373 cost=123620
 |     in pipelines: 14(GETNEXT)
 |
 15:HASH JOIN [LEFT OUTER JOIN, BROADCAST]
@@ -7873,12 +7856,12 @@ max-parallelism=3 segment-costs=[6143098, 17264] cpu-comparison-result=8 [max(3
 |  in pipelines: 12(GETNEXT), 13(OPEN)
 |
 |--F20:PLAN FRAGMENT [RANDOM] hosts=3 instances=3
-|  |  Per-Instance Resources: mem-estimate=36.22MB mem-reservation=34.00MB thread-reservation=1
+|  |  Per-Instance Resources: mem-estimate=10.72MB mem-reservation=8.50MB thread-reservation=1
 |  |  max-parallelism=3 segment-costs=[296576]
 |  JOIN BUILD
 |  |  join-table-id=07 plan-id=08 cohort-id=01
 |  |  build expressions: cr_item_sk, cr_order_number
-|  |  mem-estimate=34.00MB mem-reservation=34.00MB spill-buffer=512.00KB thread-reservation=0 cost=288134
+|  |  mem-estimate=8.50MB mem-reservation=8.50MB spill-buffer=512.00KB thread-reservation=0 cost=288134
 |  |
 |  21:EXCHANGE [BROADCAST]
 |  |  mem-estimate=2.22MB mem-reservation=0B thread-reservation=0
@@ -7887,8 +7870,8 @@ max-parallelism=3 segment-costs=[6143098, 17264] cpu-comparison-result=8 [max(3
 |  |
 |  F01:PLAN FRAGMENT [RANDOM] hosts=1 instances=1
 |  Per-Host Shared Resources: mem-estimate=1.00MB mem-reservation=1.00MB thread-reservation=0 runtime-filters-memory=1.00MB
-|  Per-Instance Resources: mem-estimate=24.08MB mem-reservation=2.00MB thread-reservation=1
-|  max-parallelism=1 segment-costs=[5066]
+|  Per-Instance Resources: mem-estimate=16.08MB mem-reservation=2.00MB thread-reservation=1
+|  max-parallelism=1 segment-costs=[55066]
 |  13:SCAN HDFS [tpcds_parquet.catalog_returns, RANDOM]
 |     HDFS partitions=1/1 files=1 size=10.62MB
 |     runtime filters: RF005[min_max] -> tpcds_parquet.catalog_returns.cr_item_sk, RF002[bloom] -> tpcds_parquet.catalog_returns.cr_item_sk
@@ -7896,8 +7879,8 @@ max-parallelism=3 segment-costs=[6143098, 17264] cpu-comparison-result=8 [max(3
 |       table: rows=144.07K size=10.62MB
 |       columns: all
 |     extrapolated-rows=disabled max-scan-range-rows=144.07K
-|     mem-estimate=24.00MB mem-reservation=2.00MB thread-reservation=0
-|     tuple-ids=11 row-size=16B cardinality=144.07K cost=2252
+|     mem-estimate=16.00MB mem-reservation=2.00MB thread-reservation=0
+|     tuple-ids=11 row-size=16B cardinality=144.07K cost=52252
 |     in pipelines: 13(GETNEXT)
 |
 12:SCAN HDFS [tpcds_parquet.catalog_sales, RANDOM]
@@ -7907,8 +7890,8 @@ max-parallelism=3 segment-costs=[6143098, 17264] cpu-comparison-result=8 [max(3
      table: rows=1.44M size=96.62MB
      columns: all
    extrapolated-rows=disabled max-scan-range-rows=650.14K
-   mem-estimate=48.00MB mem-reservation=16.00MB thread-reservation=0
-   tuple-ids=10 row-size=36B cardinality=1.44M cost=50680
+   mem-estimate=16.00MB mem-reservation=16.00MB thread-reservation=0
+   tuple-ids=10 row-size=36B cardinality=1.44M cost=200680
    in pipelines: 12(GETNEXT)
 ====
 # TPCDS-Q80
@@ -8006,8 +7989,8 @@ group by web_site_id)
          ,id
  limit 100
 ---- PARALLELPLANS
-Max Per-Host Resource Reservation: Memory=366.38MB Threads=43
-Per-Host Resource Estimates: Memory=1001MB
+Max Per-Host Resource Reservation: Memory=280.12MB Threads=43
+Per-Host Resource Estimates: Memory=851MB
 F23:PLAN FRAGMENT [UNPARTITIONED] hosts=1 instances=1
 |  Per-Instance Resources: mem-estimate=4.05MB mem-reservation=4.00MB thread-reservation=1
 |  max-parallelism=1 segment-costs=[508] cpu-comparison-result=55 [max(1 (self) vs 55 (sum children))]
@@ -8022,9 +8005,9 @@ PLAN-ROOT SINK
 |  tuple-ids=30 row-size=72B cardinality=100 cost=8
 |  in pipelines: 39(GETNEXT)
 |
-F22:PLAN FRAGMENT [HASH(CASE valid_tid(26,27,28) WHEN 26 THEN murmur_hash(channel) WHEN 27 THEN murmur_hash(channel) WHEN 28 THEN murmur_hash(NULL) END,CASE valid_tid(26,27,28) WHEN 26 THEN murmur_hash(id) WHEN 27 THEN murmur_hash(NULL) WHEN 28 THEN murmur_hash(NULL) END)] hosts=3 instances=6 (adjusted from 12)
+F22:PLAN FRAGMENT [HASH(CASE valid_tid(26,27,28) WHEN 26 THEN murmur_hash(channel) WHEN 27 THEN murmur_hash(channel) WHEN 28 THEN murmur_hash(NULL) END,CASE valid_tid(26,27,28) WHEN 26 THEN murmur_hash(id) WHEN 27 THEN murmur_hash(NULL) WHEN 28 THEN murmur_hash(NULL) END)] hosts=3 instances=6 (adjusted from 48)
 Per-Instance Resources: mem-estimate=40.00MB mem-reservation=7.75MB thread-reservation=1
-max-parallelism=3 segment-costs=[176035, 69384, 200, 8] cpu-comparison-result=55 [max(6 (self) vs 55 (sum children))]
+max-parallelism=6 segment-costs=[176035, 69384, 200, 8] cpu-comparison-result=55 [max(6 (self) vs 55 (sum children))]
 39:TOP-N [LIMIT=100]
 |  order by: CASE valid_tid(26,27,28) WHEN 26 THEN channel WHEN 27 THEN channel WHEN 28 THEN NULL END ASC, CASE valid_tid(26,27,28) WHEN 26 THEN id WHEN 27 THEN NULL WHEN 28 THEN NULL END ASC
 |  mem-estimate=7.03KB mem-reservation=0B thread-reservation=0
@@ -8057,7 +8040,7 @@ max-parallelism=3 segment-costs=[176035, 69384, 200, 8] cpu-comparison-result=55
 |  tuple-ids=26N,27N,28N row-size=216B cardinality=11.56K cost=2575
 |  in pipelines: 46(GETNEXT), 53(GETNEXT), 60(GETNEXT)
 |
-F21:PLAN FRAGMENT [RANDOM] hosts=3 instances=12
+F21:PLAN FRAGMENT [RANDOM] hosts=3 instances=12 (adjusted from 48)
 Per-Instance Resources: mem-estimate=45.86MB mem-reservation=7.94MB thread-reservation=1
 max-parallelism=12 segment-costs=[25, 47058, 62, 346800, 2575] cpu-comparison-result=55 [max(12 (self) vs 55 (sum children))]
 37:AGGREGATE [STREAMING]
@@ -8093,8 +8076,8 @@ max-parallelism=12 segment-costs=[25, 47058, 62, 346800, 2575] cpu-comparison-re
 |  |
 |  F14:PLAN FRAGMENT [RANDOM] hosts=2 instances=2
 |  Per-Host Shared Resources: mem-estimate=2.00MB mem-reservation=2.00MB thread-reservation=0 runtime-filters-memory=2.00MB
-|  Per-Instance Resources: mem-estimate=45.75MB mem-reservation=18.00MB thread-reservation=1
-|  max-parallelism=2 segment-costs=[2675586, 2] cpu-comparison-result=15 [max(2 (self) vs 15 (sum children))]
+|  Per-Instance Resources: mem-estimate=29.75MB mem-reservation=18.00MB thread-reservation=1
+|  max-parallelism=2 segment-costs=[2775586, 2] cpu-comparison-result=15 [max(2 (self) vs 15 (sum children))]
 |  36:AGGREGATE [STREAMING]
 |  |  output: sum(ws_ext_sales_price), sum(coalesce(wr_return_amt, CAST(0 AS DECIMAL(7,2)))), sum(ws_net_profit - coalesce(wr_net_loss, CAST(0 AS DECIMAL(7,2))))
 |  |  group by: web_site_id
@@ -8111,13 +8094,13 @@ max-parallelism=12 segment-costs=[25, 47058, 62, 346800, 2575] cpu-comparison-re
 |  |  in pipelines: 25(GETNEXT), 28(OPEN)
 |  |
 |  |--F34:PLAN FRAGMENT [RANDOM] hosts=2 instances=2
-|  |  |  Per-Instance Resources: mem-estimate=7.77MB mem-reservation=7.75MB thread-reservation=1
+|  |  |  Per-Instance Resources: mem-estimate=1.95MB mem-reservation=1.94MB thread-reservation=1
 |  |  |  max-parallelism=2 segment-costs=[34]
 |  |  JOIN BUILD
 |  |  |  join-table-id=10 plan-id=11 cohort-id=03
 |  |  |  build expressions: web_site_sk
 |  |  |  runtime filters: RF017[min_max] <- web_site_sk
-|  |  |  mem-estimate=7.75MB mem-reservation=7.75MB spill-buffer=64.00KB thread-reservation=0 cost=30
+|  |  |  mem-estimate=1.94MB mem-reservation=1.94MB spill-buffer=64.00KB thread-reservation=0 cost=30
 |  |  |
 |  |  58:EXCHANGE [BROADCAST]
 |  |  |  mem-estimate=16.00KB mem-reservation=0B thread-reservation=0
@@ -8126,7 +8109,7 @@ max-parallelism=12 segment-costs=[25, 47058, 62, 346800, 2575] cpu-comparison-re
 |  |  |
 |  |  F19:PLAN FRAGMENT [RANDOM] hosts=1 instances=1
 |  |  Per-Instance Resources: mem-estimate=16.14MB mem-reservation=16.00KB thread-reservation=1
-|  |  max-parallelism=1 segment-costs=[3]
+|  |  max-parallelism=1 segment-costs=[50003]
 |  |  28:SCAN HDFS [tpcds_parquet.web_site, RANDOM]
 |  |     HDFS partitions=1/1 files=1 size=11.91KB
 |  |     stored statistics:
@@ -8134,7 +8117,7 @@ max-parallelism=12 segment-costs=[25, 47058, 62, 346800, 2575] cpu-comparison-re
 |  |       columns: all
 |  |     extrapolated-rows=disabled max-scan-range-rows=30
 |  |     mem-estimate=16.00MB mem-reservation=16.00KB thread-reservation=0
-|  |     tuple-ids=19 row-size=32B cardinality=30 cost=1
+|  |     tuple-ids=19 row-size=32B cardinality=30 cost=50001
 |  |     in pipelines: 28(GETNEXT)
 |  |
 |  34:HASH JOIN [INNER JOIN, BROADCAST]
@@ -8146,13 +8129,13 @@ max-parallelism=12 segment-costs=[25, 47058, 62, 346800, 2575] cpu-comparison-re
 |  |  in pipelines: 25(GETNEXT), 27(OPEN)
 |  |
 |  |--F35:PLAN FRAGMENT [RANDOM] hosts=2 instances=2
-|  |  |  Per-Instance Resources: mem-estimate=7.96MB mem-reservation=7.75MB thread-reservation=1
+|  |  |  Per-Instance Resources: mem-estimate=2.15MB mem-reservation=1.94MB thread-reservation=1
 |  |  |  max-parallelism=2 segment-costs=[7735]
 |  |  JOIN BUILD
 |  |  |  join-table-id=11 plan-id=12 cohort-id=03
 |  |  |  build expressions: d_date_sk
 |  |  |  runtime filters: RF019[min_max] <- d_date_sk
-|  |  |  mem-estimate=7.75MB mem-reservation=7.75MB spill-buffer=64.00KB thread-reservation=0 cost=7305
+|  |  |  mem-estimate=1.94MB mem-reservation=1.94MB spill-buffer=64.00KB thread-reservation=0 cost=7305
 |  |  |
 |  |  57:EXCHANGE [BROADCAST]
 |  |  |  mem-estimate=215.48KB mem-reservation=0B thread-reservation=0
@@ -8161,7 +8144,7 @@ max-parallelism=12 segment-costs=[25, 47058, 62, 346800, 2575] cpu-comparison-re
 |  |  |
 |  |  F18:PLAN FRAGMENT [RANDOM] hosts=1 instances=1
 |  |  Per-Instance Resources: mem-estimate=16.12MB mem-reservation=1.00MB thread-reservation=1
-|  |  max-parallelism=1 segment-costs=[148168]
+|  |  max-parallelism=1 segment-costs=[198168]
 |  |  27:SCAN HDFS [tpcds_parquet.date_dim, RANDOM]
 |  |     HDFS partitions=1/1 files=1 size=2.15MB
 |  |     predicates: CAST(d_date AS DATE) <= DATE '1998-09-03', CAST(d_date AS DATE) >= DATE '1998-08-04'
@@ -8172,7 +8155,7 @@ max-parallelism=12 segment-costs=[25, 47058, 62, 346800, 2575] cpu-comparison-re
 |  |     parquet statistics predicates: CAST(d_date AS DATE) <= DATE '1998-09-03', CAST(d_date AS DATE) >= DATE '1998-08-04'
 |  |     parquet dictionary predicates: CAST(d_date AS DATE) <= DATE '1998-09-03', CAST(d_date AS DATE) >= DATE '1998-08-04'
 |  |     mem-estimate=16.00MB mem-reservation=1.00MB thread-reservation=0
-|  |     tuple-ids=18 row-size=26B cardinality=7.30K cost=147953
+|  |     tuple-ids=18 row-size=26B cardinality=7.30K cost=197953
 |  |     in pipelines: 27(GETNEXT)
 |  |
 |  33:HASH JOIN [INNER JOIN, BROADCAST]
@@ -8184,13 +8167,13 @@ max-parallelism=12 segment-costs=[25, 47058, 62, 346800, 2575] cpu-comparison-re
 |  |  in pipelines: 25(GETNEXT), 30(OPEN)
 |  |
 |  |--F36:PLAN FRAGMENT [RANDOM] hosts=2 instances=2
-|  |  |  Per-Instance Resources: mem-estimate=8.77MB mem-reservation=8.75MB thread-reservation=1 runtime-filters-memory=1.00MB
+|  |  |  Per-Instance Resources: mem-estimate=2.95MB mem-reservation=2.94MB thread-reservation=1 runtime-filters-memory=1.00MB
 |  |  |  max-parallelism=2 segment-costs=[308]
 |  |  JOIN BUILD
 |  |  |  join-table-id=12 plan-id=13 cohort-id=03
 |  |  |  build expressions: p_promo_sk
 |  |  |  runtime filters: RF020[bloom] <- p_promo_sk, RF021[min_max] <- p_promo_sk
-|  |  |  mem-estimate=7.75MB mem-reservation=7.75MB spill-buffer=64.00KB thread-reservation=0 cost=294
+|  |  |  mem-estimate=1.94MB mem-reservation=1.94MB spill-buffer=64.00KB thread-reservation=0 cost=294
 |  |  |
 |  |  56:EXCHANGE [BROADCAST]
 |  |  |  mem-estimate=16.00KB mem-reservation=0B thread-reservation=0
@@ -8199,7 +8182,7 @@ max-parallelism=12 segment-costs=[25, 47058, 62, 346800, 2575] cpu-comparison-re
 |  |  |
 |  |  F17:PLAN FRAGMENT [RANDOM] hosts=1 instances=1
 |  |  Per-Instance Resources: mem-estimate=16.08MB mem-reservation=32.00KB thread-reservation=1
-|  |  max-parallelism=1 segment-costs=[312]
+|  |  max-parallelism=1 segment-costs=[50312]
 |  |  30:SCAN HDFS [tpcds_parquet.promotion, RANDOM]
 |  |     HDFS partitions=1/1 files=1 size=23.30KB
 |  |     predicates: p_channel_tv = 'N'
@@ -8210,7 +8193,7 @@ max-parallelism=12 segment-costs=[25, 47058, 62, 346800, 2575] cpu-comparison-re
 |  |     parquet statistics predicates: p_channel_tv = 'N'
 |  |     parquet dictionary predicates: p_channel_tv = 'N'
 |  |     mem-estimate=16.00MB mem-reservation=32.00KB thread-reservation=0
-|  |     tuple-ids=21 row-size=17B cardinality=294 cost=305
+|  |     tuple-ids=21 row-size=17B cardinality=294 cost=50305
 |  |     in pipelines: 30(GETNEXT)
 |  |
 |  32:HASH JOIN [INNER JOIN, BROADCAST]
@@ -8222,13 +8205,13 @@ max-parallelism=12 segment-costs=[25, 47058, 62, 346800, 2575] cpu-comparison-re
 |  |  in pipelines: 25(GETNEXT), 29(OPEN)
 |  |
 |  |--F37:PLAN FRAGMENT [RANDOM] hosts=2 instances=2
-|  |  |  Per-Instance Resources: mem-estimate=8.79MB mem-reservation=8.75MB thread-reservation=1 runtime-filters-memory=1.00MB
+|  |  |  Per-Instance Resources: mem-estimate=2.97MB mem-reservation=2.94MB thread-reservation=1 runtime-filters-memory=1.00MB
 |  |  |  max-parallelism=2 segment-costs=[1858]
 |  |  JOIN BUILD
 |  |  |  join-table-id=13 plan-id=14 cohort-id=03
 |  |  |  build expressions: i_item_sk
 |  |  |  runtime filters: RF022[bloom] <- i_item_sk, RF023[min_max] <- i_item_sk
-|  |  |  mem-estimate=7.75MB mem-reservation=7.75MB spill-buffer=64.00KB thread-reservation=0 cost=1800
+|  |  |  mem-estimate=1.94MB mem-reservation=1.94MB spill-buffer=64.00KB thread-reservation=0 cost=1800
 |  |  |
 |  |  55:EXCHANGE [BROADCAST]
 |  |  |  mem-estimate=37.09KB mem-reservation=0B thread-reservation=0
@@ -8237,7 +8220,7 @@ max-parallelism=12 segment-costs=[25, 47058, 62, 346800, 2575] cpu-comparison-re
 |  |  |
 |  |  F16:PLAN FRAGMENT [RANDOM] hosts=1 instances=1
 |  |  Per-Instance Resources: mem-estimate=16.06MB mem-reservation=256.00KB thread-reservation=1
-|  |  max-parallelism=1 segment-costs=[18240]
+|  |  max-parallelism=1 segment-costs=[68240]
 |  |  29:SCAN HDFS [tpcds_parquet.item, RANDOM]
 |  |     HDFS partitions=1/1 files=1 size=1.73MB
 |  |     predicates: i_current_price > CAST(50 AS DECIMAL(3,0))
@@ -8248,7 +8231,7 @@ max-parallelism=12 segment-costs=[25, 47058, 62, 346800, 2575] cpu-comparison-re
 |  |     parquet statistics predicates: i_current_price > CAST(50 AS DECIMAL(3,0))
 |  |     parquet dictionary predicates: i_current_price > CAST(50 AS DECIMAL(3,0))
 |  |     mem-estimate=16.00MB mem-reservation=256.00KB thread-reservation=0
-|  |     tuple-ids=20 row-size=12B cardinality=1.80K cost=18211
+|  |     tuple-ids=20 row-size=12B cardinality=1.80K cost=68211
 |  |     in pipelines: 29(GETNEXT)
 |  |
 |  31:HASH JOIN [LEFT OUTER JOIN, BROADCAST]
@@ -8260,12 +8243,12 @@ max-parallelism=12 segment-costs=[25, 47058, 62, 346800, 2575] cpu-comparison-re
 |  |  in pipelines: 25(GETNEXT), 26(OPEN)
 |  |
 |  |--F38:PLAN FRAGMENT [RANDOM] hosts=2 instances=2
-|  |  |  Per-Instance Resources: mem-estimate=20.67MB mem-reservation=19.00MB thread-reservation=1
+|  |  |  Per-Instance Resources: mem-estimate=6.42MB mem-reservation=4.75MB thread-reservation=1
 |  |  |  max-parallelism=2 segment-costs=[147452]
 |  |  JOIN BUILD
 |  |  |  join-table-id=14 plan-id=15 cohort-id=03
 |  |  |  build expressions: wr_item_sk, wr_order_number
-|  |  |  mem-estimate=19.00MB mem-reservation=19.00MB spill-buffer=256.00KB thread-reservation=0 cost=143526
+|  |  |  mem-estimate=4.75MB mem-reservation=4.75MB spill-buffer=256.00KB thread-reservation=0 cost=143526
 |  |  |
 |  |  54:EXCHANGE [BROADCAST]
 |  |  |  mem-estimate=1.67MB mem-reservation=0B thread-reservation=0
@@ -8275,7 +8258,7 @@ max-parallelism=12 segment-costs=[25, 47058, 62, 346800, 2575] cpu-comparison-re
 |  |  F15:PLAN FRAGMENT [RANDOM] hosts=1 instances=1
 |  |  Per-Host Shared Resources: mem-estimate=1.00MB mem-reservation=1.00MB thread-reservation=0 runtime-filters-memory=1.00MB
 |  |  Per-Instance Resources: mem-estimate=16.11MB mem-reservation=2.00MB thread-reservation=1
-|  |  max-parallelism=1 segment-costs=[3645]
+|  |  max-parallelism=1 segment-costs=[53645]
 |  |  26:SCAN HDFS [tpcds_parquet.web_returns, RANDOM]
 |  |     HDFS partitions=1/1 files=1 size=5.66MB
 |  |     runtime filters: RF023[min_max] -> tpcds_parquet.web_returns.wr_item_sk, RF022[bloom] -> tpcds_parquet.web_returns.wr_item_sk
@@ -8284,7 +8267,7 @@ max-parallelism=12 segment-costs=[25, 47058, 62, 346800, 2575] cpu-comparison-re
 |  |       columns: all
 |  |     extrapolated-rows=disabled max-scan-range-rows=71.76K
 |  |     mem-estimate=16.00MB mem-reservation=2.00MB thread-reservation=0
-|  |     tuple-ids=17 row-size=24B cardinality=71.76K cost=1682
+|  |     tuple-ids=17 row-size=24B cardinality=71.76K cost=51682
 |  |     in pipelines: 26(GETNEXT)
 |  |
 |  25:SCAN HDFS [tpcds_parquet.web_sales, RANDOM]
@@ -8294,8 +8277,8 @@ max-parallelism=12 segment-costs=[25, 47058, 62, 346800, 2575] cpu-comparison-re
 |       table: rows=719.38K size=45.09MB
 |       columns: all
 |     extrapolated-rows=disabled max-scan-range-rows=644.77K
-|     mem-estimate=32.00MB mem-reservation=16.00MB thread-reservation=0
-|     tuple-ids=16 row-size=36B cardinality=719.38K cost=25291
+|     mem-estimate=16.00MB mem-reservation=16.00MB thread-reservation=0
+|     tuple-ids=16 row-size=36B cardinality=719.38K cost=125291
 |     in pipelines: 25(GETNEXT)
 |
 |--53:AGGREGATE [FINALIZE]
@@ -8312,8 +8295,8 @@ max-parallelism=12 segment-costs=[25, 47058, 62, 346800, 2575] cpu-comparison-re
 |  |
 |  F07:PLAN FRAGMENT [RANDOM] hosts=3 instances=3
 |  Per-Host Shared Resources: mem-estimate=4.00MB mem-reservation=4.00MB thread-reservation=0 runtime-filters-memory=4.00MB
-|  Per-Instance Resources: mem-estimate=61.75MB mem-reservation=18.00MB thread-reservation=1
-|  max-parallelism=3 segment-costs=[5361501, 902] cpu-comparison-result=20 [max(3 (self) vs 20 (sum children))]
+|  Per-Instance Resources: mem-estimate=29.75MB mem-reservation=18.00MB thread-reservation=1
+|  max-parallelism=3 segment-costs=[5511501, 902] cpu-comparison-result=20 [max(3 (self) vs 20 (sum children))]
 |  24:AGGREGATE [STREAMING]
 |  |  output: sum(cs_ext_sales_price), sum(coalesce(cr_return_amount, CAST(0 AS DECIMAL(7,2)))), sum(cs_net_profit - coalesce(cr_net_loss, CAST(0 AS DECIMAL(7,2))))
 |  |  group by: cp_catalog_page_id
@@ -8330,13 +8313,13 @@ max-parallelism=12 segment-costs=[25, 47058, 62, 346800, 2575] cpu-comparison-re
 |  |  in pipelines: 13(GETNEXT), 16(OPEN)
 |  |
 |  |--F29:PLAN FRAGMENT [RANDOM] hosts=3 instances=3
-|  |  |  Per-Instance Resources: mem-estimate=9.14MB mem-reservation=8.75MB thread-reservation=1 runtime-filters-memory=1.00MB
+|  |  |  Per-Instance Resources: mem-estimate=3.33MB mem-reservation=2.94MB thread-reservation=1 runtime-filters-memory=1.00MB
 |  |  |  max-parallelism=3 segment-costs=[12954]
 |  |  JOIN BUILD
 |  |  |  join-table-id=05 plan-id=06 cohort-id=02
 |  |  |  build expressions: cp_catalog_page_sk
 |  |  |  runtime filters: RF008[bloom] <- cp_catalog_page_sk, RF009[min_max] <- cp_catalog_page_sk
-|  |  |  mem-estimate=7.75MB mem-reservation=7.75MB spill-buffer=64.00KB thread-reservation=0 cost=11718
+|  |  |  mem-estimate=1.94MB mem-reservation=1.94MB spill-buffer=64.00KB thread-reservation=0 cost=11718
 |  |  |
 |  |  51:EXCHANGE [BROADCAST]
 |  |  |  mem-estimate=402.19KB mem-reservation=0B thread-reservation=0
@@ -8345,7 +8328,7 @@ max-parallelism=12 segment-costs=[25, 47058, 62, 346800, 2575] cpu-comparison-re
 |  |  |
 |  |  F12:PLAN FRAGMENT [RANDOM] hosts=1 instances=1
 |  |  Per-Instance Resources: mem-estimate=16.14MB mem-reservation=256.00KB thread-reservation=1
-|  |  max-parallelism=1 segment-costs=[779]
+|  |  max-parallelism=1 segment-costs=[50779]
 |  |  16:SCAN HDFS [tpcds_parquet.catalog_page, RANDOM]
 |  |     HDFS partitions=1/1 files=1 size=739.17KB
 |  |     stored statistics:
@@ -8353,7 +8336,7 @@ max-parallelism=12 segment-costs=[25, 47058, 62, 346800, 2575] cpu-comparison-re
 |  |       columns: all
 |  |     extrapolated-rows=disabled max-scan-range-rows=11.72K
 |  |     mem-estimate=16.00MB mem-reservation=256.00KB thread-reservation=0
-|  |     tuple-ids=11 row-size=32B cardinality=11.72K cost=367
+|  |     tuple-ids=11 row-size=32B cardinality=11.72K cost=50367
 |  |     in pipelines: 16(GETNEXT)
 |  |
 |  22:HASH JOIN [INNER JOIN, BROADCAST]
@@ -8365,13 +8348,13 @@ max-parallelism=12 segment-costs=[25, 47058, 62, 346800, 2575] cpu-comparison-re
 |  |  in pipelines: 13(GETNEXT), 15(OPEN)
 |  |
 |  |--F30:PLAN FRAGMENT [RANDOM] hosts=3 instances=3
-|  |  |  Per-Instance Resources: mem-estimate=8.96MB mem-reservation=8.75MB thread-reservation=1 runtime-filters-memory=1.00MB
+|  |  |  Per-Instance Resources: mem-estimate=3.15MB mem-reservation=2.94MB thread-reservation=1 runtime-filters-memory=1.00MB
 |  |  |  max-parallelism=3 segment-costs=[7950]
 |  |  JOIN BUILD
 |  |  |  join-table-id=06 plan-id=07 cohort-id=02
 |  |  |  build expressions: d_date_sk
 |  |  |  runtime filters: RF010[bloom] <- d_date_sk, RF011[min_max] <- d_date_sk
-|  |  |  mem-estimate=7.75MB mem-reservation=7.75MB spill-buffer=64.00KB thread-reservation=0 cost=7305
+|  |  |  mem-estimate=1.94MB mem-reservation=1.94MB spill-buffer=64.00KB thread-reservation=0 cost=7305
 |  |  |
 |  |  50:EXCHANGE [BROADCAST]
 |  |  |  mem-estimate=215.48KB mem-reservation=0B thread-reservation=0
@@ -8380,7 +8363,7 @@ max-parallelism=12 segment-costs=[25, 47058, 62, 346800, 2575] cpu-comparison-re
 |  |  |
 |  |  F11:PLAN FRAGMENT [RANDOM] hosts=1 instances=1
 |  |  Per-Instance Resources: mem-estimate=16.12MB mem-reservation=1.00MB thread-reservation=1
-|  |  max-parallelism=1 segment-costs=[148168]
+|  |  max-parallelism=1 segment-costs=[198168]
 |  |  15:SCAN HDFS [tpcds_parquet.date_dim, RANDOM]
 |  |     HDFS partitions=1/1 files=1 size=2.15MB
 |  |     predicates: CAST(d_date AS DATE) <= DATE '1998-09-03', CAST(d_date AS DATE) >= DATE '1998-08-04'
@@ -8391,7 +8374,7 @@ max-parallelism=12 segment-costs=[25, 47058, 62, 346800, 2575] cpu-comparison-re
 |  |     parquet statistics predicates: CAST(d_date AS DATE) <= DATE '1998-09-03', CAST(d_date AS DATE) >= DATE '1998-08-04'
 |  |     parquet dictionary predicates: CAST(d_date AS DATE) <= DATE '1998-09-03', CAST(d_date AS DATE) >= DATE '1998-08-04'
 |  |     mem-estimate=16.00MB mem-reservation=1.00MB thread-reservation=0
-|  |     tuple-ids=10 row-size=26B cardinality=7.30K cost=147953
+|  |     tuple-ids=10 row-size=26B cardinality=7.30K cost=197953
 |  |     in pipelines: 15(GETNEXT)
 |  |
 |  21:HASH JOIN [INNER JOIN, BROADCAST]
@@ -8403,13 +8386,13 @@ max-parallelism=12 segment-costs=[25, 47058, 62, 346800, 2575] cpu-comparison-re
 |  |  in pipelines: 13(GETNEXT), 18(OPEN)
 |  |
 |  |--F31:PLAN FRAGMENT [RANDOM] hosts=3 instances=3
-|  |  |  Per-Instance Resources: mem-estimate=8.77MB mem-reservation=8.75MB thread-reservation=1 runtime-filters-memory=1.00MB
+|  |  |  Per-Instance Resources: mem-estimate=2.95MB mem-reservation=2.94MB thread-reservation=1 runtime-filters-memory=1.00MB
 |  |  |  max-parallelism=3 segment-costs=[315]
 |  |  JOIN BUILD
 |  |  |  join-table-id=07 plan-id=08 cohort-id=02
 |  |  |  build expressions: p_promo_sk
 |  |  |  runtime filters: RF012[bloom] <- p_promo_sk, RF013[min_max] <- p_promo_sk
-|  |  |  mem-estimate=7.75MB mem-reservation=7.75MB spill-buffer=64.00KB thread-reservation=0 cost=294
+|  |  |  mem-estimate=1.94MB mem-reservation=1.94MB spill-buffer=64.00KB thread-reservation=0 cost=294
 |  |  |
 |  |  49:EXCHANGE [BROADCAST]
 |  |  |  mem-estimate=16.00KB mem-reservation=0B thread-reservation=0
@@ -8418,7 +8401,7 @@ max-parallelism=12 segment-costs=[25, 47058, 62, 346800, 2575] cpu-comparison-re
 |  |  |
 |  |  F10:PLAN FRAGMENT [RANDOM] hosts=1 instances=1
 |  |  Per-Instance Resources: mem-estimate=16.08MB mem-reservation=32.00KB thread-reservation=1
-|  |  max-parallelism=1 segment-costs=[312]
+|  |  max-parallelism=1 segment-costs=[50312]
 |  |  18:SCAN HDFS [tpcds_parquet.promotion, RANDOM]
 |  |     HDFS partitions=1/1 files=1 size=23.30KB
 |  |     predicates: p_channel_tv = 'N'
@@ -8429,7 +8412,7 @@ max-parallelism=12 segment-costs=[25, 47058, 62, 346800, 2575] cpu-comparison-re
 |  |     parquet statistics predicates: p_channel_tv = 'N'
 |  |     parquet dictionary predicates: p_channel_tv = 'N'
 |  |     mem-estimate=16.00MB mem-reservation=32.00KB thread-reservation=0
-|  |     tuple-ids=13 row-size=17B cardinality=294 cost=305
+|  |     tuple-ids=13 row-size=17B cardinality=294 cost=50305
 |  |     in pipelines: 18(GETNEXT)
 |  |
 |  20:HASH JOIN [INNER JOIN, BROADCAST]
@@ -8441,13 +8424,13 @@ max-parallelism=12 segment-costs=[25, 47058, 62, 346800, 2575] cpu-comparison-re
 |  |  in pipelines: 13(GETNEXT), 17(OPEN)
 |  |
 |  |--F32:PLAN FRAGMENT [RANDOM] hosts=3 instances=3
-|  |  |  Per-Instance Resources: mem-estimate=8.79MB mem-reservation=8.75MB thread-reservation=1 runtime-filters-memory=1.00MB
+|  |  |  Per-Instance Resources: mem-estimate=2.97MB mem-reservation=2.94MB thread-reservation=1 runtime-filters-memory=1.00MB
 |  |  |  max-parallelism=3 segment-costs=[1887]
 |  |  JOIN BUILD
 |  |  |  join-table-id=08 plan-id=09 cohort-id=02
 |  |  |  build expressions: i_item_sk
 |  |  |  runtime filters: RF014[bloom] <- i_item_sk, RF015[min_max] <- i_item_sk
-|  |  |  mem-estimate=7.75MB mem-reservation=7.75MB spill-buffer=64.00KB thread-reservation=0 cost=1800
+|  |  |  mem-estimate=1.94MB mem-reservation=1.94MB spill-buffer=64.00KB thread-reservation=0 cost=1800
 |  |  |
 |  |  48:EXCHANGE [BROADCAST]
 |  |  |  mem-estimate=37.09KB mem-reservation=0B thread-reservation=0
@@ -8456,7 +8439,7 @@ max-parallelism=12 segment-costs=[25, 47058, 62, 346800, 2575] cpu-comparison-re
 |  |  |
 |  |  F09:PLAN FRAGMENT [RANDOM] hosts=1 instances=1
 |  |  Per-Instance Resources: mem-estimate=16.06MB mem-reservation=256.00KB thread-reservation=1
-|  |  max-parallelism=1 segment-costs=[18240]
+|  |  max-parallelism=1 segment-costs=[68240]
 |  |  17:SCAN HDFS [tpcds_parquet.item, RANDOM]
 |  |     HDFS partitions=1/1 files=1 size=1.73MB
 |  |     predicates: i_current_price > CAST(50 AS DECIMAL(3,0))
@@ -8467,7 +8450,7 @@ max-parallelism=12 segment-costs=[25, 47058, 62, 346800, 2575] cpu-comparison-re
 |  |     parquet statistics predicates: i_current_price > CAST(50 AS DECIMAL(3,0))
 |  |     parquet dictionary predicates: i_current_price > CAST(50 AS DECIMAL(3,0))
 |  |     mem-estimate=16.00MB mem-reservation=256.00KB thread-reservation=0
-|  |     tuple-ids=12 row-size=12B cardinality=1.80K cost=18211
+|  |     tuple-ids=12 row-size=12B cardinality=1.80K cost=68211
 |  |     in pipelines: 17(GETNEXT)
 |  |
 |  19:HASH JOIN [LEFT OUTER JOIN, BROADCAST]
@@ -8479,12 +8462,12 @@ max-parallelism=12 segment-costs=[25, 47058, 62, 346800, 2575] cpu-comparison-re
 |  |  in pipelines: 13(GETNEXT), 14(OPEN)
 |  |
 |  |--F33:PLAN FRAGMENT [RANDOM] hosts=3 instances=3
-|  |  |  Per-Instance Resources: mem-estimate=37.32MB mem-reservation=34.00MB thread-reservation=1
+|  |  |  Per-Instance Resources: mem-estimate=11.82MB mem-reservation=8.50MB thread-reservation=1
 |  |  |  max-parallelism=3 segment-costs=[299954]
 |  |  JOIN BUILD
 |  |  |  join-table-id=09 plan-id=10 cohort-id=02
 |  |  |  build expressions: cr_item_sk, cr_order_number
-|  |  |  mem-estimate=34.00MB mem-reservation=34.00MB spill-buffer=512.00KB thread-reservation=0 cost=288134
+|  |  |  mem-estimate=8.50MB mem-reservation=8.50MB spill-buffer=512.00KB thread-reservation=0 cost=288134
 |  |  |
 |  |  47:EXCHANGE [BROADCAST]
 |  |  |  mem-estimate=3.32MB mem-reservation=0B thread-reservation=0
@@ -8493,8 +8476,8 @@ max-parallelism=12 segment-costs=[25, 47058, 62, 346800, 2575] cpu-comparison-re
 |  |  |
 |  |  F08:PLAN FRAGMENT [RANDOM] hosts=1 instances=1
 |  |  Per-Host Shared Resources: mem-estimate=1.00MB mem-reservation=1.00MB thread-reservation=0 runtime-filters-memory=1.00MB
-|  |  Per-Instance Resources: mem-estimate=24.11MB mem-reservation=4.00MB thread-reservation=1
-|  |  max-parallelism=1 segment-costs=[7317]
+|  |  Per-Instance Resources: mem-estimate=16.11MB mem-reservation=4.00MB thread-reservation=1
+|  |  max-parallelism=1 segment-costs=[57317]
 |  |  14:SCAN HDFS [tpcds_parquet.catalog_returns, RANDOM]
 |  |     HDFS partitions=1/1 files=1 size=10.62MB
 |  |     runtime filters: RF015[min_max] -> tpcds_parquet.catalog_returns.cr_item_sk, RF014[bloom] -> tpcds_parquet.catalog_returns.cr_item_sk
@@ -8502,8 +8485,8 @@ max-parallelism=12 segment-costs=[25, 47058, 62, 346800, 2575] cpu-comparison-re
 |  |       table: rows=144.07K size=10.62MB
 |  |       columns: all
 |  |     extrapolated-rows=disabled max-scan-range-rows=144.07K
-|  |     mem-estimate=24.00MB mem-reservation=4.00MB thread-reservation=0
-|  |     tuple-ids=9 row-size=24B cardinality=144.07K cost=3377
+|  |     mem-estimate=16.00MB mem-reservation=4.00MB thread-reservation=0
+|  |     tuple-ids=9 row-size=24B cardinality=144.07K cost=53377
 |  |     in pipelines: 14(GETNEXT)
 |  |
 |  13:SCAN HDFS [tpcds_parquet.catalog_sales, RANDOM]
@@ -8513,8 +8496,8 @@ max-parallelism=12 segment-costs=[25, 47058, 62, 346800, 2575] cpu-comparison-re
 |       table: rows=1.44M size=96.62MB
 |       columns: all
 |     extrapolated-rows=disabled max-scan-range-rows=650.14K
-|     mem-estimate=48.00MB mem-reservation=16.00MB thread-reservation=0
-|     tuple-ids=8 row-size=36B cardinality=1.44M cost=50680
+|     mem-estimate=16.00MB mem-reservation=16.00MB thread-reservation=0
+|     tuple-ids=8 row-size=36B cardinality=1.44M cost=200680
 |     in pipelines: 13(GETNEXT)
 |
 46:AGGREGATE [FINALIZE]
@@ -8529,10 +8512,10 @@ max-parallelism=12 segment-costs=[25, 47058, 62, 346800, 2575] cpu-comparison-re
 |  tuple-ids=6 row-size=76B cardinality=6 cost=1
 |  in pipelines: 01(GETNEXT)
 |
-F00:PLAN FRAGMENT [RANDOM] hosts=3 instances=12
+F00:PLAN FRAGMENT [RANDOM] hosts=3 instances=12 (adjusted from 48)
 Per-Host Shared Resources: mem-estimate=4.00MB mem-reservation=4.00MB thread-reservation=0 runtime-filters-memory=4.00MB
 Per-Instance Resources: mem-estimate=29.75MB mem-reservation=6.00MB thread-reservation=1
-max-parallelism=12 segment-costs=[10712984, 1] cpu-comparison-result=20 [max(12 (self) vs 20 (sum children))]
+max-parallelism=12 segment-costs=[101912983, 1] cpu-comparison-result=20 [max(12 (self) vs 20 (sum children))]
 12:AGGREGATE [STREAMING]
 |  output: sum(ss_ext_sales_price), sum(coalesce(sr_return_amt, CAST(0 AS DECIMAL(7,2)))), sum(ss_net_profit - coalesce(sr_net_loss, CAST(0 AS DECIMAL(7,2))))
 |  group by: s_store_id
@@ -8564,7 +8547,7 @@ max-parallelism=12 segment-costs=[10712984, 1] cpu-comparison-result=20 [max(12
 |  |
 |  F05:PLAN FRAGMENT [RANDOM] hosts=1 instances=1
 |  Per-Instance Resources: mem-estimate=16.14MB mem-reservation=16.00KB thread-reservation=1
-|  max-parallelism=1 segment-costs=[2]
+|  max-parallelism=1 segment-costs=[50002]
 |  04:SCAN HDFS [tpcds_parquet.store, RANDOM]
 |     HDFS partitions=1/1 files=1 size=9.93KB
 |     stored statistics:
@@ -8572,7 +8555,7 @@ max-parallelism=12 segment-costs=[10712984, 1] cpu-comparison-result=20 [max(12
 |       columns: all
 |     extrapolated-rows=disabled max-scan-range-rows=12
 |     mem-estimate=16.00MB mem-reservation=16.00KB thread-reservation=0
-|     tuple-ids=3 row-size=32B cardinality=12 cost=1
+|     tuple-ids=3 row-size=32B cardinality=12 cost=50001
 |     in pipelines: 04(GETNEXT)
 |
 10:HASH JOIN [INNER JOIN, BROADCAST]
@@ -8599,7 +8582,7 @@ max-parallelism=12 segment-costs=[10712984, 1] cpu-comparison-result=20 [max(12
 |  |
 |  F04:PLAN FRAGMENT [RANDOM] hosts=1 instances=1
 |  Per-Instance Resources: mem-estimate=16.12MB mem-reservation=1.00MB thread-reservation=1
-|  max-parallelism=1 segment-costs=[148168]
+|  max-parallelism=1 segment-costs=[198168]
 |  03:SCAN HDFS [tpcds_parquet.date_dim, RANDOM]
 |     HDFS partitions=1/1 files=1 size=2.15MB
 |     predicates: CAST(d_date AS DATE) <= DATE '1998-09-03', CAST(d_date AS DATE) >= DATE '1998-08-04'
@@ -8610,7 +8593,7 @@ max-parallelism=12 segment-costs=[10712984, 1] cpu-comparison-result=20 [max(12
 |     parquet statistics predicates: CAST(d_date AS DATE) <= DATE '1998-09-03', CAST(d_date AS DATE) >= DATE '1998-08-04'
 |     parquet dictionary predicates: CAST(d_date AS DATE) <= DATE '1998-09-03', CAST(d_date AS DATE) >= DATE '1998-08-04'
 |     mem-estimate=16.00MB mem-reservation=1.00MB thread-reservation=0
-|     tuple-ids=2 row-size=26B cardinality=7.30K cost=147953
+|     tuple-ids=2 row-size=26B cardinality=7.30K cost=197953
 |     in pipelines: 03(GETNEXT)
 |
 09:HASH JOIN [INNER JOIN, BROADCAST]
@@ -8637,7 +8620,7 @@ max-parallelism=12 segment-costs=[10712984, 1] cpu-comparison-result=20 [max(12
 |  |
 |  F03:PLAN FRAGMENT [RANDOM] hosts=1 instances=1
 |  Per-Instance Resources: mem-estimate=16.08MB mem-reservation=32.00KB thread-reservation=1
-|  max-parallelism=1 segment-costs=[312]
+|  max-parallelism=1 segment-costs=[50312]
 |  06:SCAN HDFS [tpcds_parquet.promotion, RANDOM]
 |     HDFS partitions=1/1 files=1 size=23.30KB
 |     predicates: p_channel_tv = 'N'
@@ -8648,7 +8631,7 @@ max-parallelism=12 segment-costs=[10712984, 1] cpu-comparison-result=20 [max(12
 |     parquet statistics predicates: p_channel_tv = 'N'
 |     parquet dictionary predicates: p_channel_tv = 'N'
 |     mem-estimate=16.00MB mem-reservation=32.00KB thread-reservation=0
-|     tuple-ids=5 row-size=17B cardinality=294 cost=305
+|     tuple-ids=5 row-size=17B cardinality=294 cost=50305
 |     in pipelines: 06(GETNEXT)
 |
 08:HASH JOIN [INNER JOIN, BROADCAST]
@@ -8675,7 +8658,7 @@ max-parallelism=12 segment-costs=[10712984, 1] cpu-comparison-result=20 [max(12
 |  |
 |  F02:PLAN FRAGMENT [RANDOM] hosts=1 instances=1
 |  Per-Instance Resources: mem-estimate=16.06MB mem-reservation=256.00KB thread-reservation=1
-|  max-parallelism=1 segment-costs=[18240]
+|  max-parallelism=1 segment-costs=[68240]
 |  05:SCAN HDFS [tpcds_parquet.item, RANDOM]
 |     HDFS partitions=1/1 files=1 size=1.73MB
 |     predicates: i_current_price > CAST(50 AS DECIMAL(3,0))
@@ -8686,7 +8669,7 @@ max-parallelism=12 segment-costs=[10712984, 1] cpu-comparison-result=20 [max(12
 |     parquet statistics predicates: i_current_price > CAST(50 AS DECIMAL(3,0))
 |     parquet dictionary predicates: i_current_price > CAST(50 AS DECIMAL(3,0))
 |     mem-estimate=16.00MB mem-reservation=256.00KB thread-reservation=0
-|     tuple-ids=4 row-size=12B cardinality=1.80K cost=18211
+|     tuple-ids=4 row-size=12B cardinality=1.80K cost=68211
 |     in pipelines: 05(GETNEXT)
 |
 07:HASH JOIN [LEFT OUTER JOIN, BROADCAST]
@@ -8712,8 +8695,8 @@ max-parallelism=12 segment-costs=[10712984, 1] cpu-comparison-result=20 [max(12
 |  |
 |  F01:PLAN FRAGMENT [RANDOM] hosts=1 instances=1
 |  Per-Host Shared Resources: mem-estimate=1.00MB mem-reservation=1.00MB thread-reservation=0 runtime-filters-memory=1.00MB
-|  Per-Instance Resources: mem-estimate=24.11MB mem-reservation=8.00MB thread-reservation=1
-|  max-parallelism=1 segment-costs=[14601]
+|  Per-Instance Resources: mem-estimate=16.11MB mem-reservation=8.00MB thread-reservation=1
+|  max-parallelism=1 segment-costs=[64601]
 |  02:SCAN HDFS [tpcds_parquet.store_returns, RANDOM]
 |     HDFS partitions=1/1 files=1 size=15.43MB
 |     runtime filters: RF007[min_max] -> tpcds_parquet.store_returns.sr_item_sk, RF006[bloom] -> tpcds_parquet.store_returns.sr_item_sk
@@ -8721,8 +8704,8 @@ max-parallelism=12 segment-costs=[10712984, 1] cpu-comparison-result=20 [max(12
 |       table: rows=287.51K size=15.43MB
 |       columns: all
 |     extrapolated-rows=disabled max-scan-range-rows=287.51K
-|     mem-estimate=24.00MB mem-reservation=8.00MB thread-reservation=0
-|     tuple-ids=1 row-size=24B cardinality=287.51K cost=6739
+|     mem-estimate=16.00MB mem-reservation=8.00MB thread-reservation=0
+|     tuple-ids=1 row-size=24B cardinality=287.51K cost=56739
 |     in pipelines: 02(GETNEXT)
 |
 01:SCAN HDFS [tpcds_parquet.store_sales, RANDOM]
@@ -8734,6 +8717,6 @@ max-parallelism=12 segment-costs=[10712984, 1] cpu-comparison-result=20 [max(12
      columns: all
    extrapolated-rows=disabled max-scan-range-rows=130.09K
    mem-estimate=16.00MB mem-reservation=4.00MB thread-reservation=0
-   tuple-ids=0 row-size=36B cardinality=2.88M cost=101265
+   tuple-ids=0 row-size=36B cardinality=2.88M cost=91301264
    in pipelines: 01(GETNEXT)
 ====
diff --git a/tests/custom_cluster/test_executor_groups.py b/tests/custom_cluster/test_executor_groups.py
index 22da7969f..978c8b624 100644
--- a/tests/custom_cluster/test_executor_groups.py
+++ b/tests/custom_cluster/test_executor_groups.py
@@ -22,11 +22,11 @@ from builtins import range
 from tests.common.custom_cluster_test_suite import CustomClusterTestSuite
 from tests.util.concurrent_workload import ConcurrentWorkload
 
-import copy
 import json
 import logging
 import os
 import pytest
+import re
 from time import sleep
 
 LOG = logging.getLogger("test_auto_scaling")
@@ -44,9 +44,6 @@ GROUPING_TEST_QUERY = ("select ss_item_sk from tpcds_parquet.store_sales"
 # A query to test behavior of child queries.
 COMPUTE_STATS_QUERY = "COMPUTE STATS tpcds_parquet.store_sales"
 
-# Default query option to use for testing CPU requirement.
-CPU_DOP_OPTIONS = {'MT_DOP': '2', 'COMPUTE_PROCESSING_COST': 'true'}
-
 DEFAULT_RESOURCE_POOL = "default-pool"
 
 
@@ -837,12 +834,13 @@ class TestExecutorGroups(CustomClusterTestSuite):
     # max-query-cpu-core-per-node-limit and max-query-cpu-core-coordinator-limit
     # properties of the three sets:
     # tiny: [0, 64MB, 4, 4]
-    # small: [0, 70MB, 8, 8]
+    # small: [0, 90MB, 8, 8]
     # large: [64MB+1Byte, 8PB, 64, 64]
     llama_site_path = os.path.join(RESOURCES_DIR, "llama-site-3-groups.xml")
 
     # extra args template to start coordinator
     extra_args_template = ("-vmodule admission-controller=3 "
+        "-admission_control_slots=8 "
         "-expected_executor_group_sets=root.tiny:1,root.small:2,root.large:3 "
         "-fair_scheduler_allocation_path %s "
         "-llama_site_path %s "
@@ -856,14 +854,14 @@ class TestExecutorGroups(CustomClusterTestSuite):
 
     # Create fresh client
     self.create_impala_clients()
-    # Add an exec group with a 2 admission slot and 1 executors.
-    self._add_executor_group("group", 1, admission_control_slots=2,
+    # Add an exec group with 8 admission slots and 1 executors.
+    self._add_executor_group("group", 1, admission_control_slots=8,
                              resource_pool="root.tiny", extra_args="-mem_limit=2g")
-    # Add an exec group with a 2 admission slot and 2 executors.
-    self._add_executor_group("group", 2, admission_control_slots=2,
+    # Add an exec group with 8 admission slots and 2 executors.
+    self._add_executor_group("group", 2, admission_control_slots=8,
                              resource_pool="root.small", extra_args="-mem_limit=2g")
-    # Add another exec group with 2 admission slot and 3 executors.
-    self._add_executor_group("group", 3, admission_control_slots=2,
+    # Add another exec group with 8 admission slots and 3 executors.
+    self._add_executor_group("group", 3, admission_control_slots=8,
                              resource_pool="root.large", extra_args="-mem_limit=2g")
     assert self._get_num_executor_groups(only_healthy=True) == 3
     assert self._get_num_executor_groups(only_healthy=True,
@@ -873,14 +871,16 @@ class TestExecutorGroups(CustomClusterTestSuite):
     assert self._get_num_executor_groups(only_healthy=True,
                                          exec_group_set_prefix="root.large") == 1
 
-  def _run_query_and_verify_profile(self, query, query_options,
-      expected_strings_in_profile, not_expected_in_profile=[]):
-    """Run 'query' with given 'query_options'. Assert existence of
-    'expected_strings_in_profile' and nonexistence of 'not_expected_in_profile'
-    in query profile.
-    Caller is reponsible to close self.client at the end of test."""
+  def _set_query_options(self, query_options):
+    """Set query options"""
     for k, v in query_options.items():
       self.execute_query_expect_success(self.client, "SET {}='{}';".format(k, v))
+
+  def _run_query_and_verify_profile(self, query,
+      expected_strings_in_profile, not_expected_in_profile=[]):
+    """Run 'query' and assert existence of 'expected_strings_in_profile' and
+    nonexistence of 'not_expected_in_profile' in query profile.
+    Caller is reponsible to close self.client at the end of test."""
     result = self.execute_query_expect_success(self.client, query)
     for expected_profile in expected_strings_in_profile:
       assert expected_profile in str(result.runtime_profile)
@@ -892,131 +892,200 @@ class TestExecutorGroups(CustomClusterTestSuite):
     # Expect to run the query on the small group by default.
     coordinator_test_args = ""
     self._setup_three_exec_group_cluster(coordinator_test_args)
-    self._run_query_and_verify_profile(CPU_TEST_QUERY, CPU_DOP_OPTIONS,
-        ["Executor Group: root.small-group", "EffectiveParallelism: 5",
+    self._set_query_options({'COMPUTE_PROCESSING_COST': 'true'})
+    self._run_query_and_verify_profile(CPU_TEST_QUERY,
+        ["Executor Group: root.small-group", "EffectiveParallelism: 11",
          "ExecutorGroupsConsidered: 2"])
 
-    # Test disabling COMPUTE_PROCESING_COST and not setting REQUEST_POOL
-    options = copy.deepcopy(CPU_DOP_OPTIONS)
-    options['COMPUTE_PROCESSING_COST'] = 'false'
-    self._run_query_and_verify_profile(CPU_TEST_QUERY, options,
+    # Test disabling COMPUTE_PROCESING_COST. This will produce non-MT plan.
+    self._set_query_options({'COMPUTE_PROCESSING_COST': 'false'})
+    self._run_query_and_verify_profile(CPU_TEST_QUERY,
+        ["Executor Group: root.large-group", "ExecutorGroupsConsidered: 3",
+         "Verdict: Match"],
+        ["EffectiveParallelism:", "CpuAsk:"])
+
+    # Test COMPUTE_PROCESING_COST=false and MT_DOP=2.
+    self._set_query_options({'MT_DOP': '2'})
+    self._run_query_and_verify_profile(CPU_TEST_QUERY,
         ["Executor Group: root.tiny-group", "ExecutorGroupsConsidered: 1",
          "Verdict: Match"],
         ["EffectiveParallelism:", "CpuAsk:"])
 
+    # Test COMPUTE_PROCESING_COST=true and MT_DOP=2.
+    # COMPUTE_PROCESING_COST should override MT_DOP.
+    self._set_query_options({'COMPUTE_PROCESSING_COST': 'true'})
+    self._run_query_and_verify_profile(CPU_TEST_QUERY,
+        ["Executor Group: root.small-group", "EffectiveParallelism: 11",
+         "ExecutorGroupsConsidered: 2"])
+
     # Test that REQUEST_POOL will override executor group selection
-    options['COMPUTE_PROCESSING_COST'] = 'true'
-    options['REQUEST_POOL'] = 'root.large'
-    self._run_query_and_verify_profile(CPU_TEST_QUERY, options,
+    self._set_query_options({
+      'MT_DOP': '0',
+      'REQUEST_POOL': 'root.large'})
+    self._run_query_and_verify_profile(CPU_TEST_QUERY,
         ["Executor Group: root.large-group",
          ("Verdict: query option REQUEST_POOL=root.large is set. "
           "Memory and cpu limit checking is skipped."),
-         "EffectiveParallelism: 7", "ExecutorGroupsConsidered: 1"])
+         "EffectiveParallelism: 13", "ExecutorGroupsConsidered: 1"])
 
     # Test that child queries follow REQUEST_POOL that was set by client.
     # Two child queries should all run in root.large.
-    self._verify_total_admitted_queries("root.large", 1)
-    self._run_query_and_verify_profile(COMPUTE_STATS_QUERY, options,
+    self._verify_total_admitted_queries("root.large", 2)
+    self._run_query_and_verify_profile(COMPUTE_STATS_QUERY,
         ["ExecutorGroupsConsidered: 1",
          "Verdict: Assign to first group because query is not auto-scalable"],
         ["Executor Group:"])
-    self._verify_total_admitted_queries("root.large", 3)
+    self._verify_total_admitted_queries("root.large", 4)
 
     # Test setting REQUEST_POOL and disabling COMPUTE_PROCESSING_COST
-    options['COMPUTE_PROCESSING_COST'] = 'false'
-    options['REQUEST_POOL'] = 'root.large'
-    self._run_query_and_verify_profile(CPU_TEST_QUERY, options,
+    self._set_query_options({
+      'COMPUTE_PROCESSING_COST': 'false',
+      'REQUEST_POOL': 'root.large'})
+    self._run_query_and_verify_profile(CPU_TEST_QUERY,
         ["Executor Group: root.large-group",
          ("Verdict: query option REQUEST_POOL=root.large is set. "
           "Memory and cpu limit checking is skipped."),
          "ExecutorGroupsConsidered: 1"],
         ["EffectiveParallelism:", "CpuAsk:"])
 
-    # Unset REQUEST_POOL.
-    self.execute_query_expect_success(self.client, "SET REQUEST_POOL='';")
+    # Unset REQUEST_POOL and restore COMPUTE_PROCESSING_COST.
+    self._set_query_options({
+      'REQUEST_POOL': '',
+      'COMPUTE_PROCESSING_COST': 'true'})
 
     # Test that child queries unset REQUEST_POOL that was set by Frontend planner for
     # parent query. One child queries should run in root.small, and another one in
     # root.large.
-    self._verify_total_admitted_queries("root.small", 1)
-    self._verify_total_admitted_queries("root.large", 4)
-    self._run_query_and_verify_profile(COMPUTE_STATS_QUERY, CPU_DOP_OPTIONS,
+    self._verify_total_admitted_queries("root.small", 2)
+    self._verify_total_admitted_queries("root.large", 5)
+    self._run_query_and_verify_profile(COMPUTE_STATS_QUERY,
         ["ExecutorGroupsConsidered: 1",
          "Verdict: Assign to first group because query is not auto-scalable"],
         ["Executor Group:"])
-    self._verify_total_admitted_queries("root.small", 2)
-    self._verify_total_admitted_queries("root.large", 5)
+    self._verify_total_admitted_queries("root.small", 3)
+    self._verify_total_admitted_queries("root.large", 6)
 
-    # Test that GROUPING_TEST_QUERY will get assigned to the small group.
-    self._run_query_and_verify_profile(GROUPING_TEST_QUERY, CPU_DOP_OPTIONS,
-        ["Executor Group: root.small-group", "ExecutorGroupsConsidered: 2",
-          "Verdict: Match", "CpuAsk: 4", "CpuAskUnbounded: 1"])
+    # Test that GROUPING_TEST_QUERY will get assigned to the large group.
+    self._run_query_and_verify_profile(GROUPING_TEST_QUERY,
+        ["Executor Group: root.large-group", "ExecutorGroupsConsidered: 3",
+          "Verdict: Match", "CpuAsk: 12"])
 
-    # ENABLE_REPLAN=false should force query to run in tiny group.
-    self.execute_query_expect_success(self.client, "SET ENABLE_REPLAN=false;")
-    self._run_query_and_verify_profile(CPU_TEST_QUERY, CPU_DOP_OPTIONS,
+    # ENABLE_REPLAN=false should force query to run in tiny group, but high scan
+    # parallelism will cause it to exceed the admission control slots.
+    self._set_query_options({'ENABLE_REPLAN': 'false'})
+    result = self.execute_query_expect_failure(self.client, CPU_TEST_QUERY)
+    status = ("Rejected query from pool root.tiny: number of admission control slots "
+        r"needed \(10\) on backend '.*' is greater than total slots available 8. "
+        "Reduce mt_dop to less than 8 to ensure that the query can execute.")
+    assert re.search(status, str(result))
+
+    # ENABLE_REPLAN=false and MAX_FRAGMENT_INSTANCES_PER_NODE=4 should allow query to run
+    # in tiny group.
+    self._set_query_options({'MAX_FRAGMENT_INSTANCES_PER_NODE': '4'})
+    self._run_query_and_verify_profile(CPU_TEST_QUERY,
         ["Executor Group: root.tiny-group", "ExecutorGroupsConsidered: 1",
          "Verdict: Assign to first group because query option ENABLE_REPLAN=false"])
-    self.execute_query_expect_success(self.client, "SET ENABLE_REPLAN='';")
+
+    # Unset both ENABLE_REPLAN and MAX_FRAGMENT_INSTANCES_PER_NODE
+    self._set_query_options({
+      'ENABLE_REPLAN': '',
+      'MAX_FRAGMENT_INSTANCES_PER_NODE': ''})
 
     # Trivial query should be assigned to tiny group by Frontend.
     # Backend may decide to run it in coordinator only.
-    self._run_query_and_verify_profile("SELECT 1", CPU_DOP_OPTIONS,
+    self._run_query_and_verify_profile("SELECT 1",
         ["Executor Group: empty group (using coordinator only)",
          "ExecutorGroupsConsidered: 1",
          "Verdict: Assign to first group because the number of nodes is 1"])
 
     # CREATE/DROP database should work and assigned to tiny group.
     self._run_query_and_verify_profile(
-        "CREATE DATABASE test_non_scalable_query;", CPU_DOP_OPTIONS,
+        "CREATE DATABASE test_non_scalable_query;",
         ["ExecutorGroupsConsidered: 1",
          "Verdict: Assign to first group because query is not auto-scalable"],
         ["Executor Group:"])
     self._run_query_and_verify_profile(
-        "DROP DATABASE test_non_scalable_query;", CPU_DOP_OPTIONS,
+        "DROP DATABASE test_non_scalable_query;",
         ["ExecutorGroupsConsidered: 1",
          "Verdict: Assign to first group because query is not auto-scalable"],
         ["Executor Group:"])
 
+    # Test combination of PROCESSING_COST_MIN_THREADS and MAX_FRAGMENT_INSTANCES_PER_NODE.
+    self._set_query_options({
+      'PROCESSING_COST_MIN_THREADS': '1',
+      'MAX_FRAGMENT_INSTANCES_PER_NODE': '3'})
+    self._run_query_and_verify_profile(GROUPING_TEST_QUERY,
+        ["Executor Group: root.large-group", "EffectiveParallelism: 9",
+         "ExecutorGroupsConsidered: 3"])
+    self._set_query_options({
+      'MAX_FRAGMENT_INSTANCES_PER_NODE': '4'})
+    self._run_query_and_verify_profile(GROUPING_TEST_QUERY,
+        ["Executor Group: root.large-group", "EffectiveParallelism: 12",
+         "ExecutorGroupsConsidered: 3"])
+    self._set_query_options({
+      'PROCESSING_COST_MIN_THREADS': '3',
+      'MAX_FRAGMENT_INSTANCES_PER_NODE': '1'})
+    self._run_query_and_verify_profile(GROUPING_TEST_QUERY,
+        ["Executor Group: root.large-group", "EffectiveParallelism: 9",
+         "ExecutorGroupsConsidered: 3"])
+    self._set_query_options({
+      'PROCESSING_COST_MIN_THREADS': '2',
+      'MAX_FRAGMENT_INSTANCES_PER_NODE': '2'})
+    self._run_query_and_verify_profile(GROUPING_TEST_QUERY,
+        ["Executor Group: root.small-group", "EffectiveParallelism: 2",
+         "ExecutorGroupsConsidered: 2"])
+    # Unset PROCESSING_COST_MIN_THREADS and MAX_FRAGMENT_INSTANCES_PER_NODE.
+    self._set_query_options({
+      'PROCESSING_COST_MIN_THREADS': '',
+      'MAX_FRAGMENT_INSTANCES_PER_NODE': ''})
+
     # Check resource pools on the Web queries site and admission site
-    self._verify_query_num_for_resource_pool("root.small", 3)
-    self._verify_query_num_for_resource_pool("root.tiny", 3)
-    self._verify_query_num_for_resource_pool("root.large", 5)
-    self._verify_total_admitted_queries("root.small", 3)
+    self._verify_query_num_for_resource_pool("root.small", 4)
+    self._verify_query_num_for_resource_pool("root.tiny", 4)
+    self._verify_query_num_for_resource_pool("root.large", 10)
+    self._verify_total_admitted_queries("root.small", 4)
     self._verify_total_admitted_queries("root.tiny", 3)
-    self._verify_total_admitted_queries("root.large", 5)
+    self._verify_total_admitted_queries("root.large", 10)
     self.client.close()
 
   @pytest.mark.execute_serially
   def test_query_cpu_count_divisor_two(self):
-    # Expect to run the query on the tiny group
+    # Expect to run the query on the small group (driven by MemoryAsk),
+    # But the CpuAsk is around half of EffectiveParallelism.
     coordinator_test_args = "-query_cpu_count_divisor=2 "
     self._setup_three_exec_group_cluster(coordinator_test_args)
-    self._run_query_and_verify_profile(CPU_TEST_QUERY, CPU_DOP_OPTIONS,
-        ["Executor Group: root.tiny-group", "EffectiveParallelism: 3",
-         "ExecutorGroupsConsidered: 1"])
+    self._set_query_options({'COMPUTE_PROCESSING_COST': 'true'})
+    self._run_query_and_verify_profile(CPU_TEST_QUERY,
+        ["Executor Group: root.small-group",
+         "CpuAsk: 6", "EffectiveParallelism: 11",
+         "ExecutorGroupsConsidered: 2"])
     # Check resource pools on the Web queries site and admission site
-    self._verify_query_num_for_resource_pool("root.tiny", 1)
-    self._verify_total_admitted_queries("root.tiny", 1)
+    self._verify_query_num_for_resource_pool("root.small", 1)
+    self._verify_total_admitted_queries("root.small", 1)
     self.client.close()
 
   @pytest.mark.execute_serially
   def test_query_cpu_count_divisor_fraction(self):
     # Expect to run the query on the large group
-    coordinator_test_args = "-query_cpu_count_divisor=0.03 "
+    coordinator_test_args = ("-min_processing_per_thread=550000 "
+        "-query_cpu_count_divisor=0.03 ")
     self._setup_three_exec_group_cluster(coordinator_test_args)
-    options = copy.deepcopy(CPU_DOP_OPTIONS)
-    options['MT_DOP'] = '1'
-    self._run_query_and_verify_profile(CPU_TEST_QUERY, options,
+    self._set_query_options({
+      'COMPUTE_PROCESSING_COST': 'true',
+      'MAX_FRAGMENT_INSTANCES_PER_NODE': '1'})
+    self._run_query_and_verify_profile(CPU_TEST_QUERY,
         ["Executor Group: root.large-group", "EffectiveParallelism: 4",
          "ExecutorGroupsConsidered: 3", "CpuAsk: 134",
          "Verdict: Match"])
 
+    # Unset MAX_FRAGMENT_INSTANCES_PER_NODE.
+    self._set_query_options({'MAX_FRAGMENT_INSTANCES_PER_NODE': ''})
+
     # Expect that a query still admitted to last group even if
     # its resource requirement exceed the limit on that last executor group.
-    self._run_query_and_verify_profile(CPU_TEST_QUERY, CPU_DOP_OPTIONS,
-        ["Executor Group: root.large-group", "EffectiveParallelism: 7",
-         "ExecutorGroupsConsidered: 3", "CpuAsk: 234",
+    self._run_query_and_verify_profile(CPU_TEST_QUERY,
+        ["Executor Group: root.large-group", "EffectiveParallelism: 16",
+         "ExecutorGroupsConsidered: 3", "CpuAsk: 534",
          "Verdict: no executor group set fit. Admit to last executor group set."])
     # Check resource pools on the Web queries site and admission site
     self._verify_query_num_for_resource_pool("root.large", 2)
@@ -1030,10 +1099,10 @@ class TestExecutorGroups(CustomClusterTestSuite):
     coordinator_test_args = ("-query_cpu_count_divisor=0.03 "
         "-skip_resource_checking_on_last_executor_group_set=false ")
     self._setup_three_exec_group_cluster(coordinator_test_args)
-    self.client.set_configuration(CPU_DOP_OPTIONS)
+    self._set_query_options({'COMPUTE_PROCESSING_COST': 'true'})
     result = self.execute_query_expect_failure(self.client, CPU_TEST_QUERY)
     assert ("AnalysisException: The query does not fit largest executor group sets. "
-        "Reason: not enough cpu cores (require=234, max=192).") in str(result)
+        "Reason: not enough cpu cores (require=434, max=192).") in str(result)
     self.client.close()
 
   @pytest.mark.execute_serially
@@ -1043,26 +1112,24 @@ class TestExecutorGroups(CustomClusterTestSuite):
     self._setup_three_exec_group_cluster(coordinator_test_args)
 
     # Test that GROUPING_TEST_QUERY will get assigned to the large group.
-    self._run_query_and_verify_profile(GROUPING_TEST_QUERY, CPU_DOP_OPTIONS,
+    self._set_query_options({'COMPUTE_PROCESSING_COST': 'true'})
+    self._run_query_and_verify_profile(GROUPING_TEST_QUERY,
         ["Executor Group: root.large-group", "ExecutorGroupsConsidered: 3",
-          "Verdict: Match", "CpuAsk: 6"],
-        ["CpuAskUnbounded:"])
+          "Verdict: Match", "CpuAsk: 12"])
 
     # Test that high_scan_cost_query will get assigned to the large group.
     high_scan_cost_query = ("SELECT ss_item_sk FROM tpcds_parquet.store_sales "
         "WHERE ss_item_sk < 1000000 GROUP BY ss_item_sk LIMIT 10")
-    options = copy.deepcopy(CPU_DOP_OPTIONS)
-    self._run_query_and_verify_profile(high_scan_cost_query, options,
+    self._run_query_and_verify_profile(high_scan_cost_query,
         ["Executor Group: root.large-group", "ExecutorGroupsConsidered: 3",
-          "Verdict: Match", "CpuAsk: 6"],
-        ["CpuAskUnbounded:"])
+          "Verdict: Match", "CpuAsk: 15"])
 
     # Test that high_scan_cost_query will get assigned to the small group
-    # if NUM_SCANNER_THREADS is limited to 1.
-    options['NUM_SCANNER_THREADS'] = '1'
-    self._run_query_and_verify_profile(high_scan_cost_query, options,
-        ["Executor Group: root.small-group", "ExecutorGroupsConsidered: 2",
-          "Verdict: Match", "CpuAsk: 4", "CpuAskUnbounded: 4"])
+    # if MAX_FRAGMENT_INSTANCES_PER_NODE is limited to 1.
+    self._set_query_options({'MAX_FRAGMENT_INSTANCES_PER_NODE': '1'})
+    self._run_query_and_verify_profile(high_scan_cost_query,
+        ["Executor Group: root.tiny-group", "ExecutorGroupsConsidered: 1",
+          "Verdict: Match", "CpuAsk: 1"])
 
     self.client.close()
 
diff --git a/tests/query_test/test_insert.py b/tests/query_test/test_insert.py
index 05e3aa998..587ceff08 100644
--- a/tests/query_test/test_insert.py
+++ b/tests/query_test/test_insert.py
@@ -413,10 +413,37 @@ class TestInsertHdfsWriterLimit(ImpalaTestSuite):
     self.__run_insert_and_verify_instances(query, max_fs_writers=30, mt_dop=10,
                                            expected_num_instances_per_host=[8, 8, 8])
 
+  @UniqueDatabase.parametrize(sync_ddl=True)
+  @SkipIfNotHdfsMinicluster.tuned_for_minicluster
+  def test_processing_cost_writer_limit(self, unique_database):
+    # Root internal (non-leaf) fragment.
+    query = "create table {0}.test1 as select int_col from " \
+            "functional_parquet.alltypes".format(unique_database)
+    self.__run_insert_and_verify_instances(query, max_fs_writers=11, mt_dop=0,
+                                           expected_num_instances_per_host=[4, 5, 5],
+                                           processing_cost_min_threads=10)
+    # Root coordinator fragment.
+    query = "create table {0}.test2 as select int_col from " \
+            "functional_parquet.alltypes limit 100000".format(unique_database)
+    self.__run_insert_and_verify_instances(query, max_fs_writers=2, mt_dop=0,
+                                           expected_num_instances_per_host=[1, 1, 2],
+                                           processing_cost_min_threads=10)
+    # Root scan fragment. Instance count within limit.
+    query = "create table {0}.test3 as select int_col from " \
+            "functional_parquet.alltypes".format(unique_database)
+    self.__run_insert_and_verify_instances(query, max_fs_writers=30, mt_dop=0,
+                                           expected_num_instances_per_host=[8, 8, 8],
+                                           processing_cost_min_threads=10)
+
   def __run_insert_and_verify_instances(self, query, max_fs_writers, mt_dop,
-                                        expected_num_instances_per_host):
+                                        expected_num_instances_per_host,
+                                        processing_cost_min_threads=0):
     self.client.set_configuration_option("max_fs_writers", max_fs_writers)
     self.client.set_configuration_option("mt_dop", mt_dop)
+    if processing_cost_min_threads > 0:
+      self.client.set_configuration_option("compute_processing_cost", "true")
+      self.client.set_configuration_option("processing_cost_min_threads",
+          processing_cost_min_threads)
     # Test depends on both planner and scheduler to see the same state of the cluster
     # having 3 executors, so to reduce flakiness we make sure all 3 executors are up
     # and running.
diff --git a/tests/query_test/test_tpcds_queries.py b/tests/query_test/test_tpcds_queries.py
index bd497c9bd..8d07d4241 100644
--- a/tests/query_test/test_tpcds_queries.py
+++ b/tests/query_test/test_tpcds_queries.py
@@ -751,10 +751,5 @@ class TestTpcdsQueryWithProcessingCost(TestTpcdsQuery):
   @classmethod
   def add_test_dimensions(cls):
     super(TestTpcdsQueryWithProcessingCost, cls).add_test_dimensions()
-    cls.ImpalaTestMatrix.add_mandatory_exec_option('mt_dop', 4)
     cls.ImpalaTestMatrix.add_mandatory_exec_option('compute_processing_cost', 1)
-
-  def test_tpcds_q51a(self, vector):
-    pytest.xfail("IMPALA-11604: Q51a scale to 650 cores and 24.78 GB per-host min "
-        "reservation. Need to revisit ProcessingCost.")
-    self.run_test_case(self.get_workload() + '-q51a', vector)
+    cls.ImpalaTestMatrix.add_mandatory_exec_option('max_fragment_instances_per_node', 4)