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

Explain Statement plan improvement #14928

Merged
merged 9 commits into from
Jan 29, 2024

Conversation

harshit-gangal
Copy link
Member

@harshit-gangal harshit-gangal commented Jan 10, 2024

Description

In order to support EXPLAIN on more queries, we need to do a little bit of table name massaging before sending down the EXPLAIN query to MySQL. Specifically, we need to handle routed tables correctly, since they don't have the same name in Vitess as they do in the underlying MySQL instance.

Related Issue(s)

Fixes #14961

Checklist

Copy link
Contributor

vitess-bot bot commented Jan 10, 2024

Review Checklist

Hello reviewers! 👋 Please follow this checklist when reviewing this Pull Request.

General

  • Ensure that the Pull Request has a descriptive title.
  • Ensure there is a link to an issue (except for internal cleanup and flaky test fixes), new features should have an RFC that documents use cases and test cases.

Tests

  • Bug fixes should have at least one unit or end-to-end test, enhancement and new features should have a sufficient number of tests.

Documentation

  • Apply the release notes (needs details) label if users need to know about this change.
  • New features should be documented.
  • There should be some code comments as to why things are implemented the way they are.
  • There should be a comment at the top of each new or modified test to explain what the test does.

New flags

  • Is this flag really necessary?
  • Flag names must be clear and intuitive, use dashes (-), and have a clear help text.

If a workflow is added or modified:

  • Each item in Jobs should be named in order to mark it as required.
  • If the workflow needs to be marked as required, the maintainer team must be notified.

Backward compatibility

  • Protobuf changes should be wire-compatible.
  • Changes to _vt tables and RPCs need to be backward compatible.
  • RPC changes should be compatible with vitess-operator
  • If a flag is removed, then it should also be removed from vitess-operator and arewefastyet, if used there.
  • vtctl command output order should be stable and awk-able.

@vitess-bot vitess-bot bot added NeedsBackportReason If backport labels have been applied to a PR, a justification is required NeedsDescriptionUpdate The description is not clear or comprehensive enough, and needs work NeedsIssue A linked issue is missing for this Pull Request NeedsWebsiteDocsUpdate What it says labels Jan 10, 2024
@github-actions github-actions bot added this to the v19.0.0 milestone Jan 10, 2024
@harshit-gangal harshit-gangal added Type: Enhancement Logical improvement (somewhere between a bug and feature) Component: Query Serving and removed NeedsWebsiteDocsUpdate What it says NeedsBackportReason If backport labels have been applied to a PR, a justification is required labels Jan 10, 2024
@harshit-gangal harshit-gangal added the release notes (needs details) This PR needs to be listed in the release notes in a dedicated section (deprecation notice, etc...) label Jan 15, 2024
@harshit-gangal
Copy link
Member Author

@systay systay removed NeedsDescriptionUpdate The description is not clear or comprehensive enough, and needs work NeedsIssue A linked issue is missing for this Pull Request labels Jan 16, 2024
@systay systay marked this pull request as ready for review January 16, 2024 07:52
harshit-gangal and others added 7 commits January 25, 2024 13:50
…hich contains the table

Signed-off-by: Harshit Gangal <harshit@planetscale.com>
Signed-off-by: Andres Taylor <andres@planetscale.com>
Signed-off-by: Andres Taylor <andres@planetscale.com>
Signed-off-by: Andres Taylor <andres@planetscale.com>
Signed-off-by: Andres Taylor <andres@planetscale.com>
Signed-off-by: Harshit Gangal <harshit@planetscale.com>
Signed-off-by: Harshit Gangal <harshit@planetscale.com>
Signed-off-by: Harshit Gangal <harshit@planetscale.com>
@harshit-gangal harshit-gangal removed the release notes (needs details) This PR needs to be listed in the release notes in a dedicated section (deprecation notice, etc...) label Jan 25, 2024
Signed-off-by: Harshit Gangal <harshit@planetscale.com>
Copy link

codecov bot commented Jan 25, 2024

Codecov Report

Attention: 55 lines in your changes are missing coverage. Please review.

Comparison is base (17e7f84) 47.38% compared to head (2f83cb6) 47.39%.
Report is 6 commits behind head on main.

Files Patch % Lines
go/vt/vtgate/semantics/semantic_state.go 0.00% 20 Missing ⚠️
go/vt/sqlparser/ast_funcs.go 0.00% 14 Missing ⚠️
go/vt/vtgate/planbuilder/vexplain.go 65.71% 9 Missing and 3 partials ⚠️
go/vt/vtgate/planbuilder/builder.go 60.00% 2 Missing ⚠️
go/vt/vtgate/planbuilder/operators/SQL_builder.go 0.00% 2 Missing ⚠️
go/vt/vtgate/planbuilder/operators/join.go 0.00% 2 Missing ⚠️
go/vt/vtgate/planbuilder/operators/ast_to_op.go 0.00% 1 Missing ⚠️
...t/vtgate/planbuilder/operators/subquery_builder.go 0.00% 1 Missing ⚠️
go/vt/vtgate/planbuilder/operators/table.go 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #14928      +/-   ##
==========================================
+ Coverage   47.38%   47.39%   +0.01%     
==========================================
  Files        1145     1145              
  Lines      239155   239185      +30     
==========================================
+ Hits       113322   113372      +50     
+ Misses     117249   117237      -12     
+ Partials     8584     8576       -8     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@harshit-gangal
Copy link
Member Author

Docs PR: vitessio/website#1669

Comment on lines +4413 to 4415
"comment": "vexplain all dml without any directive should fail",
"query": "vexplain all delete from user",
"plan": "VT09008: vexplain queries/all will actually run queries"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is not clear to me if vtexplain all or just vtexplain queries, will actually run queries

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

both of them will. only vexplain plan does not run it.

Copy link
Member

@frouioui frouioui left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we add end-to-end tests for this?

Otherwise, it all looks good to me

@harshit-gangal harshit-gangal merged commit 38573f0 into vitessio:main Jan 29, 2024
101 of 103 checks passed
@harshit-gangal harshit-gangal deleted the explain-stmt branch January 29, 2024 12:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Query Serving Type: Enhancement Logical improvement (somewhere between a bug and feature)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Transparent routing fails when using EXPLAIN
3 participants