From 055efec1a0f82d0eab7417de447a8166c5706942 Mon Sep 17 00:00:00 2001 From: zhongyuankai <54787696+zhongyuankai@users.noreply.github.com> Date: Fri, 23 Feb 2024 19:03:41 +0800 Subject: [PATCH] minor --- src/Interpreters/executeQuery.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Interpreters/executeQuery.cpp b/src/Interpreters/executeQuery.cpp index 8ad3f706cea..c1b1cc1cdcf 100644 --- a/src/Interpreters/executeQuery.cpp +++ b/src/Interpreters/executeQuery.cpp @@ -1146,7 +1146,8 @@ static std::tuple executeQueryImpl( std::chrono::system_clock::now() + std::chrono::seconds(settings.query_cache_ttl), settings.query_cache_compress_entries); - if (settings.query_cache_min_query_runs && query_cache->recordQueryRun(key) <= settings.query_cache_min_query_runs) + const size_t num_query_runs = settings.query_cache_min_query_runs ? query_cache->recordQueryRun(key) : 1; + if (num_query_runs <= settings.query_cache_min_query_runs) { LOG_TRACE(getLogger("QueryCache"), "Skipped insert because the query ran {} times but the minimum required number of query runs to cache the query result is {}",