add for insert values statement split&rewrite batch optimization

This commit is contained in:
yishenglanlingzui
2023-08-14 15:12:40 +00:00
committed by ob-robot
parent 15934d24ac
commit 9b3f07d4ad
37 changed files with 1653 additions and 290 deletions

View File

@ -202,7 +202,8 @@ public:
: inner_alloc_("FastParserRes"),
raw_params_(&inner_alloc_),
parameterized_params_(&inner_alloc_),
cache_params_(NULL)
cache_params_(NULL),
values_token_pos_(0)
{
reset_question_mark_ctx();
}
@ -211,11 +212,14 @@ public:
common::ObFixedArray<const common::ObObjParam *, common::ObIAllocator> parameterized_params_;
ParamStore *cache_params_;
ObQuestionMarkCtx question_mark_ctx_;
int64_t values_token_pos_;
void reset() {
pc_key_.reset();
raw_params_.reuse();
parameterized_params_.reuse();
cache_params_ = NULL;
values_token_pos_ = 0;
}
void reset_question_mark_ctx()
{
@ -226,7 +230,7 @@ public:
question_mark_ctx_.by_name_ = false;
question_mark_ctx_.by_defined_name_ = false;
}
TO_STRING_KV(K(pc_key_), K(raw_params_), K(parameterized_params_), K(cache_params_));
TO_STRING_KV(K(pc_key_), K(raw_params_), K(parameterized_params_), K(cache_params_), K(values_token_pos_));
};
enum WayToGenPlan {
@ -279,6 +283,31 @@ struct SelectItemParamInfo
typedef common::ObFixedArray<SelectItemParamInfo, common::ObIAllocator> SelectItemParamInfoArray;
typedef common::ObFixedArray<ObPCParam *, common::ObIAllocator> ObRawParams;
typedef common::ObFixedArray<ObRawParams *, common::ObIAllocator> ObRawParams2DArray;
struct ObInsertBatchOptInfo
{
ObInsertBatchOptInfo(common::ObIAllocator &allocator)
: insert_params_count_(0),
update_params_count_(0),
sql_delta_length_(0),
multi_raw_params_(allocator),
new_reconstruct_sql_()
{}
TO_STRING_KV(K_(insert_params_count), K_(update_params_count),
K_(sql_delta_length), K_(new_reconstruct_sql));
int64_t insert_params_count_;
int64_t update_params_count_;
int64_t sql_delta_length_;
ObRawParams2DArray multi_raw_params_;
ObString new_reconstruct_sql_;
};
struct ObPlanCacheCtx : public ObILibCacheCtx
{
ObPlanCacheCtx(const common::ObString &sql,
@ -318,7 +347,8 @@ struct ObPlanCacheCtx : public ObILibCacheCtx
fixed_param_info_list_(allocator),
dynamic_param_info_list_(allocator),
tpl_sql_const_cons_(allocator),
need_retry_add_plan_(true)
need_retry_add_plan_(true),
insert_batch_opt_info_(allocator)
{
fp_result_.pc_key_.mode_ = mode_;
}
@ -389,7 +419,8 @@ struct ObPlanCacheCtx : public ObILibCacheCtx
K(dynamic_param_info_list_),
K(tpl_sql_const_cons_),
K(is_original_ps_mode_),
K(need_retry_add_plan_)
K(need_retry_add_plan_),
K(insert_batch_opt_info_)
);
PlanCacheMode mode_; //control use which variables to do match
@ -449,6 +480,7 @@ struct ObPlanCacheCtx : public ObILibCacheCtx
// ********** for rewrite end **********
// when schema version of cache node is old, whether remove this node and retry add cache obj.
bool need_retry_add_plan_;
ObInsertBatchOptInfo insert_batch_opt_info_;
};
struct ObPlanCacheStat