Module mz_repr::explain_new
source · Expand description
A set of traits for modeling things that can be explained by a
SQL EXPLAIN
statement.
The main trait in this module is Explain
.
An explainable subject S
implements Explain
, and as part of that:
- Fixes the context type required for the explanation.
in
Explain::Context
. - Fixes the explanation type for each
ExplainFormat
inExplain::Text
,Explain::Json
, …. - Provides an explanation type constructor for each supported
ExplainFormat
from references toS
,ExplainConfig
, and the currentExplain::Context
inExplain::explain_text
,Explain::explain_json
, ….
The same explanation type can be shared by more than one
ExplainFormat
.
Use UnsupportedFormat
and the default explain_$format
constructor for Explain
to indicate that the implementation does
not support this $format
.
Modules
tracing 🔒
Tracing utilities for explainable plans.
Structs
A somewhat ad-hoc way to keep carry a plan with a set
of attributes derived for each node in that plan.
A container for derived attributes.
Pretty-prints a list of scalar expressions that may have runs of column
indices as a comma-separated list interleaved with interval expressions.
A bare-minimum implementation of
ExprHumanizer
.A set of options for controlling the output of
Explain
implementations.Pretty-prints a list of indices.
A tracing layer used to accumulate a sequence of explainable plans.
A helper struct which will most commonly be used as the generic
rendering context type
C
for various Explain$Format
implementations.A struct created as a reflection of a
trace_plan
call.A set of indexes that are used in the explained plan.
Enums
The type of errors that may occur when an
Explain::explain
call goes wrong.Possible output formats for an explanation.
The type of object to be explained
A zero-variant enum to be used as the explanation type in the
Explain
implementation for all formats that are not supported
for Self
.Traits
A trait implemented by explanation types that can be rendered as
ExplainFormat::Dot
.A trait implemented by explanation types that can be rendered as
ExplainFormat::Json
.A trait implemented by explanation types that can be rendered as
ExplainFormat::Text
.A trait that provides a unified interface for objects that
can be explained.
A trait for humanizing components of an expression.
Functions
Render a type
t: T
as ExplainFormat::Dot
.Apply
f: F
to create a rendering context of type C
and render the given
type t: T
as ExplainFormat::Dot
within that context.Render a type
t: T
as ExplainFormat::Json
.Render a type
t: T
as ExplainFormat::Text
.Apply
f: F
to create a rendering context of type C
and render the given
tree t: T
within that context.Trace a fragment of type
T
to be emitted as part of an EXPLAIN OPTIMIZER TRACE
output.