Repository navigation
Do not recompute the parameterized view query hash on TableNode clone - #121042
Conversation
`TableNode::cloneImpl` created the copy through the public constructor, which eagerly computes `parameterized_view_query_hash` by traversing `storage_snapshot->metadata->getSelectQuery().inner_query`, and only then overwrote the field with the already cached value of the source node. So every clone of a parameterized-view table expression still paid one full walk of the substituted inner query - exactly the cost that the cache added in #119517 is meant to avoid - and the analyzer clones subtrees repeatedly. Add a private constructor used only by `cloneImpl` that takes the hash from the source node, so cloning is O(1) with respect to the size of the view query. Related: #119517 Related: #118736 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
|
Workflow [PR], commit [8ade3dc] Summary: ✅
AI ReviewSummaryThis PR changes Final Verdict
LLVM Coverage ReportMeasured on commit 8ade3dc.
Changed lines: Changed C/C++ lines covered: 18/18 (100.00%) · Uncovered code |
|
📊 Cloud Performance Report ✅ AI verdict: This PR found no performance change, and none should be expected. The only change is that TableNode::cloneImpl now copies the cached parameterized view query hash instead of working it out again. That runs during query analysis and has no effect on ClickBench or TPC-H execution. The two flagged ClickBench queries, Q31 (+11.2%) and Q34 (+5.1%), both stay not_sure. Their CPU time barely moved, and Q31 is within master's current range. Some PR benchmark runs also shared hosts with each other, which can push up wall-clock times without adding CPU work. clickbenchFlagged queries (2 of 43)
Change = percent below ×2; the ratio of medians (×N faster/slower) beyond, where percent understates the scale. q-value = BH-FDR adjusted p; smaller is stronger evidence. MIRAI flags a query when q < fdr_q (default 0.10) — the value the verdict is based on. tpch_adapted_1_official🟢 No significant changes Debug info
|
Build profile diff (arm_release)Commit See the job log for details. |
|
🕵 Status: the AI-review request is addressed — I confirmed on trunk that parameterized view calls resolve to |
|
🕵 Merged |
|
Both have fixes in progress, so I am not opening a new PR:
The new head |
|
🕵 Thanks @groeneai — noted: |
Follow-up to #119517, which cached the hash of the substituted inner query of a parameterized view in
TableNodeso thatisEqualImplandupdateTreeHashImplare O(1).TableNode::cloneImplcreated the copy through the public constructor, which eagerly computesparameterized_view_query_hashby traversingstorage_snapshot->metadata->getSelectQuery().inner_query, and only then overwrote the field with the already cached value of the source node. A private constructor used only bycloneImplnow carries the cached hash over from the source node, so cloning does not look at the view query at all. This was pointed out in review of #119517: #119517 (comment)This is a consistency cleanup, not a measurable speedup: on current
mastera parameterized view call such aspv(p = ...)is resolved byQueryAnalyzer::resolveTableFunctioninto aTableFunctionNode, not aTableNode, so the ordinary query paths (includingtests/performance/parameterized_view_analysis.xml) never clone aTableNodethat holds a parameterizedStorageView. Verified with a debugger onIN (SELECT ... FROM pv(...))andpv(...) JOIN pv(...)queries: the view's select query is only read byresolveTableFunctionandStorageView::readImpl, never fromTableNode. Behavior is unchanged: the resulting node holds the same hash as before.Related: #119517
Related: #118736
Changelog category (leave one):
🤖 Generated with Claude Code
Workflow [PR]
Sync PR [sync-upstream/pr/121042]
Version info
26.10.1.1779-master(included in26.10and later)