diff --git a/src/observer/mysql/obmp_query.cpp b/src/observer/mysql/obmp_query.cpp index e955bdc873..c5b1418a43 100644 --- a/src/observer/mysql/obmp_query.cpp +++ b/src/observer/mysql/obmp_query.cpp @@ -950,8 +950,7 @@ OB_INLINE int ObMPQuery::do_process(ObSQLSessionInfo &session, } } //update v$sql statistics - if ((OB_SUCC(ret) || audit_record.is_timeout()) - && session.get_local_ob_enable_plan_cache() + if (session.get_local_ob_enable_plan_cache() && !retry_ctrl_.need_retry()) { ObIArray *table_row_count_list = NULL; ObPhysicalPlanCtx *plan_ctx = result.get_exec_context().get_physical_plan_ctx(); diff --git a/src/observer/mysql/obmp_stmt_execute.cpp b/src/observer/mysql/obmp_stmt_execute.cpp index 99ec07b4cb..f3c8053c98 100644 --- a/src/observer/mysql/obmp_stmt_execute.cpp +++ b/src/observer/mysql/obmp_stmt_execute.cpp @@ -1366,8 +1366,7 @@ int ObMPStmtExecute::do_process(ObSQLSessionInfo &session, } //update v$sql statistics - if ((OB_SUCC(ret) || audit_record.is_timeout()) - && session.get_local_ob_enable_plan_cache() + if (session.get_local_ob_enable_plan_cache() && !retry_ctrl_.need_retry() && !is_ps_cursor()) { // ps cursor do this in inner open diff --git a/src/sql/engine/ob_physical_plan.cpp b/src/sql/engine/ob_physical_plan.cpp index c75be0480d..113f5b4c21 100644 --- a/src/sql/engine/ob_physical_plan.cpp +++ b/src/sql/engine/ob_physical_plan.cpp @@ -478,7 +478,8 @@ void ObPhysicalPlan::update_plan_stat(const ObAuditRecordData &record, if (record.is_timeout()) { ATOMIC_INC(&(stat_.timeout_count_)); ATOMIC_AAF(&(stat_.total_process_time_), record.get_process_time()); - } else if (!GCONF.enable_perf_event) { // short route + } + if (!GCONF.enable_perf_event) { // short route ATOMIC_AAF(&(stat_.elapsed_time_), record.get_elapsed_time()); ATOMIC_AAF(&(stat_.cpu_time_), record.get_elapsed_time() - record.exec_record_.wait_time_end_ - (record.exec_timestamp_.run_ts_ - record.exec_timestamp_.receive_ts_));