-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add new command - planalyze
#86
Conversation
Signed-off-by: Harshit Gangal <[email protected]>
Signed-off-by: Harshit Gangal <[email protected]>
Signed-off-by: Andres Taylor <[email protected]>
Signed-off-by: Andres Taylor <[email protected]>
Signed-off-by: Andres Taylor <[email protected]>
Signed-off-by: Andres Taylor <[email protected]>
Signed-off-by: Andres Taylor <[email protected]>
Signed-off-by: Florent Poinsard <[email protected]>
Signed-off-by: Florent Poinsard <[email protected]>
Signed-off-by: Andres Taylor <[email protected]>
rb, ok := plan.Instructions.(*engine.Route) | ||
switch { | ||
case !ok: | ||
return Complex | ||
case rb.Opcode.IsSingleShard(): | ||
return PassThrough | ||
} | ||
|
||
return SimpleRouted |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should also check for vindex lookup plans and call them as simple
"keyspaces": { | ||
"main": { | ||
"sharded": true, | ||
"vindexes": { | ||
"xxhash": { | ||
"type": "xxhash" | ||
} | ||
}, | ||
"tables": { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe this only works if the keyspace is defined as main
. We have to make it generic if that is the case.
This PR adds a new command, vt planalyze, to the vt tool set. It enables analyzing query plans against a candidate VSchema without bringing up a cluster. By running the Vitess planner on a set of queries, it classifies each query into one of four categories:
1. Pass-through: Single-shard queries, fully optimized at the shard level.
2. Simple routed: Single-route plans that avoid costly multi-shard operations.
3. Complex routed: Multi-shard plans that require vtgate-level work, acceptable but potentially slow when frequently used.
4. Unplanable: Queries not currently supported by Vitess planning.
This functionality helps iterate on and refine the VSchema by quickly highlighting queries that require adjustments for improved performance.
Example report can be found here.