diff --git a/src/sql/optimizer/ob_join_order.cpp b/src/sql/optimizer/ob_join_order.cpp index 7e9929a80a..3d0791eab6 100644 --- a/src/sql/optimizer/ob_join_order.cpp +++ b/src/sql/optimizer/ob_join_order.cpp @@ -1661,6 +1661,7 @@ int ObJoinOrder::create_one_access_path(const uint64_t table_id, ap->for_update_ = table_item->for_update_; ap->use_skip_scan_ = use_skip_scan; ap->use_column_store_ = use_column_store; + ap->est_cost_info_.use_column_store_ = use_column_store; ap->contain_das_op_ = ap->use_das_; if (OB_FAIL(init_sample_info_for_access_path(ap, table_id))) { LOG_WARN("failed to init sample info", K(ret)); @@ -1719,8 +1720,7 @@ int ObJoinOrder::create_one_access_path(const uint64_t table_id, LOG_WARN("failed to assign expr constraints", K(ret)); } else if (OB_FAIL(append(ap->expr_constraints_, helper.expr_constraints_))) { LOG_WARN("append expr constraints failed", K(ret)); - } else if (use_column_store && - OB_FAIL(init_column_store_est_info(table_id, ap->est_cost_info_))) { + } else if (OB_FAIL(init_column_store_est_info(table_id, ref_id, ap->est_cost_info_))) { LOG_WARN("failed to init column store est cost info", K(ret)); } else { access_path = ap; @@ -1802,21 +1802,103 @@ int ObJoinOrder::init_filter_selectivity(ObCostTableScanInfo &est_cost_info) return ret; } -int ObJoinOrder::init_column_store_est_info(const uint64_t table_id, ObCostTableScanInfo &est_cost_info) +int ObJoinOrder::init_column_store_est_info(const uint64_t table_id, + const uint64_t ref_id, + ObCostTableScanInfo &est_cost_info) { int ret = OB_SUCCESS; + bool index_back_will_use_row_store = false; + bool index_back_will_use_column_store = false; + if (OB_ISNULL(get_plan())) { + ret = OB_ERR_UNEXPECTED; + LOG_WARN("unexpect null plan", K(ret)); + } else if (OB_FAIL(get_plan()->will_use_column_store(OB_INVALID_ID, + ref_id, + index_back_will_use_column_store, + index_back_will_use_row_store))) { + LOG_WARN("failed to check will use column store", K(ret)); + } else if (est_cost_info.use_column_store_ || !index_back_will_use_row_store) { + FilterCompare filter_compare(get_plan()->get_predicate_selectivities()); + std::sort(est_cost_info.table_filters_.begin(), est_cost_info.table_filters_.end(), filter_compare); + ObSqlBitSet<> used_column_ids; + est_cost_info.use_column_store_ = true; + est_cost_info.index_back_with_column_store_ = !index_back_will_use_row_store; + const OptTableMetas& table_opt_meta = get_plan()->get_basic_table_metas(); + ObIArray &index_scan_column_group_infos = est_cost_info.index_scan_column_group_infos_; + ObIArray &index_back_column_group_infos = est_cost_info.index_meta_info_.is_index_back_ ? + est_cost_info.index_back_column_group_infos_ + : est_cost_info.index_scan_column_group_infos_; + //add column group with prefix filters + if (OB_FAIL(init_column_store_est_info_with_filter(table_id, + est_cost_info, + table_opt_meta, + est_cost_info.prefix_filters_, + index_scan_column_group_infos, + used_column_ids, + filter_compare, + false))) { + LOG_WARN("failed to init column store est info with filter", K(ret)); + } + else if (OB_FAIL(init_column_store_est_info_with_filter(table_id, + est_cost_info, + table_opt_meta, + est_cost_info.pushdown_prefix_filters_, + index_scan_column_group_infos, + used_column_ids, + filter_compare, + false))) { + LOG_WARN("failed to init column store est info with filter", K(ret)); + } + //add column group with postfix filters + else if (OB_FAIL(init_column_store_est_info_with_filter(table_id, + est_cost_info, + table_opt_meta, + est_cost_info.postfix_filters_, + index_scan_column_group_infos, + used_column_ids, + filter_compare, + true))) { + LOG_WARN("failed to init column store est info with filter", K(ret)); + } + //add column group with index back filters + else if (OB_FAIL(init_column_store_est_info_with_filter(table_id, + est_cost_info, + table_opt_meta, + est_cost_info.table_filters_, + index_back_column_group_infos, + used_column_ids, + filter_compare, + true))) { + LOG_WARN("failed to init column store est info with filter", K(ret)); + } + //add other column group + else if (OB_FAIL(init_column_store_est_info_with_other_column(table_id, + est_cost_info, + table_opt_meta, + used_column_ids))) { + LOG_WARN("failed to init column store est info with other column", K(ret)); + } + } + return ret; +} + +int ObJoinOrder::init_column_store_est_info_with_filter(const uint64_t table_id, + ObCostTableScanInfo &est_cost_info, + const OptTableMetas& table_opt_meta, + ObIArray &filters, + ObIArray &column_group_infos, + ObSqlBitSet<> &used_column_ids, + FilterCompare &filter_compare, + const bool use_filter_sel) +{ + int ret = OB_SUCCESS; + ObSEArray filter_columns; if (OB_ISNULL(get_plan()) || OB_ISNULL(get_plan()->get_stmt())) { ret = OB_ERR_UNEXPECTED; LOG_WARN("unexpect null plan", K(ret)); - } else { - FilterCompare filter_compare(get_plan()->get_predicate_selectivities()); - std::sort(est_cost_info.table_filters_.begin(), est_cost_info.table_filters_.end(), filter_compare); - ObSEArray filter_columns; - ObSqlBitSet<> used_column_ids; - est_cost_info.use_column_store_ = true; - const OptTableMetas& table_opt_meta = get_plan()->get_basic_table_metas(); - for (int i = 0; OB_SUCC(ret) && i < est_cost_info.table_filters_.count(); ++i) { - ObRawExpr *filter = est_cost_info.table_filters_.at(i); + } + for (int i = 0; OB_SUCC(ret) && i < filters.count(); ++i) { + ObRawExpr *filter = filters.at(i); filter_columns.reuse(); if (OB_FAIL(ObRawExprUtils::extract_column_exprs(filter, filter_columns))) { @@ -1837,6 +1919,8 @@ int ObJoinOrder::init_column_store_est_info(const uint64_t table_id, ObCostTable col_expr->get_column_id()); if (used_column_ids.has_member(col_expr->get_column_id())) { //do nothing + } else if (OB_FAIL(used_column_ids.add_member(col_expr->get_column_id()))) { + LOG_WARN("failed to add memeber", K(ret)); } else if (OB_ISNULL(col_opt_meta) || OB_ISNULL(col_item)) { ret = OB_ERR_UNEXPECTED; LOG_WARN("unexpect null column meta", K(ret)); @@ -1847,39 +1931,58 @@ int ObJoinOrder::init_column_store_est_info(const uint64_t table_id, ObCostTable cg_info.skip_rate_ = col_opt_meta->get_cg_skip_rate(); if (OB_FAIL(cg_info.access_column_items_.push_back(*col_item))) { LOG_WARN("failed to push back filter", K(ret)); - } else if (OB_FAIL(est_cost_info.column_group_infos_.push_back(cg_info))) { + } else if (OB_FAIL(column_group_infos.push_back(cg_info))) { LOG_WARN("failed to push back column group info", K(ret)); } } } } //distribute filter - if (OB_SUCC(ret) && !filter_columns.empty()) { - ObRawExpr *expr = filter_columns.at(filter_columns.count()-1); + int max_pos = -1; + for (int j = 0; OB_SUCC(ret) && j < filter_columns.count(); ++j) { + ObRawExpr *expr = filter_columns.at(j); if (OB_ISNULL(expr)) { ret = OB_ERR_UNEXPECTED; LOG_WARN("unexpect null expr", K(ret)); } else if (expr->is_column_ref_expr()) { ObColumnRefRawExpr* col_expr = static_cast(expr); - bool find = false; - for (int j = 0; OB_SUCC(ret) && !find && j < est_cost_info.column_group_infos_.count(); ++j) { - ObCostColumnGroupInfo &cg_info = est_cost_info.column_group_infos_.at(j); + int find_pos = -1; + for (int k = 0; OB_SUCC(ret) && find_pos < 0 && k < column_group_infos.count(); ++k) { + ObCostColumnGroupInfo &cg_info = column_group_infos.at(k); if (cg_info.column_id_ == col_expr->get_column_id()) { - find = true; - if (OB_FAIL(cg_info.filters_.push_back(filter))) { - LOG_WARN("failed to push back filter", K(ret)); - } else { - cg_info.filter_sel_ *= filter_compare.get_selectivity(filter); - } + find_pos = k; } } - if (OB_SUCC(ret) && !find) { + if (OB_SUCC(ret) && find_pos < 0) { ret = OB_ERR_UNEXPECTED; LOG_WARN("can not find column group info for filter", K(ret)); + } else if (find_pos > max_pos) { + max_pos = find_pos; } } } + if (OB_FAIL(ret)) { + } else if (max_pos < 0 || max_pos >= column_group_infos.count()) { + ret = OB_ERR_UNEXPECTED; + LOG_WARN("can not find column group info for filter", K(ret)); + } else if (OB_FAIL(column_group_infos.at(max_pos).filters_.push_back(filter))) { + LOG_WARN("failed to push back filter", K(ret)); + } else if (use_filter_sel) { + column_group_infos.at(max_pos).filter_sel_ *= filter_compare.get_selectivity(filter); + } } + return ret; +} + +int ObJoinOrder::init_column_store_est_info_with_other_column(const uint64_t table_id, + ObCostTableScanInfo &est_cost_info, + const OptTableMetas& table_opt_meta, + ObSqlBitSet<> &used_column_ids) +{ + int ret = OB_SUCCESS; + ObIArray &column_group_infos = est_cost_info.index_meta_info_.is_index_back_ ? + est_cost_info.index_back_column_group_infos_ + : est_cost_info.index_scan_column_group_infos_; for (int i = 0; OB_SUCC(ret) && i < est_cost_info.access_column_items_.count(); ++i) { uint64_t column_id = est_cost_info.access_column_items_.at(i).column_id_; const OptColumnMeta* col_opt_meta = table_opt_meta.get_column_meta_by_table_id( @@ -1903,12 +2006,11 @@ int ObJoinOrder::init_column_store_est_info(const uint64_t table_id, ObCostTable cg_info.column_id_ = column_id; if (OB_FAIL(cg_info.access_column_items_.push_back(est_cost_info.access_column_items_.at(i)))) { LOG_WARN("failed to push back filter", K(ret)); - } else if (OB_FAIL(est_cost_info.column_group_infos_.push_back(cg_info))) { + } else if (OB_FAIL(column_group_infos.push_back(cg_info))) { LOG_WARN("failed to push back column group info", K(ret)); } } } - } return ret; } diff --git a/src/sql/optimizer/ob_join_order.h b/src/sql/optimizer/ob_join_order.h index e9faaff5dd..e7c4c32c20 100644 --- a/src/sql/optimizer/ob_join_order.h +++ b/src/sql/optimizer/ob_join_order.h @@ -1554,7 +1554,23 @@ struct NullAwareAntiJoinInfo { int init_filter_selectivity(ObCostTableScanInfo &est_cost_info); - int init_column_store_est_info(const uint64_t table_id, ObCostTableScanInfo &est_cost_info); + int init_column_store_est_info(const uint64_t table_id, + const uint64_t ref_id, + ObCostTableScanInfo &est_cost_info); + + int init_column_store_est_info_with_filter(const uint64_t table_id, + ObCostTableScanInfo &est_cost_info, + const OptTableMetas& table_opt_meta, + ObIArray &filters, + ObIArray &column_group_infos, + ObSqlBitSet<> &used_column_ids, + FilterCompare &filter_compare, + const bool use_filter_sel); + + int init_column_store_est_info_with_other_column(const uint64_t table_id, + ObCostTableScanInfo &est_cost_info, + const OptTableMetas& table_opt_meta, + ObSqlBitSet<> &used_column_ids); int will_use_das(const uint64_t table_id, const uint64_t ref_id, diff --git a/src/sql/optimizer/ob_opt_est_cost_model.cpp b/src/sql/optimizer/ob_opt_est_cost_model.cpp index 3f9d393170..13d164241f 100644 --- a/src/sql/optimizer/ob_opt_est_cost_model.cpp +++ b/src/sql/optimizer/ob_opt_est_cost_model.cpp @@ -73,7 +73,9 @@ int ObCostTableScanInfo::assign(const ObCostTableScanInfo &est_cost_info) LOG_WARN("failed to assign access columns", K(ret)); } else if (OB_FAIL(access_columns_.assign(est_cost_info.access_columns_))) { LOG_WARN("failed to assign access columns", K(ret)); - } else if (OB_FAIL(column_group_infos_.assign(est_cost_info.column_group_infos_))) { + } else if (OB_FAIL(index_scan_column_group_infos_.assign(est_cost_info.index_scan_column_group_infos_))) { + LOG_WARN("failed to to assign column group infos", K(ret)); + } else if (OB_FAIL(index_back_column_group_infos_.assign(est_cost_info.index_back_column_group_infos_))) { LOG_WARN("failed to to assign column group infos", K(ret)); } else { table_id_ = est_cost_info.table_id_; @@ -103,6 +105,7 @@ int ObCostTableScanInfo::assign(const ObCostTableScanInfo &est_cost_info) sample_info_ = est_cost_info.sample_info_; use_column_store_ = est_cost_info.use_column_store_; at_most_one_range_ = est_cost_info.at_most_one_range_; + index_back_with_column_store_ = est_cost_info.index_back_with_column_store_; // no need to copy table scan param } return ret; @@ -1368,18 +1371,24 @@ int ObOptEstCostModel::cost_basic_table(const ObCostTableScanInfo &est_cost_info int64_t part_count = table_meta_info->part_count_; part_count = part_count > 0 ? part_count : 1; double row_count_per_part = row_count / part_count; + double index_scan_cost = 0; + double index_back_cost = 0; + double prefix_filter_sel = est_cost_info.join_filter_sel_; // calc scan one partition cost - if (!est_cost_info.use_column_store_ && - OB_FAIL(cost_row_store_basic_table(est_cost_info, - row_count_per_part, - cost))) { - LOG_WARN("Failed to estimate cost", K(ret), K(est_cost_info)); - } else if (est_cost_info.use_column_store_ && - OB_FAIL(cost_column_store_basic_table(est_cost_info, - row_count_per_part, - cost))) { - LOG_WARN("Failed to estimate cost", K(ret), K(est_cost_info), K(row_count_per_part)); + if (OB_FAIL(cost_index_scan(est_cost_info, + row_count_per_part, + prefix_filter_sel, + index_scan_cost))) { + LOG_WARN("failed to calc index scan cost", K(ret)); + } else if (est_cost_info.index_meta_info_.is_index_back_ && + OB_FAIL(cost_index_back(est_cost_info, + row_count_per_part, + prefix_filter_sel, + index_back_cost))) { + LOG_WARN("failed to calc index back cost", K(ret)); } else { + cost += index_scan_cost; + cost += index_back_cost; // calc one parallel scan cost cost *= part_cnt_per_dop; LOG_TRACE("OPT:[ESTIMATE FINISH]", K(cost), K(part_cnt_per_dop), K(est_cost_info)); @@ -1388,76 +1397,153 @@ int ObOptEstCostModel::cost_basic_table(const ObCostTableScanInfo &est_cost_info return ret; } -int ObOptEstCostModel::cost_row_store_basic_table(const ObCostTableScanInfo &est_cost_info, - double row_count, - double &cost) +int ObOptEstCostModel::cost_index_scan(const ObCostTableScanInfo &est_cost_info, + double row_count, + double &prefix_filter_sel, + double &index_scan_cost) { int ret = OB_SUCCESS; - double index_back_cost = 0; - if (OB_FAIL(cost_index_scan(est_cost_info, - row_count, - cost))) { - LOG_WARN("failed to calc index scan cost", K(ret)); - } else if (!est_cost_info.index_meta_info_.is_index_back_) { - LOG_TRACE("OPT:[COST BASIC TABLE SCAN WITH ROW STORE]", K(row_count), K(cost)); - } else if (OB_FAIL(cost_index_back(est_cost_info, - row_count, - index_back_cost))) { - LOG_WARN("failed to calc index back cost", K(ret)); - } else { - cost += index_back_cost; - LOG_TRACE("OPT:[COST BASIC TABLE SCAN WITH ROW STORE]", K(row_count), K(index_back_cost), K(cost)); + if (est_cost_info.use_column_store_ && + OB_FAIL(cost_column_store_index_scan(est_cost_info, + row_count, + prefix_filter_sel, + index_scan_cost))) { + LOG_WARN("failed to calc column store index scan cost", K(ret)); + } else if (!est_cost_info.use_column_store_ && + OB_FAIL(cost_row_store_index_scan(est_cost_info, + row_count, + index_scan_cost))) { + LOG_WARN("failed to calc row store index scan cost", K(ret)); } return ret; } -int ObOptEstCostModel::cost_column_store_basic_table(const ObCostTableScanInfo &est_cost_info, - double row_count, - double &cost) +int ObOptEstCostModel::cost_index_back(const ObCostTableScanInfo &est_cost_info, + double row_count, + double &prefix_filter_sel, + double &index_back_cost) { int ret = OB_SUCCESS; - ObCostTableScanInfo column_group_est_cost_info(OB_INVALID_ID, OB_INVALID_ID, OB_INVALID_ID); - double prefix_filter_sel = est_cost_info.join_filter_sel_; - cost = 0.0; - if (OB_FAIL(column_group_est_cost_info.assign(est_cost_info))) { - LOG_WARN("failed to assign est cost info", K(ret)); - } else { - column_group_est_cost_info.access_column_items_.reuse(); - column_group_est_cost_info.prefix_filters_.reuse(); - column_group_est_cost_info.postfix_filters_.reuse(); - column_group_est_cost_info.use_column_store_ = true; - column_group_est_cost_info.join_filter_sel_ = 1.0; + if (est_cost_info.index_back_with_column_store_ && + OB_FAIL(cost_column_store_index_back(est_cost_info, + row_count, + prefix_filter_sel, + index_back_cost))) { + LOG_WARN("failed to calc column store index back cost", K(ret)); + } else if (!est_cost_info.index_back_with_column_store_ && + OB_FAIL(cost_row_store_index_back(est_cost_info, + row_count, + index_back_cost))) { + LOG_WARN("failed to calc row store index back cost", K(ret)); } - // calc scan cost for each column group - for (int64_t i = 0; OB_SUCC(ret) && i get_micro_block_numbers(); } @@ -1659,11 +1747,11 @@ int ObOptEstCostModel::range_get_io_cost(const ObCostTableScanInfo &est_cost_inf } } if (num_micro_blocks_read < 1) { - cost = 0; + io_cost = 0; } else { - cost = first_block_cost + cost_params_.get_micro_block_rnd_cost(sys_stat_) * (num_micro_blocks_read-1); + io_cost = first_block_cost + cost_params_.get_micro_block_rnd_cost(sys_stat_) * (num_micro_blocks_read-1); } - LOG_TRACE("OPT:[COST RANGE GET IO]", K(is_scan_index), K(row_count), K(cost), K(num_micro_blocks), + LOG_TRACE("OPT:[COST RANGE GET IO]", K(is_scan_index), K(row_count), K(io_cost), K(num_micro_blocks), K(num_micro_blocks_read), K(first_block_cost)); } return ret; @@ -1672,10 +1760,10 @@ int ObOptEstCostModel::range_get_io_cost(const ObCostTableScanInfo &est_cost_inf int ObOptEstCostModel::range_scan_io_cost(const ObCostTableScanInfo &est_cost_info, bool is_scan_index, double row_count, - double &cost) + double &io_cost) { int ret = OB_SUCCESS; - cost = 0.0; + io_cost = 0.0; const ObIndexMetaInfo &index_meta_info = est_cost_info.index_meta_info_; const ObTableMetaInfo *table_meta_info = est_cost_info.table_meta_info_; if (OB_ISNULL(table_meta_info) || row_count < 0) { @@ -1709,11 +1797,11 @@ int ObOptEstCostModel::range_scan_io_cost(const ObCostTableScanInfo &est_cost_in } } if (num_micro_blocks_read < 1) { - cost = first_block_cost; + io_cost = first_block_cost; } else { - cost = first_block_cost + cost_params_.get_micro_block_seq_cost(sys_stat_) * (num_micro_blocks_read-1); + io_cost = first_block_cost + cost_params_.get_micro_block_seq_cost(sys_stat_) * (num_micro_blocks_read-1); } - LOG_TRACE("OPT:[COST RANGE SCAN IO]", K(is_scan_index), K(row_count), K(cost), K(num_micro_blocks), + LOG_TRACE("OPT:[COST RANGE SCAN IO]", K(is_scan_index), K(row_count), K(io_cost), K(num_micro_blocks), K(num_micro_blocks_read), K(first_block_cost)); } return ret; @@ -1723,7 +1811,7 @@ int ObOptEstCostModel::range_scan_cpu_cost(const ObCostTableScanInfo &est_cost_i bool is_scan_index, double row_count, bool is_get, - double &cost) + double &cpu_cost) { int ret = OB_SUCCESS; double project_cost = 0.0; @@ -1779,11 +1867,10 @@ int ObOptEstCostModel::range_scan_cpu_cost(const ObCostTableScanInfo &est_cost_i range_count = 1; } range_cost = range_count * cost_params_.get_range_cost(sys_stat_); - cost = row_count * cost_params_.get_cpu_tuple_cost(sys_stat_); - cost += range_cost + qual_cost + project_cost; - + cpu_cost = row_count * cost_params_.get_cpu_tuple_cost(sys_stat_); + cpu_cost += range_cost + qual_cost + project_cost; LOG_TRACE("OPT: [RANGE SCAN CPU COST]", K(is_scan_index), K(is_get), - K(cost), K(qual_cost), K(project_cost), K(range_cost), K(row_count)); + K(cpu_cost), K(qual_cost), K(project_cost), K(range_cost), K(row_count)); } return ret; } diff --git a/src/sql/optimizer/ob_opt_est_cost_model.h b/src/sql/optimizer/ob_opt_est_cost_model.h index 61a7e507ca..33c4da8f54 100644 --- a/src/sql/optimizer/ob_opt_est_cost_model.h +++ b/src/sql/optimizer/ob_opt_est_cost_model.h @@ -230,7 +230,8 @@ struct ObCostTableScanInfo output_row_count_(0.0), batch_type_(common::ObSimpleBatch::ObBatchType::T_NONE), use_column_store_(false), - at_most_one_range_(false) + at_most_one_range_(false), + index_back_with_column_store_(false) { } virtual ~ObCostTableScanInfo() { } @@ -246,7 +247,9 @@ struct ObCostTableScanInfo K_(postfix_filter_sel), K_(table_filter_sel), K_(ss_prefix_ndv), K_(ss_postfix_range_filters_sel), K_(use_column_store), - K_(column_group_infos)); + K_(index_back_with_column_store), + K_(index_scan_column_group_infos), + K_(index_back_column_group_infos)); // the following information need to be set before estimating cost uint64_t table_id_; // table id uint64_t ref_table_id_; // ref table id @@ -290,8 +293,11 @@ struct ObCostTableScanInfo common::ObSimpleBatch::ObBatchType batch_type_; SampleInfo sample_info_; bool use_column_store_; - common::ObSEArray column_group_infos_; bool at_most_one_range_; + bool index_back_with_column_store_; + common::ObSEArray index_scan_column_group_infos_; + common::ObSEArray index_back_column_group_infos_; + private: DISALLOW_COPY_AND_ASSIGN(ObCostTableScanInfo); }; @@ -842,21 +848,32 @@ protected: const double part_cnt_per_dop, double &cost); - int cost_row_store_basic_table(const ObCostTableScanInfo &est_cost_info, - double row_count, - double &cost); - - int cost_column_store_basic_table(const ObCostTableScanInfo &est_cost_info, - double row_count, - double &cost); - int cost_index_scan(const ObCostTableScanInfo &est_cost_info, double row_count, + double &prefix_filter_sel, double &cost); int cost_index_back(const ObCostTableScanInfo &est_cost_info, double row_count, + double &prefix_filter_sel, double &cost); + + int cost_column_store_index_scan(const ObCostTableScanInfo &est_cost_info, + double row_count, + double &prefix_filter_sel, + double &cost); + + int cost_column_store_index_back(const ObCostTableScanInfo &est_cost_info, + double row_count, + double &prefix_filter_sel, + double &cost); + int cost_row_store_index_scan(const ObCostTableScanInfo &est_cost_info, + double row_count, + double &cost); + + int cost_row_store_index_back(const ObCostTableScanInfo &est_cost_info, + double row_count, + double &cost); // estimate the network transform and rpc cost for global index int cost_global_index_back_with_rp(double row_count, const ObCostTableScanInfo &est_cost_info, diff --git a/src/sql/optimizer/ob_select_log_plan.cpp b/src/sql/optimizer/ob_select_log_plan.cpp index f241018f1c..4bbe49e911 100644 --- a/src/sql/optimizer/ob_select_log_plan.cpp +++ b/src/sql/optimizer/ob_select_log_plan.cpp @@ -7697,11 +7697,11 @@ int ObSelectLogPlan::adjust_est_cost_info_for_column_store_plan(ObLogTableScan * } else if (OB_FAIL(table_scan->get_est_cost_info()->access_columns_.assign(used_column_ids))) { LOG_WARN("failed to assign column ids", K(ret)); } - for (int64_t i = table_scan->get_est_cost_info()->column_group_infos_.count()-1; OB_SUCC(ret) && i >= 0; --i) { - ObCostColumnGroupInfo &info = table_scan->get_est_cost_info()->column_group_infos_.at(i); + for (int64_t i = table_scan->get_est_cost_info()->index_scan_column_group_infos_.count()-1; OB_SUCC(ret) && i >= 0; --i) { + ObCostColumnGroupInfo &info = table_scan->get_est_cost_info()->index_scan_column_group_infos_.at(i); if (ObOptimizerUtil::find_item(used_column_ids, info.column_id_)) { //do nothing - } else if (OB_FAIL(table_scan->get_est_cost_info()->column_group_infos_.remove(i))) { + } else if (OB_FAIL(table_scan->get_est_cost_info()->index_scan_column_group_infos_.remove(i))) { LOG_WARN("failed to remove column group info", K(ret)); } }