add _enable_values_table_folding config param
This commit is contained in:
@ -707,6 +707,7 @@ int ObPlanCache::construct_fast_parser_result(common::ObIAllocator &allocator,
|
||||
bool can_do_batch_insert = false;
|
||||
ObString first_truncated_sql;
|
||||
int64_t batch_count = 0;
|
||||
bool is_insert_values = false;
|
||||
if (OB_FAIL(ObSqlParameterization::fast_parser(allocator,
|
||||
fp_ctx,
|
||||
raw_sql,
|
||||
@ -717,7 +718,8 @@ int ObPlanCache::construct_fast_parser_result(common::ObIAllocator &allocator,
|
||||
fp_result,
|
||||
can_do_batch_insert,
|
||||
batch_count,
|
||||
first_truncated_sql))) {
|
||||
first_truncated_sql,
|
||||
is_insert_values))) {
|
||||
LOG_WARN("fail to do insert optimization", K(ret));
|
||||
} else if (can_do_batch_insert) {
|
||||
if (OB_FAIL(rebuild_raw_params(allocator,
|
||||
@ -745,7 +747,8 @@ int ObPlanCache::construct_fast_parser_result(common::ObIAllocator &allocator,
|
||||
LOG_DEBUG("print new fp_result.pc_key_.name_", K(fp_result.pc_key_.name_));
|
||||
}
|
||||
}
|
||||
} else if (OB_FAIL(ObValuesTableCompression::try_batch_exec_params(allocator, pc_ctx,
|
||||
} else if (!is_insert_values &&
|
||||
OB_FAIL(ObValuesTableCompression::try_batch_exec_params(allocator, pc_ctx,
|
||||
*pc_ctx.sql_ctx_.session_info_, fp_result))) {
|
||||
LOG_WARN("failed to check fold params valid", K(ret));
|
||||
}
|
||||
@ -955,7 +958,8 @@ int ObPlanCache::check_can_do_insert_opt(common::ObIAllocator &allocator,
|
||||
ObFastParserResult &fp_result,
|
||||
bool &can_do_batch,
|
||||
int64_t &batch_count,
|
||||
ObString &first_truncated_sql)
|
||||
ObString &first_truncated_sql,
|
||||
bool &is_insert_values)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
can_do_batch = false;
|
||||
@ -1001,6 +1005,10 @@ int ObPlanCache::check_can_do_insert_opt(common::ObIAllocator &allocator,
|
||||
pc_ctx.insert_batch_opt_info_.update_params_count_ = upd_params_count;
|
||||
pc_ctx.insert_batch_opt_info_.sql_delta_length_ = delta_length;
|
||||
}
|
||||
// if batch_count >= 1, then sql is a insert into .. values ()...;
|
||||
if (batch_count >= 1) {
|
||||
is_insert_values = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (ret != OB_SUCCESS) {
|
||||
|
||||
@ -242,7 +242,8 @@ public:
|
||||
ObFastParserResult &fp_result,
|
||||
bool &can_do_batch,
|
||||
int64_t &batch_count,
|
||||
ObString &first_truncated_sql);
|
||||
ObString &first_truncated_sql,
|
||||
bool &is_insert_values);
|
||||
static int rebuild_raw_params(common::ObIAllocator &allocator,
|
||||
ObPlanCacheCtx &pc_ctx,
|
||||
ObFastParserResult &fp_result,
|
||||
|
||||
@ -251,14 +251,16 @@ int ObValuesTableCompression::try_batch_exec_params(ObIAllocator &allocator,
|
||||
ObSEArray<int64_t, 16> raw_pos;
|
||||
ObPhysicalPlanCtx *phy_ctx = NULL;
|
||||
uint64_t data_version = 0;
|
||||
if (OB_FAIL(GET_MIN_DATA_VERSION(session_info.get_effective_tenant_id(), data_version))) {
|
||||
if (pc_ctx.sql_ctx_.handle_batched_multi_stmt() ||
|
||||
lib::is_oracle_mode() ||
|
||||
session_info.is_inner() ||
|
||||
session_info.get_is_in_retry() ||
|
||||
fp_result.values_tokens_.empty() ||
|
||||
!GCONF._enable_values_table_folding) {
|
||||
/* do nothing */
|
||||
} else if (OB_FAIL(GET_MIN_DATA_VERSION(session_info.get_effective_tenant_id(), data_version))) {
|
||||
LOG_WARN("get tenant data version failed", K(ret), K(session_info.get_effective_tenant_id()));
|
||||
} else if (pc_ctx.sql_ctx_.handle_batched_multi_stmt() ||
|
||||
lib::is_oracle_mode() ||
|
||||
session_info.is_inner() ||
|
||||
session_info.get_is_in_retry() ||
|
||||
fp_result.values_tokens_.empty() ||
|
||||
data_version < DATA_VERSION_4_2_1_0 ||
|
||||
} else if (data_version < DATA_VERSION_4_2_1_0 ||
|
||||
!is_support_compress_values_table(pc_ctx.raw_sql_)) {
|
||||
/* do nothing */
|
||||
} else if (OB_ISNULL(phy_ctx = pc_ctx.exec_ctx_.get_physical_plan_ctx())) {
|
||||
|
||||
Reference in New Issue
Block a user