Merge pull request #55771 from zhongyuankai/only_cache_initial_query

Query Cache: Only cache initial query
This commit is contained in:
Robert Schulze 2023-10-18 22:55:52 +02:00 committed by GitHub
commit 8b1e7a1ea1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -988,7 +988,11 @@ static std::tuple<ASTPtr, BlockIO> executeQueryImpl(
}
QueryCachePtr query_cache = context->getQueryCache();
const bool can_use_query_cache = query_cache != nullptr && settings.use_query_cache && !internal && (ast->as<ASTSelectQuery>() || ast->as<ASTSelectWithUnionQuery>());
const bool can_use_query_cache = query_cache != nullptr
&& settings.use_query_cache
&& !internal
&& client_info.query_kind == ClientInfo::QueryKind::INITIAL_QUERY
&& (ast->as<ASTSelectQuery>() || ast->as<ASTSelectWithUnionQuery>());
QueryCache::Usage query_cache_usage = QueryCache::Usage::None;
if (!async_insert)