Skip to content

Fix local plan cache growth for prepared statements - #8824

Open
Hamid Akhtar (hqakhtar) wants to merge 1 commit into
mainfrom
hamid/local_plan_cache_oom_fix
Open

Fix local plan cache growth for prepared statements#8824
Hamid Akhtar (hqakhtar) wants to merge 1 commit into
mainfrom
hamid/local_plan_cache_oom_fix

Conversation

@hqakhtar

Copy link
Copy Markdown

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.

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

codecov Bot commented Sep 3, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 84.61538% with 12 lines in your changes missing coverage. Please review.
✅ Project coverage is 88.72%. Comparing base (92d0b92) to head (0a10bdd).

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:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@hqakhtar
Hamid Akhtar (hqakhtar) force-pushed the hamid/local_plan_cache_oom_fix branch from 078d7dc to 0a10bdd Compare September 3, 2026 13:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant