Skip to content

Cache parsed queries in the impact pass - #2725

Merged
shangyian merged 3 commits into
mainfrom
perf/parse-cache
Nov 15, 2026
Merged

shangyian merged 3 commits into
mainfrom
perf/parse-cache

Conversation

@shangyian

@shangyian shangyian commented Nov 13, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

This PR adds a cache for parsed queries. Each cache hit rebuilds a separate tree so callers cannot change another caller's copy.

Test Plan

  • PR has an associated issue: #
  • make check passes
  • make test shows 100% unit test coverage

Deployment Plan

@netlify

netlify Bot commented Nov 13, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for thriving-cassata-78ae72 canceled.

Name Link
🔨 Latest commit d76af1e
🔍 Latest deploy log https://app.netlify.com/projects/thriving-cassata-78ae72/deploys/6af758b23c2dd6b27e88edfa

@shangyian
shangyian marked this pull request as ready for review November 13, 2026 06:37
@greptile-apps

greptile-apps Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no new actionable issue was found.

Summary

Adds a bounded cache of parsed queries and returns a separate tree to each caller.

  • Repeated SQL queries reuse parsed work while each caller gets its own tree.

Reviews (3) · Last reviewed commit: "Route the fingerprint pass through the p..." · Reviewed by Greptile

The impact pass parses every downstream query on each deploy, about 3 ms each,
and ANTLR parsing holds the GIL so the threadpool does not help. Keep each
tree pickled (about 4 KB, 0.1 ms to load) in a bounded least-recently-used
cache so repeated deploys of the same text skip the parse. Trees built without
parent links are never kept.
The fingerprint pass parsed the same query text again outside the cache. All
four parse sites now share one cache keyed on the text and the parse mode.
@shangyian
shangyian merged commit 8ae764b into main Nov 15, 2026
28 checks passed
@shangyian
shangyian deleted the perf/parse-cache branch November 15, 2026 05:46
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