Skip to content

Commit

Permalink
Add vexplain trace (#16768)
Browse files Browse the repository at this point in the history
Signed-off-by: Andres Taylor <andres@planetscale.com>
Signed-off-by: Florent Poinsard <florent.poinsard@outlook.fr>
Co-authored-by: Florent Poinsard <florent.poinsard@outlook.fr>
  • Loading branch information
systay and frouioui authored Sep 17, 2024
1 parent f97ea77 commit 8816a2d
Show file tree
Hide file tree
Showing 17 changed files with 8,987 additions and 8,787 deletions.
2 changes: 2 additions & 0 deletions go/vt/sqlparser/ast_funcs.go
Original file line number Diff line number Diff line change
Expand Up @@ -1923,6 +1923,8 @@ func (ty VExplainType) ToString() string {
return QueriesStr
case AllVExplainType:
return AllVExplainStr
case TraceVExplainType:
return TraceStr
default:
return "Unknown VExplainType"
}
Expand Down
2 changes: 2 additions & 0 deletions go/vt/sqlparser/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,7 @@ const (
QueriesStr = "queries"
AllVExplainStr = "all"
PlanStr = "plan"
TraceStr = "trace"

// Lock Types
ReadStr = "read"
Expand Down Expand Up @@ -846,6 +847,7 @@ const (
QueriesVExplainType VExplainType = iota
PlanVExplainType
AllVExplainType
TraceVExplainType
)

// Constant for Enum Type - SelectIntoType
Expand Down
1 change: 1 addition & 0 deletions go/vt/sqlparser/keywords.go
Original file line number Diff line number Diff line change
Expand Up @@ -711,6 +711,7 @@ var keywords = []keyword{
{"tinyint", TINYINT},
{"tinytext", TINYTEXT},
{"to", TO},
{"trace", TRACE},
{"trailing", TRAILING},
{"transaction", TRANSACTION},
{"transactions", TRANSACTIONS},
Expand Down
3 changes: 3 additions & 0 deletions go/vt/sqlparser/parse_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2573,6 +2573,9 @@ var (
}, {
input: "vexplain select * from t",
output: "vexplain plan select * from t",
}, {
input: "vexplain trace select * from t",
output: "vexplain trace select * from t",
}, {
input: "explain analyze select * from t",
}, {
Expand Down
Loading

0 comments on commit 8816a2d

Please sign in to comment.