BE-515: HashQL: Remove OFFSET 0 materialization fence from generated query#8650
Draft
Conversation
This was referenced Apr 21, 2026
Merged
BE-474: HashQL: Take into account terminator target eligibility in execution backend placement
#8587
Draft
Member
Author
3 tasks
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## bm/be-514-hashql-solver-iterate-forwardbackward-passes-to-convergence #8650 +/- ##
=========================================================================================================
+ Coverage 56.76% 63.63% +6.86%
=========================================================================================================
Files 610 1163 +553
Lines 46028 129424 +83396
Branches 3077 4982 +1905
=========================================================================================================
+ Hits 26130 82360 +56230
- Misses 19644 46198 +26554
- Partials 254 866 +612 Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.

🌟 What is the purpose of this PR?
HashQL: Remove
OFFSET 0materialization fence from generated SQLProblem
Each PostgreSQL island is wrapped in a
CROSS JOIN LATERALsubquery. The subquery previously includedOFFSET 0as a materialization fence to prevent PostgreSQL's planner from inlining the CASE tree expression and duplicating it across each composite field access in the SELECT list.The planner's cost estimate favors the fenced plan (lower estimated cost), but empirical benchmarks show the opposite for queries with conditional CASE trees:
For multi-body queries with conditional branches, the materialization overhead exceeds the duplication cost by 3–4×. The fence helps modestly for simple single-expression queries without branching (filter_by_uuid), but is catastrophic for the common case.
🚢 Has this modified a publishable library?
This PR:
📜 Does this require a change to the docs?
The changes in this PR:
🕸️ Does this require a change to the Turbo Graph?
The changes in this PR:
🛡 What tests cover this?
❓ How to test this?