-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
sql: introduce EXPLAIN ANALYZE (PLAN) #56524
Conversation
d6f4799
to
8baa428
Compare
So exciting!! |
8baa428
to
65197bf
Compare
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.
Reviewed 9 of 9 files at r1, 5 of 5 files at r2.
Reviewable status: complete! 0 of 0 LGTMs obtained (waiting on @jordanlewis and @RaduBerinde)
pkg/sql/conn_executor_exec.go, line 351 at r1 (raw file):
ih.SetOutputMode(explainAnalyzeDebugOutput, explain.Flags{}) } else { flags := explain.MakeFlags(&e.ExplainOptions)
Should we increment sqltelemetry.ExplainAnalyzeUseCounter
here?
pkg/sql/exec_util.go, line 834 at r2 (raw file):
// EXPLAIN ANALYZE (PLAN) that can vary between runs (like elapsed times). // Should be set together with execinfra.TestingKnobs.DeterministicStats. DeterministicExplainAnalyze bool
Should we phase out DeterministicStats
in favor of this one?
pkg/sql/instrumentation.go, line 302 at r2 (raw file):
// planRows generates the plan tree as a list of strings (one for each line). // Used in explainAnalyzePlanOutput mode. func (ih *instrumentationHelper) planRows(phaseTimes *phaseTimes) []string {
nit: if this is only used for explain analyze, what do you think of renaming this method to planRowsForExplainAnalyze
similar to planStringForBundle
above?
6aca628
to
2376405
Compare
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.
TFTR!
Reviewable status: complete! 0 of 0 LGTMs obtained (waiting on @asubiotto and @jordanlewis)
pkg/sql/conn_executor_exec.go, line 351 at r1 (raw file):
Previously, asubiotto (Alfonso Subiotto Marqués) wrote…
Should we increment
sqltelemetry.ExplainAnalyzeUseCounter
here?
Done.
pkg/sql/exec_util.go, line 834 at r2 (raw file):
Previously, asubiotto (Alfonso Subiotto Marqués) wrote…
Should we phase out
DeterministicStats
in favor of this one?
I'd like there to be only one too, but they're knobs for different layers. I added a TODO for now.
pkg/sql/instrumentation.go, line 302 at r2 (raw file):
Previously, asubiotto (Alfonso Subiotto Marqués) wrote…
nit: if this is only used for explain analyze, what do you think of renaming this method to
planRowsForExplainAnalyze
similar toplanStringForBundle
above?
Good idea, done.
2376405
to
22d998e
Compare
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.
Reviewed 4 of 4 files at r3.
Reviewable status: complete! 1 of 0 LGTMs obtained (waiting on @jordanlewis)
TFTR! bors r+ |
This change introduces a new variant of `EXPLAIN ANALYZE` which executes the query and returns the execution plan (in the future, annotated with stats from execution). Note that `(PLAN)` is the default mode for the regular `EXPLAIN`. Currently `EXPLAIN ANALYZE` defaults to `(DISTSQL)` mode, but we plan to switch that default to the `(PLAN)` version once it is fully implemented. Release note (sql change): Added a new variant of explain: EXPLAIN ANALYZE (PLAN).
This commit adds planning and execution time as top-level fields in EXPLAIN ANALYZE (PLAN). We also plumb a testing knob to allow these fields to be deterministic in tests. Release note: None
22d998e
to
9ceeeb9
Compare
Canceled. |
bors r+ |
Build succeeded: |
63351: Updating syntax diagram for EXPLAIN ANALYZE (PLAN). r=RaduBerinde a=ianjevans Related to #56524. Updates the syntax diagram and BNF for `EXPLAIN ANALYZE (PLAN)`. Release note: None Co-authored-by: ianjevans <[email protected]>
sql: introduce EXPLAIN ANALYZE (PLAN)
This change introduces a new variant of
EXPLAIN ANALYZE
whichexecutes the query and returns the execution plan (in the future,
annotated with stats from execution).
Note that
(PLAN)
is the default mode for the regularEXPLAIN
.Currently
EXPLAIN ANALYZE
defaults to(DISTSQL)
mode, but we planto switch that default to the
(PLAN)
version once it is fullyimplemented.
Release note (sql change): Added a new variant of explain: EXPLAIN
ANALYZE (PLAN).
sql: add planning and execution time to EXPLAIN ANALYZE (PLAN)
This commit adds planning and execution time as top-level fields in
EXPLAIN ANALYZE (PLAN). We also plumb a testing knob to allow these
fields to be deterministic in tests.
Release note: None