update rewrite rules
* adjust re est cost for nestloop semi/anti join * add threshold for cost base transform
This commit is contained in:
@ -3515,12 +3515,10 @@ int JoinPath::re_est_cost(sql::Path* path, double need_row_count, double& cost)
|
||||
if (OB_ISNULL(path)) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("unexpect null path", K(ret));
|
||||
} else if (ACCESS == path->path_type_ &&
|
||||
OB_FAIL(re_est_access_cost(static_cast<AccessPath*>(path), need_row_count, cost))) {
|
||||
LOG_WARN("failed to est access cost", K(ret));
|
||||
} else if (SUBQUERY == path->path_type_ &&
|
||||
OB_FAIL(re_est_subquery_cost(static_cast<SubQueryPath*>(path), need_row_count, cost))) {
|
||||
LOG_WARN("failed to est subquery cost", K(ret));
|
||||
} else if (ACCESS == path->path_type_) {
|
||||
ret = re_est_access_cost(static_cast<AccessPath*>(path), need_row_count, cost);
|
||||
} else if (SUBQUERY == path->path_type_) {
|
||||
ret = re_est_subquery_cost(static_cast<SubQueryPath*>(path), need_row_count, cost);
|
||||
} else {
|
||||
cost = path->cost_;
|
||||
}
|
||||
@ -3570,11 +3568,6 @@ int JoinPath::re_est_access_cost(AccessPath* path, double need_row_count, double
|
||||
cost,
|
||||
index_back_cost))) {
|
||||
LOG_WARN("failed to estimate cost", K(ret));
|
||||
} else {
|
||||
path->cost_ = cost;
|
||||
path->op_cost_ = cost;
|
||||
path->inner_row_count_ = need_row_count;
|
||||
path->output_row_count_ = need_row_count;
|
||||
}
|
||||
} else {
|
||||
cost = path->cost_;
|
||||
|
||||
@ -167,7 +167,7 @@ int ObTransformRule::accept_transform(
|
||||
LOG_WARN("failed to evaluate cost for the origin stmt", K(ret));
|
||||
}
|
||||
if (OB_SUCC(ret)) {
|
||||
if (trans_stmt_cost < stmt_cost_) {
|
||||
if (trans_stmt_cost < stmt_cost_ * COST_BASE_TRANSFORM_THRESHOLD) {
|
||||
LOG_TRACE("accept transform because the cost is decreased", K_(stmt_cost), K(trans_stmt_cost));
|
||||
stmt = trans_stmt;
|
||||
stmt_cost_ = trans_stmt_cost;
|
||||
|
||||
@ -129,6 +129,7 @@ struct ObParentDMLStmt {
|
||||
|
||||
class ObTransformRule {
|
||||
public:
|
||||
static constexpr const double COST_BASE_TRANSFORM_THRESHOLD = 0.999;
|
||||
static const int64_t TRANSFORMER_DEFAULT_MAX_RECURSIVE_LEVEL = 150;
|
||||
static const uint64_t ALL_TRANSFORM_RULES = TRANSFORM_TYPE_COUNT_PLUS_ONE - 1;
|
||||
static const uint64_t ALL_HEURISTICS_RULES = SIMPLIFY | ANYALL | AGGR | ELIMINATE_OJ | VIEW_MERGE | WHERE_SQ_PULL_UP |
|
||||
|
||||
Reference in New Issue
Block a user