diff --git a/src/Common/ThreadStatus.h b/src/Common/ThreadStatus.h index b414a9bccf5..67450d8c779 100644 --- a/src/Common/ThreadStatus.h +++ b/src/Common/ThreadStatus.h @@ -78,7 +78,7 @@ public: InternalProfileEventsQueueWeakPtr profile_queue_ptr; std::function fatal_error_callback; - std::vector thread_ids; + std::unordered_set thread_ids; std::unordered_set threads; /// The first thread created this thread group diff --git a/src/Interpreters/ThreadStatusExt.cpp b/src/Interpreters/ThreadStatusExt.cpp index 3e7f08e9d9a..4810174e395 100644 --- a/src/Interpreters/ThreadStatusExt.cpp +++ b/src/Interpreters/ThreadStatusExt.cpp @@ -109,7 +109,7 @@ void ThreadStatus::setupState(const ThreadGroupStatusPtr & thread_group_) std::lock_guard lock(thread_group->mutex); /// NOTE: thread may be attached multiple times if it is reused from a thread pool. - thread_group->thread_ids.emplace_back(thread_id); + thread_group->thread_ids.insert(thread_id); thread_group->threads.insert(this); logs_queue_ptr = thread_group->logs_queue_ptr;