Fix local plan cache growth for prepared statements - #8824
Open
Hamid Akhtar (hqakhtar) wants to merge 1 commit into
Open
Fix local plan cache growth for prepared statements#8824Hamid Akhtar (hqakhtar) wants to merge 1 commit into
Hamid Akhtar (hqakhtar) wants to merge 1 commit into
Conversation
PR #8371 made cache lookup reject plans whose task list did not contain exactly one task. Deferred-pruning plans keep the persistent plan's task list empty, so every execution missed the existing local plan and added another one. This caused unbounded memory growth. Separate cache eligibility from lookup. Use the current job for eligibility and the persistent distributed plan for cache storage. Keep the multi-shard reuse guard and allocate cache entries in the persistent plan's memory context. Add a regression helper that reads the generic plan's cache size. Verify that repeated single-shard executions retain one entry and a multi-shard execution does not add another.
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #8824 +/- ##
==========================================
- Coverage 88.73% 88.72% -0.02%
==========================================
Files 289 290 +1
Lines 65013 65068 +55
Branches 8203 8209 +6
==========================================
+ Hits 57691 57730 +39
- Misses 4954 4963 +9
- Partials 2368 2375 +7 🚀 New features to boost your workflow:
|
Hamid Akhtar (hqakhtar)
force-pushed
the
hamid/local_plan_cache_oom_fix
branch
from
September 3, 2026 13:08
078d7dc to
0a10bdd
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR #8371 made cache lookup reject plans whose task list did not contain exactly one task. Deferred-pruning plans keep the persistent plan's task list empty, so every execution missed the existing local plan and added another one. This caused unbounded memory growth.
Separate cache eligibility from lookup. Use the current job for eligibility and the persistent distributed plan for cache storage. Keep the multi-shard reuse guard and allocate cache entries in the persistent plan's memory context.
Add a regression helper that reads the generic plan's cache size. Verify that repeated single-shard executions retain one entry and a multi-shard execution does not add another.