[FEAT MERGE] support auto dop

This commit is contained in:
obdev
2023-04-28 15:11:52 +00:00
committed by ob-robot
parent 642f1c7d84
commit b41dc0ebdd
106 changed files with 3815 additions and 2844 deletions

View File

@ -18,6 +18,7 @@
#include "sql/optimizer/ob_log_plan.h"
#include "sql/engine/expr/ob_expr_column_conv.h"
#include "sql/optimizer/ob_del_upd_log_plan.h"
#include "sql/optimizer/ob_join_order.h"
using namespace oceanbase::common;
@ -188,6 +189,24 @@ int ObLogExprValues::compute_op_ordering()
}
int ObLogExprValues::est_cost()
{
int ret = OB_SUCCESS;
double card = 0.0;
double op_cost = 0.0;
double cost = 0.0;
EstimateCostInfo param;
param.need_parallel_ = get_parallel();
if (OB_FAIL(do_re_est_cost(param, card, op_cost, cost))) {
LOG_WARN("failed to get re est cost infos", K(ret));
} else {
set_card(card);
set_op_cost(op_cost);
set_cost(cost);
}
return ret;
}
int ObLogExprValues::do_re_est_cost(EstimateCostInfo &param, double &card, double &op_cost, double &cost)
{
int ret = OB_SUCCESS;
if (OB_ISNULL(get_plan()) ||
@ -197,14 +216,14 @@ int ObLogExprValues::est_cost()
} else if (get_stmt()->is_insert_stmt()) {
ObOptimizerContext &opt_ctx = get_plan()->get_optimizer_context();
const ObInsertStmt *insert_stmt = static_cast<const ObInsertStmt*>(get_stmt());
set_card(insert_stmt->get_insert_row_count());
set_op_cost(ObOptEstCost::cost_get_rows(get_card(), opt_ctx.get_cost_model_type()));
set_cost(get_op_cost());
card = insert_stmt->get_insert_row_count();
op_cost = ObOptEstCost::cost_get_rows(get_card(), opt_ctx.get_cost_model_type());
cost = op_cost;
} else {
ObOptimizerContext &opt_ctx = get_plan()->get_optimizer_context();
set_card(1.0);
set_op_cost(ObOptEstCost::cost_filter_rows(get_card(), filter_exprs_, opt_ctx.get_cost_model_type()));
set_cost(get_op_cost());
card = 1.0;
op_cost = ObOptEstCost::cost_filter_rows(get_card(), filter_exprs_, opt_ctx.get_cost_model_type());
cost = op_cost;
}
return ret;
}
@ -481,6 +500,17 @@ int ObLogExprValues::inner_replace_op_exprs(
return ret;
}
int ObLogExprValues::compute_op_parallel_and_server_info()
{
int ret = common::OB_SUCCESS;
if (get_num_of_child() == 0) {
ret = set_parallel_and_server_info_for_match_all();
} else {
ret = ObLogicalOperator::compute_op_parallel_and_server_info();
}
return ret;
}
int ObLogExprValues::is_my_fixed_expr(const ObRawExpr *expr, bool &is_fixed)
{
is_fixed = ObOptimizerUtil::find_item(value_desc_, expr);