Repository navigation
Optimize TopK through JOIN and ARRAY JOIN - #128926
Conversation
|
Workflow [PR], commit [6a6aff2] Summary: ✅
AI ReviewSummaryThe PR enables dynamic top-K filtering for sorting moved below Final VerdictStatus: ✅ Approve |
Build profile diff (arm_release)Comparing ✅ No significant changes. Binary sizes
The official master build is compiled with Compile time of recompiled translation units9 translation units recompiled, 37 s compile time in total, 9 of them have a recent master baseline. |
With the re-optimization depth from #128926 the notEmpty filter of the first move goes below the next ARRAY JOIN, so the sort of an inner chain moves again. The case showed the sort between the two ARRAY JOIN steps. Now it shows both above one limited sort with the filter notEmpty(arr2) AND notEmpty(arr).
Cherry pick #128926 to 26.10: Optimize TopK through JOIN and ARRAY JOIN
LEFT JOINchain,ORDER BY l.k DESC LIMIT 10ARRAY JOIN arr ORDER BY k LIMIT 1000ARRAY JOIN arr ORDER BY k DESC LIMIT 10Related: #116550
Related: #115157
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
The sort that
query_plan_top_k_through_array_joinandquery_plan_top_k_through_joinmove now uses the top-K dynamic filter. This lowers memory forORDER BY ... LIMIToverARRAY JOINwith long arrays, and theJOINoptimization now goes through all joins of aLEFT JOINchain.The most notable optimizations are for regular JOINs:

Workflow [PR]
Sync PR [sync-upstream/pr/128926]
Version info
26.11.1.1330-master(included in26.11and later)