Skip to content
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

Merged
merged 10 commits into from
Dec 10, 2024
Merged

Add new command - planalyze #86

merged 10 commits into from
Dec 10, 2024

Conversation

systay
Copy link
Contributor

@systay systay commented Dec 9, 2024

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.

harshit-gangal and others added 9 commits December 9, 2024 10:11
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: Florent Poinsard <[email protected]>
Signed-off-by: Florent Poinsard <[email protected]>
Signed-off-by: Andres Taylor <[email protected]>
@frouioui frouioui merged commit 29ec257 into vitessio:main Dec 10, 2024
1 check passed
@frouioui frouioui deleted the planalyze branch December 10, 2024 14:15
Comment on lines +174 to +182
rb, ok := plan.Instructions.(*engine.Route)
switch {
case !ok:
return Complex
case rb.Opcode.IsSingleShard():
return PassThrough
}

return SimpleRouted
Copy link
Member

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

Comment on lines +2 to +10
"keyspaces": {
"main": {
"sharded": true,
"vindexes": {
"xxhash": {
"type": "xxhash"
}
},
"tables": {
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants