diff --git a/src/main/infinity.cpp b/src/main/infinity.cpp index db35e92e0..e7dd7a6ea 100644 --- a/src/main/infinity.cpp +++ b/src/main/infinity.cpp @@ -97,7 +97,8 @@ std::variant, QueryResult> Infinity::GetQueryContext(boo if (std::holds_alternative(result)) { \ return std::get(result); \ } \ - query_context_ptr = std::move(std::get>(result)); + query_context_ptr = std::move(std::get>(result)); \ + query_context_ptr->CreateQueryProfiler(); u64 Infinity::GetSessionId() { return session_->session_id(); } diff --git a/src/main/query_context.cpp b/src/main/query_context.cpp index 8c4165efd..694441868 100644 --- a/src/main/query_context.cpp +++ b/src/main/query_context.cpp @@ -319,7 +319,9 @@ QueryResult QueryContext::QueryStatement(const BaseStatement *base_statement) { void QueryContext::CreateQueryProfiler() { if (InfinityContext::instance().storage()->catalog()->GetProfile()) { - query_profiler_ = MakeShared(true); + if(query_profiler_ == nullptr) { + query_profiler_ = MakeShared(true); + } } } diff --git a/src/main/query_context.cppm b/src/main/query_context.cppm index 2db8d7e96..763eac0a7 100644 --- a/src/main/query_context.cppm +++ b/src/main/query_context.cppm @@ -133,12 +133,13 @@ public: } } + void CreateQueryProfiler(); + private: QueryResult HandleAdminStatement(const AdminStatement* admin_statement); private: - void CreateQueryProfiler(); void RecordQueryProfiler(const StatementType &type); void StartProfile(QueryPhase phase); void StopProfile(QueryPhase phase);