Merge subqueries that "join" on lookup index columns.#10966
Merge subqueries that "join" on lookup index columns.#10966systay merged 7 commits intovitessio:mainfrom
Conversation
Review ChecklistHello reviewers! 👋 Please follow this checklist when reviewing this Pull Request. General
If a new flag is being introduced:
If a workflow is added or modified:
Bug fixes
Non-trivial changes
New/Existing features
Backward compatibility
|
5d54ce0 to
319401a
Compare
744ef9f to
ee8ed2c
Compare
|
Using this branch, we're seeing this error occasionally when trying to vtexplain some of these types of queries: Eyeballing them, it seems all the problematic ones have a I'll send examples to you separately @arthurschreiber. |
I believe this was fixed with some of the recent changes I pushed. 👍 |
|
This pull request also contains the change described in #11072 (comment) |
c6be0b9 to
a20a5c4
Compare
66814b5 to
911e489
Compare
This is a squash of a number of commits created by Arthur. Co-authored-by: Arthur Schreiber <arthurschreiber@github.com> Signed-off-by: Andres Taylor <andres@planetscale.com>
8dcec53 to
2c31f14
Compare
Signed-off-by: Andres Taylor <andres@planetscale.com>
Signed-off-by: Andres Taylor <andres@planetscale.com>
harshit-gangal
left a comment
There was a problem hiding this comment.
This is really great optimization.
See if some helpful comments can be added on top of the functions to help understand the merge rules.
Signed-off-by: Andres Taylor <andres@planetscale.com>
Signed-off-by: Andres Taylor <andres@planetscale.com>
Signed-off-by: Andres Taylor <andres@planetscale.com>
Description
This pull request tries to improve the handling of queries that contain
INor=operations with one operant being a lookup vindex column, and the other operant being a subquery that selects a column from the same or a different table that uses the same lookup vindex.Here's an example:
Without this change, the planner breaks this query into two parts, one part executing the inner query and another for the outer query.
But because we're selecting data from
music.idin the inner query, which has a unique lookup index defined, and comparing it tomusic.idin the outer query, we can merge the inner and outer queries together.I'm fairly confident the code changes are bad, but I think they show that this change is viable. 😅
Related Issue(s)
Checklist
Deployment Notes