Repository navigation
Do not use the subquery query result cache in plans shipped to replicas - #130376
Conversation
Split out of #102192. `StreamInQueryResultCacheStep` and `ReadFromQueryResultCacheStep` hold node-local state (a `QueryResultCacheWriter`, or the cached chunks) with no serialized representation. A logical plan built for parallel replicas with `serialize_query_plan = 1` (`createRemotePlanForParallelReplicas`) is shipped to the replicas, so `query_cache_for_subqueries = 1` failed the whole query with `Method serialize is not implemented for StreamInQueryResultCache`. Plan-based parallel replicas serialize a fragment of the local plan, including `IN` subquery set plans; a fragment holding a cache step is kept local, so the cache would silently disable parallel replicas and make the remote/local decision depend on cache contents. The Planner no longer adds the cache steps in either case. The cache is still populated and read by the plan the initiator executes itself. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Workflow [PR], commit [747feb5] Summary: ✅
AI ReviewSummaryReviewed #130376 at Final VerdictStatus: ✅ Approve |
Build profile diff (arm_release)Comparing ✅ No significant changes. Binary sizes
The official master build is compiled with Compile time of recompiled translation units7 translation units recompiled, 20 s compile time in total, 7 of them have a recent master baseline. |
Add the subquery query result cache tests: the cache is not used with plan-based parallel replicas since #130376. Add `03707_autopr_unsupported_cases` (the `LIMIT` is shipped since #129811) and `03401_..._no_sorting` (#128537). Remove the tests that pass now: the temporary table ones (#129223), the `LIMIT` ones (#129811), and those fixed on master. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Related: #102192
Split out of #102192 (part 4 of 6).
StreamInQueryResultCacheStepandReadFromQueryResultCacheStephold node-local state (aQueryResultCacheWriter, or the cached chunks) with no serialized representation.serialize_query_plan = 1(createRemotePlanForParallelReplicas) is shipped to the replicas, soquery_cache_for_subqueries = 1failed the whole query withMethod serialize is not implemented for StreamInQueryResultCache.parallel_replicas_plan_based) serialize a fragment of the local plan, includingINsubquery set plans. A fragment holding a cache step is kept local, so the cache would silently disable parallel replicas and make the remote/local decision depend on cache contents.The Planner no longer adds the subquery cache steps in either case (checked on the local and the query-level context, so a subquery's own SETTINGS cannot bypass it). The cache is still populated and read by the plan the initiator executes itself.
Tests:
04651_query_result_cache_subquery_parallel_replicas_plan_serialization,05366_query_result_cache_subquery_plan_based_parallel_replicas,05394_query_result_cache_subquery_view_parallel_replicas_plan_serialization.Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Queries with
query_cache_for_subqueries = 1no longer fail withMethod serialize is not implemented for StreamInQueryResultCacheunder parallel replicas withserialize_query_plan = 1.🤖 Generated with Claude Code
Workflow [PR]
Sync PR [sync-upstream/pr/130376]
Version info
26.11.1.1843-master(included in26.11and later)