add system variable _enable_range_extraction_for_not_in to control query range extraction for not in
This commit is contained in:
parent
8bd8e8fad9
commit
a722d95b96
@ -1734,3 +1734,7 @@ DEF_STR_WITH_CHECKER(sql_protocol_min_tls_version, OB_CLUSTER_PARAMETER, "none",
|
||||
DEF_MODE_WITH_PARSER(_obkv_feature_mode, OB_CLUSTER_PARAMETER, "", common::ObKvFeatureModeParser,
|
||||
"_obkv_feature_mode is a option list to control specified OBKV features on/off.",
|
||||
ObParameterAttr(Section::OBSERVER, Source::DEFAULT, EditLevel::DYNAMIC_EFFECTIVE));
|
||||
|
||||
DEF_BOOL(_enable_range_extraction_for_not_in, OB_TENANT_PARAMETER, "True",
|
||||
"Enable extract query range for not in predicate",
|
||||
ObParameterAttr(Section::TENANT, Source::DEFAULT, EditLevel::DYNAMIC_EFFECTIVE));
|
||||
|
@ -3393,9 +3393,12 @@ int ObQueryRange::pre_extract_not_in_op(const ObOpRawExpr *b_expr,
|
||||
int ret = OB_SUCCESS;
|
||||
const ObRawExpr *l_expr = NULL;
|
||||
const ObOpRawExpr *r_expr = NULL;
|
||||
if (OB_ISNULL(b_expr) || OB_ISNULL(query_range_ctx_)) {
|
||||
ObSQLSessionInfo *session = NULL;
|
||||
bool enable_not_in_range = false;
|
||||
if (OB_ISNULL(b_expr) || OB_ISNULL(query_range_ctx_) || OB_ISNULL(query_range_ctx_->exec_ctx_)
|
||||
|| OB_ISNULL(session = query_range_ctx_->exec_ctx_->get_my_session())) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("expr is null.", K(b_expr), K_(query_range_ctx));
|
||||
LOG_WARN("unexpected null", K(b_expr), K_(query_range_ctx), K(session));
|
||||
} else if (2 != b_expr->get_param_count()) {//binary op expr
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("b_expr must has 2 arguments", K(ret));
|
||||
@ -3403,8 +3406,11 @@ int ObQueryRange::pre_extract_not_in_op(const ObOpRawExpr *b_expr,
|
||||
OB_ISNULL(r_expr = static_cast<const ObOpRawExpr *>(b_expr->get_param_expr(1)))) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("r_expr is null.", K(ret));
|
||||
} else if (r_expr->get_param_count() > MAX_NOT_IN_SIZE || l_expr->get_expr_type() == T_OP_ROW) {
|
||||
// do not extract range over MAX_NOT_IN_SIZE
|
||||
} else if (OB_FAIL(session->is_enable_range_extraction_for_not_in(enable_not_in_range))) {
|
||||
LOG_WARN("failed to check not in range enabled", K(ret));
|
||||
} else if (!enable_not_in_range || r_expr->get_param_count() > MAX_NOT_IN_SIZE
|
||||
|| l_expr->get_expr_type() == T_OP_ROW) {
|
||||
// do not extract range: 1. not in range is disabled; 2. not in size over MAX_NOT_IN_SIZE
|
||||
GET_ALWAYS_TRUE_OR_FALSE(true, out_key_part);
|
||||
query_range_ctx_->cur_expr_is_precise_ = false;
|
||||
} else {
|
||||
|
@ -512,6 +512,18 @@ bool ObSQLSessionInfo::is_index_skip_scan_enabled() const
|
||||
return bret;
|
||||
}
|
||||
|
||||
int ObSQLSessionInfo::is_enable_range_extraction_for_not_in(bool &enabled) const
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
enabled = false;
|
||||
int64_t tenant_id = get_effective_tenant_id();
|
||||
omt::ObTenantConfigGuard tenant_config(TENANT_CONF(tenant_id));
|
||||
if (tenant_config.is_valid()) {
|
||||
enabled = tenant_config->_enable_range_extraction_for_not_in;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool ObSQLSessionInfo::is_var_assign_use_das_enabled() const
|
||||
{
|
||||
bool bret = true;
|
||||
|
@ -1156,6 +1156,7 @@ public:
|
||||
bool is_in_range_optimization_enabled() const;
|
||||
int is_better_inlist_enabled(bool &enabled) const;
|
||||
bool is_index_skip_scan_enabled() const;
|
||||
int is_enable_range_extraction_for_not_in(bool &enabled) const;
|
||||
bool is_var_assign_use_das_enabled() const;
|
||||
|
||||
ObSessionDDLInfo &get_ddl_info() { return ddl_info_; }
|
||||
|
@ -292,6 +292,7 @@ _enable_protocol_diagnose
|
||||
_enable_px_batch_rescan
|
||||
_enable_px_fast_reclaim
|
||||
_enable_px_ordered_coord
|
||||
_enable_range_extraction_for_not_in
|
||||
_enable_reserved_user_dcl_restriction
|
||||
_enable_resource_limit_spec
|
||||
_enable_skip_index
|
||||
|
Loading…
x
Reference in New Issue
Block a user