optimize joins, redirect dml for reference tables#11875
Merged
Conversation
This was referenced Dec 4, 2022
systay
reviewed
Dec 5, 2022
systay
reviewed
Dec 5, 2022
systay
reviewed
Dec 5, 2022
This comment was marked as resolved.
This comment was marked as resolved.
systay
reviewed
Dec 5, 2022
systay
reviewed
Dec 5, 2022
systay
reviewed
Dec 5, 2022
systay
reviewed
Dec 5, 2022
Member
|
As discussed offline. Few more things to be addressed
|
maxenglander
commented
Dec 6, 2022
maxenglander
commented
Dec 6, 2022
maxenglander
commented
Dec 6, 2022
maxenglander
commented
Dec 6, 2022
maxenglander
commented
Dec 6, 2022
maxenglander
commented
Dec 6, 2022
Signed-off-by: Max Englander <max@planetscale.com>
Signed-off-by: Max Englander <max@planetscale.com>
…te loop) Signed-off-by: Max Englander <max@planetscale.com>
Signed-off-by: Max Englander <max@planetscale.com>
Signed-off-by: Max Englander <max@planetscale.com>
Signed-off-by: Max Englander <max@planetscale.com>
Signed-off-by: Max Englander <max@planetscale.com>
Signed-off-by: Max Englander <max@planetscale.com>
Signed-off-by: Max Englander <max@planetscale.com>
…sUsed) Signed-off-by: Max Englander <max@planetscale.com>
Signed-off-by: Max Englander <max@planetscale.com>
Signed-off-by: Max Englander <max@planetscale.com>
Signed-off-by: Max Englander <max@planetscale.com>
…ne.(*Route).TableName Signed-off-by: Max Englander <max@planetscale.com>
Signed-off-by: Max Englander <max@planetscale.com>
Signed-off-by: Max Englander <max@planetscale.com>
d9f5b0f to
73d8cd6
Compare
harshit-gangal
approved these changes
Dec 8, 2022
Collaborator
Author
|
@harshit-gangal @systay thanks so much for the great reviews and for the approvals. Please hold off on merging until I do a last round of validation, thanks! |
Collaborator
Author
|
OK tested ready to merge from my POV :) |
Collaborator
|
🎉 |
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.
Addresses #11864.
Description
Make some improvements to routing for reference tables:
Given:
k1and an sharded keyspacek2.k1.rand reference tablek2.r.k1.ak2.b.And these queries:
SELECT k2.b JOIN k1.rSELECT a JOIN rSELECT b JOIN rINSERT INTO rThe first query will succeed but will issue queries to both
k1andk2, even though the query could be satisifed just by routing tok2.The next three queries will fail with
vitess/go/vt/vtgate/vindexes/vschema.go
Line 566 in 4ff02c0
This PR adds limited support for optimally joining and globally routing these three queries:
k2.2 The second query will join
k1.atok1.r.k2.btok2.r.r.Details
Some notes about the implementation:
sourceis unique in a given keyspace. Future PRs could relax these constraints, but figured it's better to start with a smaller initially.SELECT k2.a JOIN k1.rwill routertok2, even though the user has explicitly requestedk1.r.Checklist
sourceto table VSchema definition.INSERTto reference tables back to the source.