From 64d52a14a4305fccc6b1aae100df75c03f6a3d9b Mon Sep 17 00:00:00 2001 From: Radu Berinde Date: Wed, 16 Dec 2020 17:59:49 -0500 Subject: [PATCH 1/3] sql: reimplement EXPLAIN (DISTSQL) Reimplement EXPLAIN (DISTSQL) by leveraging the explainPlan code. We emit everything that a regular EXPLAIN does, plus the diagram. Release note (sql change): EXPLAIN (DISTSQL) has a new output schema and format. --- pkg/sql/BUILD.bazel | 1 - pkg/sql/catalog/colinfo/result_columns.go | 8 -- pkg/sql/distsql_physical_planner.go | 2 +- pkg/sql/distsql_spec_exec_factory.go | 23 +-- pkg/sql/exec_factory_util.go | 26 ---- pkg/sql/explain_distsql.go | 107 -------------- pkg/sql/explain_plan.go | 158 +++++++++++++-------- pkg/sql/instrumentation.go | 12 +- pkg/sql/opt/exec/explain/result_columns.go | 12 +- pkg/sql/opt/optbuilder/explain.go | 7 +- pkg/sql/opt_exec_factory.go | 12 +- pkg/sql/plan.go | 3 +- pkg/sql/plan_columns.go | 9 +- pkg/sql/walk.go | 11 -- 14 files changed, 139 insertions(+), 252 deletions(-) delete mode 100644 pkg/sql/explain_distsql.go diff --git a/pkg/sql/BUILD.bazel b/pkg/sql/BUILD.bazel index 74e9745c2222..c69b9e167954 100644 --- a/pkg/sql/BUILD.bazel +++ b/pkg/sql/BUILD.bazel @@ -90,7 +90,6 @@ go_library( "execute.go", "executor_statement_metrics.go", "explain_bundle.go", - "explain_distsql.go", "explain_plan.go", "explain_vec.go", "export.go", diff --git a/pkg/sql/catalog/colinfo/result_columns.go b/pkg/sql/catalog/colinfo/result_columns.go index 5051eefb1c75..2503a48a3ec6 100644 --- a/pkg/sql/catalog/colinfo/result_columns.go +++ b/pkg/sql/catalog/colinfo/result_columns.go @@ -151,14 +151,6 @@ var ExplainPlanColumns = ResultColumns{ {Name: "info", Typ: types.String}, } -// ExplainDistSQLColumns are the result columns of an -// EXPLAIN (DISTSQL) statement. -var ExplainDistSQLColumns = ResultColumns{ - {Name: "automatic", Typ: types.Bool}, - {Name: "url", Typ: types.String}, - {Name: "json", Typ: types.String, Hidden: true}, -} - // ShowTraceColumns are the result columns of a SHOW [KV] TRACE statement. var ShowTraceColumns = ResultColumns{ {Name: "timestamp", Typ: types.TimestampTZ}, diff --git a/pkg/sql/distsql_physical_planner.go b/pkg/sql/distsql_physical_planner.go index f8a6689672bc..237108d3ae7f 100644 --- a/pkg/sql/distsql_physical_planner.go +++ b/pkg/sql/distsql_physical_planner.go @@ -2793,7 +2793,7 @@ func (dsp *DistSQLPlanner) wrapPlan(planCtx *PlanningCtx, n planNode) (*Physical if err := walkPlan(planCtx.ctx, n, planObserver{ enterNode: func(ctx context.Context, nodeName string, plan planNode) (bool, error) { switch plan.(type) { - case *explainDistSQLNode, *explainVecNode, *explainPlanNode: + case *explainVecNode, *explainPlanNode: // Don't continue recursing into explain nodes - they need to be left // alone since they handle their own planning later. return false, nil diff --git a/pkg/sql/distsql_spec_exec_factory.go b/pkg/sql/distsql_spec_exec_factory.go index 4e13148acb2f..262723f81d88 100644 --- a/pkg/sql/distsql_spec_exec_factory.go +++ b/pkg/sql/distsql_spec_exec_factory.go @@ -748,10 +748,6 @@ func (e *distSQLSpecExecFactory) ConstructExplain( if options.Flags[tree.ExplainFlagEnv] { return nil, errors.New("ENV only supported with (OPT) option") } - if options.Mode == tree.ExplainPlan { - // TODO(radu): all we need to do here is wrap an explainPlanNode. - return nil, unimplemented.NewWithIssue(47473, "experimental opt-driven distsql planning: explain plan") - } // We cannot create the explained plan in the same PlanInfrastructure with the // "outer" plan. Create a separate factory. @@ -761,14 +757,21 @@ func (e *distSQLSpecExecFactory) ConstructExplain( return nil, err } - // TODO(yuzefovich): make sure to return the same nice error in some - // variants of EXPLAIN when subqueries are present as we do in the old path. p := plan.(*explain.Plan).WrappedPlan.(*planComponents) - explain, err := constructExplainDistSQLOrVecNode(options, stmtType, p, e.planner) - if err != nil { - return nil, err + var explainNode planNode + if options.Mode == tree.ExplainVec { + explainNode = &explainVecNode{ + options: options, + plan: *p, + } + } else { + explainNode = &explainPlanNode{ + options: options, + flags: explain.MakeFlags(options), + plan: plan.(*explain.Plan), + } } - explainNode := explain.(planNode) + physPlan, err := e.dsp.wrapPlan(e.getPlanCtx(cannotDistribute), explainNode) if err != nil { return nil, err diff --git a/pkg/sql/exec_factory_util.go b/pkg/sql/exec_factory_util.go index 334a97d27478..bb0d4dd97a9e 100644 --- a/pkg/sql/exec_factory_util.go +++ b/pkg/sql/exec_factory_util.go @@ -111,32 +111,6 @@ func makeScanColumnsConfig(table cat.Table, cols exec.TableColumnOrdinalSet) sca return colCfg } -func constructExplainDistSQLOrVecNode( - options *tree.ExplainOptions, stmtType tree.StatementType, p *planComponents, planner *planner, -) (exec.Node, error) { - if options.Flags[tree.ExplainFlagEnv] { - return nil, errors.New("ENV only supported with (OPT) option") - } - - switch options.Mode { - case tree.ExplainDistSQL: - return &explainDistSQLNode{ - options: options, - plan: *p, - stmtType: stmtType, - }, nil - - case tree.ExplainVec: - return &explainVecNode{ - options: options, - plan: *p, - }, nil - - default: - panic(errors.AssertionFailedf("unsupported explain mode %v", options.Mode)) - } -} - // getResultColumnsForSimpleProject populates result columns for a simple // projection. It supports two configurations: // 1. colNames and resultTypes are non-nil. resultTypes indicates the updated diff --git a/pkg/sql/explain_distsql.go b/pkg/sql/explain_distsql.go deleted file mode 100644 index 2c80fd6f6cf7..000000000000 --- a/pkg/sql/explain_distsql.go +++ /dev/null @@ -1,107 +0,0 @@ -// Copyright 2017 The Cockroach Authors. -// -// Use of this software is governed by the Business Source License -// included in the file licenses/BSL.txt. -// -// As of the Change Date specified in that file, in accordance with -// the Business Source License, use of this software will be governed -// by the Apache License, Version 2.0, included in the file -// licenses/APL.txt. - -package sql - -import ( - "context" - - "github.com/cockroachdb/cockroach/pkg/sql/execinfrapb" - "github.com/cockroachdb/cockroach/pkg/sql/sem/tree" - "github.com/cockroachdb/errors" -) - -// explainDistSQLNode is a planNode that wraps a plan and returns -// information related to running that plan under DistSQL. -type explainDistSQLNode struct { - optColumnsSlot - - options *tree.ExplainOptions - plan planComponents - - stmtType tree.StatementType - - run explainDistSQLRun -} - -// explainDistSQLRun contains the run-time state of explainDistSQLNode during local execution. -type explainDistSQLRun struct { - // The single row returned by the node. - values tree.Datums - - // done is set if Next() was called. - done bool -} - -func (n *explainDistSQLNode) startExec(params runParams) error { - distSQLPlanner := params.extendedEvalCtx.DistSQLPlanner - distribution := getPlanDistribution( - params.ctx, params.p, params.extendedEvalCtx.ExecCfg.NodeID, - params.extendedEvalCtx.SessionData.DistSQLMode, n.plan.main, - ) - willDistribute := distribution.WillDistribute() - planCtx := distSQLPlanner.NewPlanningCtx(params.ctx, params.extendedEvalCtx, params.p, params.p.txn, willDistribute) - planCtx.ignoreClose = true - planCtx.stmtType = n.stmtType - planCtx.noEvalSubqueries = true - - physPlan, err := newPhysPlanForExplainPurposes(planCtx, distSQLPlanner, n.plan.main) - if err != nil { - if len(n.plan.subqueryPlans) > 0 { - return errors.New("running EXPLAIN (DISTSQL) on this query is " + - "unsupported because of the presence of subqueries") - } - return err - } - distSQLPlanner.FinalizePlan(planCtx, physPlan) - - flows := physPlan.GenerateFlowSpecs() - flags := execinfrapb.DiagramFlags{ - ShowInputTypes: n.options.Flags[tree.ExplainFlagTypes], - } - diagram, err := execinfrapb.GeneratePlanDiagram(params.p.stmt.String(), flows, flags) - if err != nil { - return err - } - - planJSON, planURL, err := diagram.ToURL() - if err != nil { - return err - } - - n.run.values = tree.Datums{ - tree.MakeDBool(tree.DBool(willDistribute)), - tree.NewDString(planURL.String()), - tree.NewDString(planJSON), - } - return nil -} - -func (n *explainDistSQLNode) Next(runParams) (bool, error) { - if n.run.done { - return false, nil - } - n.run.done = true - return true, nil -} - -func (n *explainDistSQLNode) Values() tree.Datums { return n.run.values } -func (n *explainDistSQLNode) Close(ctx context.Context) { - n.plan.close(ctx) -} - -func newPhysPlanForExplainPurposes( - planCtx *PlanningCtx, distSQLPlanner *DistSQLPlanner, plan planMaybePhysical, -) (*PhysicalPlan, error) { - if plan.isPhysicalPlan() { - return plan.physPlan.PhysicalPlan, nil - } - return distSQLPlanner.createPhysPlanForPlanNode(planCtx, plan.planNode) -} diff --git a/pkg/sql/explain_plan.go b/pkg/sql/explain_plan.go index 7e13fe72bdd9..e89671b8c3cd 100644 --- a/pkg/sql/explain_plan.go +++ b/pkg/sql/explain_plan.go @@ -12,6 +12,8 @@ package sql import ( "context" + "fmt" + "net/url" "github.com/cockroachdb/cockroach/pkg/keys" "github.com/cockroachdb/cockroach/pkg/sql/catalog/catalogkeys" @@ -19,19 +21,22 @@ import ( "github.com/cockroachdb/cockroach/pkg/sql/catalog/descpb" "github.com/cockroachdb/cockroach/pkg/sql/catalog/tabledesc" "github.com/cockroachdb/cockroach/pkg/sql/colflow" + "github.com/cockroachdb/cockroach/pkg/sql/execinfrapb" "github.com/cockroachdb/cockroach/pkg/sql/opt/cat" "github.com/cockroachdb/cockroach/pkg/sql/opt/exec" "github.com/cockroachdb/cockroach/pkg/sql/opt/exec/explain" - "github.com/cockroachdb/cockroach/pkg/sql/physicalplan" "github.com/cockroachdb/cockroach/pkg/sql/sem/tree" "github.com/cockroachdb/cockroach/pkg/sql/sessiondatapb" + "github.com/cockroachdb/errors" ) -// explainPlanNode implements EXPLAIN (PLAN); it produces the output of -// EXPLAIN given an explain.Plan. +// explainPlanNode implements EXPLAIN (PLAN) and EXPLAIN (DISTSQL); it produces +// the output of EXPLAIN given an explain.Plan. type explainPlanNode struct { optColumnsSlot + options *tree.ExplainOptions + flags explain.Flags plan *explain.Plan run explainPlanNodeRun @@ -42,15 +47,85 @@ type explainPlanNodeRun struct { } func (e *explainPlanNode) startExec(params runParams) error { - realPlan := e.plan.WrappedPlan.(*planComponents) - distribution, willVectorize := explainGetDistributedAndVectorized(params, realPlan) - ob := explain.NewOutputBuilder(e.flags) - if err := emitExplain(ob, params.EvalContext(), params.p.ExecCfg().Codec, e.plan, distribution, willVectorize); err != nil { + plan := e.plan.WrappedPlan.(*planComponents) + + // Determine the "distributed" and "vectorized" values, which we will emit as + // special rows. + + distribution := getPlanDistribution( + params.ctx, params.p, params.extendedEvalCtx.ExecCfg.NodeID, + params.extendedEvalCtx.SessionData.DistSQLMode, plan.main, + ) + ob.AddDistribution(distribution.String()) + + outerSubqueries := params.p.curPlan.subqueryPlans + distSQLPlanner := params.extendedEvalCtx.DistSQLPlanner + planCtx := newPlanningCtxForExplainPurposes(distSQLPlanner, params, plan.subqueryPlans, distribution) + defer func() { + planCtx.planner.curPlan.subqueryPlans = outerSubqueries + }() + physicalPlan, err := newPhysPlanForExplainPurposes(planCtx, distSQLPlanner, plan.main) + var diagramURL url.URL + if err != nil { + if e.options.Mode == tree.ExplainDistSQL { + if len(plan.subqueryPlans) > 0 { + return errors.New("running EXPLAIN (DISTSQL) on this query is " + + "unsupported because of the presence of subqueries") + } + return err + } + // For regular EXPLAIN, simply skip emitting the "vectorized" information. + } else { + // There might be an issue making the physical plan, but that should not + // cause an error or panic, so swallow the error. See #40677 for example. + distSQLPlanner.FinalizePlan(planCtx, physicalPlan) + flows := physicalPlan.GenerateFlowSpecs() + flowCtx := newFlowCtxForExplainPurposes(planCtx, params) + flowCtx.Cfg.ClusterID = &distSQLPlanner.rpcCtx.ClusterID + + ctxSessionData := flowCtx.EvalCtx.SessionData + vectorizedThresholdMet := physicalPlan.MaxEstimatedRowCount >= ctxSessionData.VectorizeRowCountThreshold + var willVectorize bool + if ctxSessionData.VectorizeMode == sessiondatapb.VectorizeOff { + willVectorize = false + } else if !vectorizedThresholdMet && ctxSessionData.VectorizeMode == sessiondatapb.VectorizeOn { + willVectorize = false + } else { + willVectorize = true + for _, flow := range flows { + if err := colflow.IsSupported(ctxSessionData.VectorizeMode, flow); err != nil { + willVectorize = false + break + } + } + } + ob.AddVectorized(willVectorize) + + if e.options.Mode == tree.ExplainDistSQL { + flags := execinfrapb.DiagramFlags{ + ShowInputTypes: e.options.Flags[tree.ExplainFlagTypes], + } + diagram, err := execinfrapb.GeneratePlanDiagram(params.p.stmt.String(), flows, flags) + if err != nil { + return err + } + + _, diagramURL, err = diagram.ToURL() + if err != nil { + return err + } + } + } + + if err := emitExplain(ob, params.EvalContext(), params.p.ExecCfg().Codec, e.plan); err != nil { return err } v := params.p.newContainerValuesNode(colinfo.ExplainPlanColumns, 0) rows := ob.BuildStringRows() + if e.options.Mode == tree.ExplainDistSQL { + rows = append(rows, "", fmt.Sprintf("Diagram: %s", diagramURL.String())) + } datums := make([]tree.DString, len(rows)) for i, row := range rows { datums[i] = tree.DString(row) @@ -68,11 +143,7 @@ func emitExplain( evalCtx *tree.EvalContext, codec keys.SQLCodec, explainPlan *explain.Plan, - distribution physicalplan.PlanDistribution, - vectorized bool, ) error { - ob.AddDistribution(distribution.String()) - ob.AddVectorized(vectorized) spanFormatFn := func(table cat.Table, index cat.Index, scanParams exec.ScanParams) string { var tabDesc *tabledesc.Immutable var idxDesc *descpb.IndexDescriptor @@ -109,59 +180,34 @@ func (e *explainPlanNode) Next(params runParams) (bool, error) { return e.run.re func (e *explainPlanNode) Values() tree.Datums { return e.run.results.Values() } func (e *explainPlanNode) Close(ctx context.Context) { - e.plan.Root.WrappedNode().(planNode).Close(ctx) + closeNode := func(n exec.Node) { + switch n := n.(type) { + case planNode: + n.Close(ctx) + case planMaybePhysical: + n.Close(ctx) + default: + panic(errors.AssertionFailedf("unknown plan node type %T", n)) + } + } + // The wrapped node can be planNode or planMaybePhysical. + closeNode(e.plan.Root.WrappedNode()) for i := range e.plan.Subqueries { - e.plan.Subqueries[i].Root.(*explain.Node).WrappedNode().(planNode).Close(ctx) + closeNode(e.plan.Subqueries[i].Root.(*explain.Node).WrappedNode()) } for i := range e.plan.Checks { - e.plan.Checks[i].WrappedNode().(planNode).Close(ctx) + closeNode(e.plan.Checks[i].WrappedNode()) } if e.run.results != nil { e.run.results.Close(ctx) } } -// explainGetDistributedAndVectorized determines the "distributed" and -// "vectorized" properties for EXPLAIN. -func explainGetDistributedAndVectorized( - params runParams, plan *planComponents, -) (distribution physicalplan.PlanDistribution, willVectorize bool) { - // Determine the "distributed" and "vectorized" values, which we will emit as - // special rows. - distSQLPlanner := params.extendedEvalCtx.DistSQLPlanner - distribution = getPlanDistribution( - params.ctx, params.p, params.extendedEvalCtx.ExecCfg.NodeID, - params.extendedEvalCtx.SessionData.DistSQLMode, plan.main, - ) - outerSubqueries := params.p.curPlan.subqueryPlans - planCtx := newPlanningCtxForExplainPurposes(distSQLPlanner, params, plan.subqueryPlans, distribution) - defer func() { - planCtx.planner.curPlan.subqueryPlans = outerSubqueries - }() - physicalPlan, err := newPhysPlanForExplainPurposes(planCtx, distSQLPlanner, plan.main) - if err == nil { - // There might be an issue making the physical plan, but that should not - // cause an error or panic, so swallow the error. See #40677 for example. - distSQLPlanner.FinalizePlan(planCtx, physicalPlan) - flows := physicalPlan.GenerateFlowSpecs() - flowCtx := newFlowCtxForExplainPurposes(planCtx, params) - flowCtx.Cfg.ClusterID = &distSQLPlanner.rpcCtx.ClusterID - - ctxSessionData := flowCtx.EvalCtx.SessionData - vectorizedThresholdMet := physicalPlan.MaxEstimatedRowCount >= ctxSessionData.VectorizeRowCountThreshold - if ctxSessionData.VectorizeMode == sessiondatapb.VectorizeOff { - willVectorize = false - } else if !vectorizedThresholdMet && ctxSessionData.VectorizeMode == sessiondatapb.VectorizeOn { - willVectorize = false - } else { - willVectorize = true - for _, flow := range flows { - if err := colflow.IsSupported(ctxSessionData.VectorizeMode, flow); err != nil { - willVectorize = false - break - } - } - } +func newPhysPlanForExplainPurposes( + planCtx *PlanningCtx, distSQLPlanner *DistSQLPlanner, plan planMaybePhysical, +) (*PhysicalPlan, error) { + if plan.isPhysicalPlan() { + return plan.physPlan.PhysicalPlan, nil } - return distribution, willVectorize + return distSQLPlanner.createPhysPlanForPlanNode(planCtx, plan.planNode) } diff --git a/pkg/sql/instrumentation.go b/pkg/sql/instrumentation.go index df660a92f144..9cb951fae0fa 100644 --- a/pkg/sql/instrumentation.go +++ b/pkg/sql/instrumentation.go @@ -306,7 +306,9 @@ func (ih *instrumentationHelper) PlanForStats(ctx context.Context) *roachpb.Expl ob := explain.NewOutputBuilder(explain.Flags{ HideValues: true, }) - if err := emitExplain(ob, ih.evalCtx, ih.codec, ih.explainPlan, ih.distribution, ih.vectorized); err != nil { + ob.AddDistribution(ih.distribution.String()) + ob.AddVectorized(ih.vectorized) + if err := emitExplain(ob, ih.evalCtx, ih.codec, ih.explainPlan); err != nil { log.Warningf(ctx, "unable to emit explain plan tree: %v", err) return nil } @@ -324,7 +326,9 @@ func (ih *instrumentationHelper) planStringForBundle(phaseTimes *phaseTimes) str }) ob.AddPlanningTime(phaseTimes.getPlanningLatency()) ob.AddExecutionTime(phaseTimes.getRunLatency()) - if err := emitExplain(ob, ih.evalCtx, ih.codec, ih.explainPlan, ih.distribution, ih.vectorized); err != nil { + ob.AddDistribution(ih.distribution.String()) + ob.AddVectorized(ih.vectorized) + if err := emitExplain(ob, ih.evalCtx, ih.codec, ih.explainPlan); err != nil { return fmt.Sprintf("error emitting plan: %v", err) } return ob.BuildString() @@ -340,7 +344,9 @@ func (ih *instrumentationHelper) planRowsForExplainAnalyze(phaseTimes *phaseTime ob := explain.NewOutputBuilder(ih.explainFlags) ob.AddPlanningTime(phaseTimes.getPlanningLatency()) ob.AddExecutionTime(phaseTimes.getRunLatency()) - if err := emitExplain(ob, ih.evalCtx, ih.codec, ih.explainPlan, ih.distribution, ih.vectorized); err != nil { + ob.AddDistribution(ih.distribution.String()) + ob.AddVectorized(ih.vectorized) + if err := emitExplain(ob, ih.evalCtx, ih.codec, ih.explainPlan); err != nil { return []string{fmt.Sprintf("error emitting plan: %v", err)} } return ob.BuildStringRows() diff --git a/pkg/sql/opt/exec/explain/result_columns.go b/pkg/sql/opt/exec/explain/result_columns.go index 6b8d0f3d92d4..1912c16c740a 100644 --- a/pkg/sql/opt/exec/explain/result_columns.go +++ b/pkg/sql/opt/exec/explain/result_columns.go @@ -15,7 +15,6 @@ import ( "github.com/cockroachdb/cockroach/pkg/sql/catalog/descpb" "github.com/cockroachdb/cockroach/pkg/sql/opt/cat" "github.com/cockroachdb/cockroach/pkg/sql/opt/exec" - "github.com/cockroachdb/cockroach/pkg/sql/sem/tree" "github.com/cockroachdb/cockroach/pkg/sql/types" "github.com/cockroachdb/cockroach/pkg/util/errorutil" "github.com/cockroachdb/errors" @@ -163,16 +162,7 @@ func getResultColumns( return colinfo.SequenceSelectColumns, nil case explainOp: - switch o := args.(*explainArgs).Options; o.Mode { - case tree.ExplainPlan: - return colinfo.ExplainPlanColumns, nil - case tree.ExplainDistSQL: - return colinfo.ExplainDistSQLColumns, nil - case tree.ExplainVec: - return colinfo.ExplainPlanColumns, nil - default: - return nil, errors.AssertionFailedf("unknown explain mode %v", o.Mode) - } + return colinfo.ExplainPlanColumns, nil case explainOptOp: return colinfo.ExplainPlanColumns, nil diff --git a/pkg/sql/opt/optbuilder/explain.go b/pkg/sql/opt/optbuilder/explain.go index 5af8c979b735..45cd11d1c7c2 100644 --- a/pkg/sql/opt/optbuilder/explain.go +++ b/pkg/sql/opt/optbuilder/explain.go @@ -29,15 +29,12 @@ func (b *Builder) buildExplain(explain *tree.Explain, inScope *scope) (outScope b.popWithFrame(stmtScope) outScope = inScope.push() - var cols colinfo.ResultColumns switch explain.Mode { case tree.ExplainPlan: telemetry.Inc(sqltelemetry.ExplainPlanUseCounter) - cols = colinfo.ExplainPlanColumns case tree.ExplainDistSQL: telemetry.Inc(sqltelemetry.ExplainDistSQLUseCounter) - cols = colinfo.ExplainDistSQLColumns case tree.ExplainOpt: if explain.Flags[tree.ExplainFlagVerbose] { @@ -45,16 +42,14 @@ func (b *Builder) buildExplain(explain *tree.Explain, inScope *scope) (outScope } else { telemetry.Inc(sqltelemetry.ExplainOptUseCounter) } - cols = colinfo.ExplainPlanColumns case tree.ExplainVec: telemetry.Inc(sqltelemetry.ExplainVecUseCounter) - cols = colinfo.ExplainPlanColumns default: panic(errors.Errorf("EXPLAIN mode %s not supported", explain.Mode)) } - b.synthesizeResultColumns(outScope, cols) + b.synthesizeResultColumns(outScope, colinfo.ExplainPlanColumns) input := stmtScope.expr.(memo.RelExpr) private := memo.ExplainPrivate{ diff --git a/pkg/sql/opt_exec_factory.go b/pkg/sql/opt_exec_factory.go index eac06d5fe94b..6ee325345571 100644 --- a/pkg/sql/opt_exec_factory.go +++ b/pkg/sql/opt_exec_factory.go @@ -1882,14 +1882,18 @@ func (ef *execFactory) ConstructExplain( if err != nil { return nil, err } - if options.Mode != tree.ExplainPlan { + if options.Mode == tree.ExplainVec { wrappedPlan := plan.(*explain.Plan).WrappedPlan.(*planComponents) - return constructExplainDistSQLOrVecNode(options, stmtType, wrappedPlan, ef.planner) + return &explainVecNode{ + options: options, + plan: *wrappedPlan, + }, nil } flags := explain.MakeFlags(options) n := &explainPlanNode{ - flags: flags, - plan: plan.(*explain.Plan), + options: options, + flags: flags, + plan: plan.(*explain.Plan), } return n, nil } diff --git a/pkg/sql/plan.go b/pkg/sql/plan.go index b81a98f3d98c..528fe2f4c9e3 100644 --- a/pkg/sql/plan.go +++ b/pkg/sql/plan.go @@ -167,7 +167,6 @@ var _ planNode = &dropTypeNode{} var _ planNode = &DropRoleNode{} var _ planNode = &dropViewNode{} var _ planNode = &errorIfRowsNode{} -var _ planNode = &explainDistSQLNode{} var _ planNode = &explainVecNode{} var _ planNode = &filterNode{} var _ planNode = &GrantRoleNode{} @@ -488,7 +487,7 @@ func startExec(params runParams, plan planNode) error { o := planObserver{ enterNode: func(ctx context.Context, _ string, p planNode) (bool, error) { switch p.(type) { - case *explainDistSQLNode, *explainVecNode: + case *explainVecNode: // Do not recurse: we're not starting the plan if we just show its structure with EXPLAIN. return false, nil case *showTraceNode: diff --git a/pkg/sql/plan_columns.go b/pkg/sql/plan_columns.go index 8698521b5e49..437b124e1b7e 100644 --- a/pkg/sql/plan_columns.go +++ b/pkg/sql/plan_columns.go @@ -97,8 +97,6 @@ func getPlanColumns(plan planNode, mut bool) colinfo.ResultColumns { // Nodes with a fixed schema. case *scrubNode: return n.getColumns(mut, colinfo.ScrubColumns) - case *explainDistSQLNode: - return n.getColumns(mut, colinfo.ExplainDistSQLColumns) case *explainPlanNode: return n.getColumns(mut, colinfo.ExplainPlanColumns) case *explainVecNode: @@ -160,10 +158,9 @@ func getPlanColumns(plan planNode, mut bool) colinfo.ResultColumns { return noColumns } -// optColumnsSlot is a helper struct for nodes with a static signature -// (e.g. explainDistSQLNode). It allows instances to reuse a common -// (shared) ResultColumns slice as long as no read/write access is -// requested to the slice via planMutableColumns. +// optColumnsSlot is a helper struct for nodes with a static signature. +// It allows instances to reuse a common (shared) ResultColumns slice as long as +// no read/write access is requested to the slice via planMutableColumns. type optColumnsSlot struct { columns colinfo.ResultColumns } diff --git a/pkg/sql/walk.go b/pkg/sql/walk.go index 655db39bd6dd..d67e2abbbfdb 100644 --- a/pkg/sql/walk.go +++ b/pkg/sql/walk.go @@ -225,16 +225,6 @@ func (v *planVisitor) visitInternal(plan planNode, name string) { n.plan = v.visit(n.plan) } - case *explainDistSQLNode: - // We check whether planNode is nil because the plan might be - // represented physically. We don't yet have a walker over such - // representation, so we simply short-circuit. - // TODO(yuzefovich): implement that walker and use it here. - if n.plan.main.planNode == nil { - return - } - n.plan.main.planNode = v.visit(n.plan.main.planNode) - case *explainVecNode: // We check whether planNode is nil because the plan might be // represented physically. We don't yet have a walker over such @@ -375,7 +365,6 @@ var planNodeNames = map[reflect.Type]string{ reflect.TypeOf(&DropRoleNode{}): "drop user/role", reflect.TypeOf(&dropViewNode{}): "drop view", reflect.TypeOf(&errorIfRowsNode{}): "error if rows", - reflect.TypeOf(&explainDistSQLNode{}): "explain distsql", reflect.TypeOf(&explainPlanNode{}): "explain plan", reflect.TypeOf(&explainVecNode{}): "explain vectorized", reflect.TypeOf(&exportNode{}): "export", From 5e143ac161395e6049a3ab4e6ed331775ea80c6e Mon Sep 17 00:00:00 2001 From: Radu Berinde Date: Wed, 16 Dec 2020 17:59:49 -0500 Subject: [PATCH 2/3] sql: EXPLAIN DISTSQL test changes --- pkg/sql/distsql_physical_planner_test.go | 19 +- .../experimental_distsql_planning_5node | 12 +- pkg/sql/logictest/testdata/logic_test/explain | 15 +- .../testdata/logic_test/explain_analyze_plans | 11 +- .../inverted_filter_geospatial_dist | 258 ++++- .../inverted_filter_json_array_dist | 368 ++++++- .../logic_test/inverted_join_geospatial_dist | 470 ++++++++- .../logic_test/inverted_join_json_array_dist | 359 ++++++- .../testdata/logic_test/merge_join_dist_vec | 22 +- .../opt/exec/execbuilder/testdata/distsql_agg | 805 ++++++++++++-- .../execbuilder/testdata/distsql_auto_mode | 103 +- .../execbuilder/testdata/distsql_distinct_on | 81 +- .../execbuilder/testdata/distsql_indexjoin | 66 +- .../testdata/distsql_inverted_index | 104 +- .../exec/execbuilder/testdata/distsql_join | 37 +- .../execbuilder/testdata/distsql_merge_join | 448 +++++++- .../exec/execbuilder/testdata/distsql_misc | 30 +- .../execbuilder/testdata/distsql_numtables | 232 +++- .../execbuilder/testdata/distsql_ordinality | 14 +- .../exec/execbuilder/testdata/distsql_union | 992 ++++++++++++++++-- .../opt/exec/execbuilder/testdata/geospatial | 4 +- .../testdata/inverted_filter_geospatial | 44 +- .../testdata/inverted_join_geospatial | 23 +- .../opt/exec/execbuilder/testdata/lookup_join | 125 ++- pkg/sql/opt/exec/execbuilder/testdata/window | 1 - pkg/sql/opt/optbuilder/testdata/explain | 61 -- pkg/sql/rowexec/processors_test.go | 8 +- pkg/sql/txn_restart_test.go | 6 +- 28 files changed, 4067 insertions(+), 651 deletions(-) diff --git a/pkg/sql/distsql_physical_planner_test.go b/pkg/sql/distsql_physical_planner_test.go index d55cbad756a0..29127f705d9f 100644 --- a/pkg/sql/distsql_physical_planner_test.go +++ b/pkg/sql/distsql_physical_planner_test.go @@ -499,8 +499,8 @@ func TestDistSQLDeadHosts(t *testing.T) { // Verify the plan (should include all 5 nodes). r.CheckQueryResults(t, - "SELECT url FROM [EXPLAIN (DISTSQL) SELECT sum(xsquared) FROM t]", - [][]string{{"https://cockroachdb.github.io/distsqlplan/decode.html#eJy8k09LwzAYxu9-CnlOCu9h7bo5e5rHHXQy9SQ91OalFLamJCkoo99d1iDaIskgo8f8-T2_PG1yRC0FP-UH1kjfEYEQgzAHIQFhgYzQKFmw1lKdtlhgIz6RzghV3bTmNJ0RCqkY6RGmMntGitf8Y887zgUrEASbvNr3kkZVh1x9rQ0I29ak1-sYWUeQrflJ6-h8z0NZKi5zI0eal7fHm3V0e3b0b2JbSyVYsRgEZt2F5dFE38_jCakQT1TB4wmpMJ-ogscTUiGZqILHc6mH-E_0jnUja82jBznMywgsSrZvWctWFfysZNGH2-G2391PCNbGrkZ2sKnt0ulYf-HICccDOBrDsdvsUc-ddOKGk5BzL5zw0m1ehpjvnPDKbV6FmO_d_2rmuSbuSzZ2Z93VdwAAAP__XTV6BQ=="}}, + "SELECT info FROM [EXPLAIN (DISTSQL) SELECT sum(xsquared) FROM t] WHERE info LIKE 'Diagram%'", + [][]string{{"Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJy8k09LwzAYxu9-CnlOCu9h7bo5e5rHHXQy9SQ91OalFLamJCkoo99d1iDaIskgo8f8-T2_PG1yRC0FP-UH1kjfEYEQgzAHIQFhgYzQKFmw1lKdtlhgIz6RzghV3bTmNJ0RCqkY6RGmMntGitf8Y887zgUrEASbvNr3kkZVh1x9rQ0I29ak1-sYWUeQrflJ6-h8z0NZKi5zI0eal7fHm3V0e3b0b2JbSyVYsRgEZt2F5dFE38_jCakQT1TB4wmpMJ-ogscTUiGZqILHc6mH-E_0jnUja82jBznMywgsSrZvWctWFfysZNGH2-G2391PCNbGrkZ2sKnt0ulYf-HICccDOBrDsdvsUc-ddOKGk5BzL5zw0m1ehpjvnPDKbV6FmO_d_2rmuSbuSzZ2Z93VdwAAAP__XTV6BQ=="}}, ) // Stop node 5. @@ -509,8 +509,8 @@ func TestDistSQLDeadHosts(t *testing.T) { testutils.SucceedsSoon(t, runQuery) r.CheckQueryResults(t, - "SELECT url FROM [EXPLAIN (DISTSQL) SELECT sum(xsquared) FROM t]", - [][]string{{"https://cockroachdb.github.io/distsqlplan/decode.html#eJy8k8FK7DAYhff3KS5npZCF6dRx7KouZ6Ejo64ki9j8lEKnKUkKytB3lzaItkg60qHL5M93vpySHlFpRQ_yQBbJKzgYIjCswBBDMNRGZ2StNt3YH96qdyRXDEVVN67bFgyZNoTkCFe4kpDgWb6VtCepyIBBkZNF2QtqUxyk-UgdGHaNS_6nEUTLoBv3lday0z13eW4ol06PNE8v9xcpvzw5-juxqbRRZEgNAkV7Zjlf6PtNeOZUiBaqMOGZU2G1UIUJz7le8S_Re7K1riyNXvMwTzCQysn_CFY3JqNHo7M-3C93_el-Q5F1fsr9Ylv5UXetnzAPwtEA5mM4CsK3YfMqCMdhOJ5z7esgvA6b13PMN0F4EzZv_mQW7b_PAAAA__-DuA-E"}}, + "SELECT info FROM [EXPLAIN (DISTSQL) SELECT sum(xsquared) FROM t] WHERE info LIKE 'Diagram%'", + [][]string{{"Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJy8k8FK7DAYhff3KS5npZCF6dRx7KouZ6Ejo64ki9j8lEKnKUkKytB3lzaItkg60qHL5M93vpySHlFpRQ_yQBbJKzgYIjCswBBDMNRGZ2StNt3YH96qdyRXDEVVN67bFgyZNoTkCFe4kpDgWb6VtCepyIBBkZNF2QtqUxyk-UgdGHaNS_6nEUTLoBv3lday0z13eW4ol06PNE8v9xcpvzw5-juxqbRRZEgNAkV7Zjlf6PtNeOZUiBaqMOGZU2G1UIUJz7le8S_Re7K1riyNXvMwTzCQysn_CFY3JqNHo7M-3C93_el-Q5F1fsr9Ylv5UXetnzAPwtEA5mM4CsK3YfMqCMdhOJ5z7esgvA6b13PMN0F4EzZv_mQW7b_PAAAA__-DuA-E"}}, ) // Stop node 2; note that no range had replicas on both 2 and 5. @@ -519,8 +519,8 @@ func TestDistSQLDeadHosts(t *testing.T) { testutils.SucceedsSoon(t, runQuery) r.CheckQueryResults(t, - "SELECT url FROM [EXPLAIN (DISTSQL) SELECT sum(xsquared) FROM t]", - [][]string{{"https://cockroachdb.github.io/distsqlplan/decode.html#eJy8kkFLwzAUx-9-CvmfFHIwXZ3QUz3uoJOpJ8khNo9S6JrykoIy-t2lDaItkk02dkxe_r_fe-Ht0FhDj3pLDtkbJAQWEEihBFq2BTlneSiFhyvzgexGoGrazg_XSqCwTMh28JWvCRle9HtNG9KGGAKGvK7qEd5ytdX8mXsIrDufXeYJVC9gO_9N68XhnvuyZCq1tzPN8-vDVS6vD0b_ELvGsiEmMwGq_sRyeab_2-M5ZoTkTCPs8ZxqBf5Ab8i1tnE0W4UpTwmQKSlskbMdF_TEthjh4bgeX48XhpwPVRkOqyaUhrZ-h2U0nEzCch5OouG7uHkRDafxcHpM27fR8DJuXv7LrPqLrwAAAP__vMyldA=="}}, + "SELECT info FROM [EXPLAIN (DISTSQL) SELECT sum(xsquared) FROM t] WHERE info LIKE 'Diagram%'", + [][]string{{"Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJy8kkFLwzAUx-9-CvmfFHIwXZ3QUz3uoJOpJ8khNo9S6JrykoIy-t2lDaItkk02dkxe_r_fe-Ht0FhDj3pLDtkbJAQWEEihBFq2BTlneSiFhyvzgexGoGrazg_XSqCwTMh28JWvCRle9HtNG9KGGAKGvK7qEd5ytdX8mXsIrDufXeYJVC9gO_9N68XhnvuyZCq1tzPN8-vDVS6vD0b_ELvGsiEmMwGq_sRyeab_2-M5ZoTkTCPs8ZxqBf5Ab8i1tnE0W4UpTwmQKSlskbMdF_TEthjh4bgeX48XhpwPVRkOqyaUhrZ-h2U0nEzCch5OouG7uHkRDafxcHpM27fR8DJuXv7LrPqLrwAAAP__vMyldA=="}}, ) } @@ -575,7 +575,8 @@ func TestDistSQLDrainingHosts(t *testing.T) { const query = "SELECT count(*) FROM NUMS" expectPlan := func(expectedPlan [][]string) { - planQuery := fmt.Sprintf(`SELECT url FROM [EXPLAIN (DISTSQL) %s]`, query) + t.Helper() + planQuery := fmt.Sprintf(`SELECT info FROM [EXPLAIN (DISTSQL) %s] WHERE info LIKE 'Diagram%%'`, query) testutils.SucceedsSoon(t, func() error { resultPlan := r.QueryStr(t, planQuery) if !reflect.DeepEqual(resultPlan, expectedPlan) { @@ -586,14 +587,14 @@ func TestDistSQLDrainingHosts(t *testing.T) { } // Verify distribution. - expectPlan([][]string{{"https://cockroachdb.github.io/distsqlplan/decode.html#eJyskd-Lm0AQx9_7V8g8mbKHWZO-7NMd1xSEnF7Vo4UgYesOIphduz-gJfi_F7WQGBKblj46O9_5fJw5gvneAINss908557TjfcpTV683ebr6_Ypij3_Y5Tl2eftwvvdUionrf9-MfZJdzAFEJBKYMwPaIDtgAKBEAoCrVYlGqN0Xz4OTZH4AWxJoJats325IFAqjcCOYGvbIDDI-bcGU-QCdbAEAgItr5thdM97bHV94PonEMhaLg3zHoIemTjLvFhJhKIjoJw9EYzlFQKjHbnf4qmqNFbcKh2EU4nn5C3O92nyJfMXN1nhTdYJ4aTSAjWKyfyim7dZT22yt5d9FOf-I70ts5rI0PvXT-9Zf0Af_mH9f7A4--HVf13_FVaKplXS4MUZrk9e9udBUeF4S6OcLvFVq3LAjJ_JkBsKAo0dX-n4EcnxqRc8D9PZcDgJ08twOBv-ME9ezYbX8-H1X2kX3btfAQAA__9aEHOO"}}) + expectPlan([][]string{{"Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJyskVFrnEAQx9_7KZaBkruy4W6968s-JSSWSo2makghSNi6UxF01-6u0HL43YtaSAw5ey19dHZ-8_85cwD7vQYOqR_6Vxmp1DdNPiTxDXnwv9yGl0FEVtdBmqWfwzX53VPoTrnVu_XUp7rG5uT-o5_4Ex0Gn3xydl2J0ojm7RlQUFpiJBq0wB-AAQUPcgqt0QVaq81QPoxNgfwBfEuhUm3nhnJOodAGgR_AVa5G4JCJrzUmKCSazRYoSHSiqsfRg8pFa6pGmJ9AIW2Fspycb4bIuHOcRFoh5D0F3bmnBOtEicBZT0-3uCxLg6Vw2my8ucRVfBdlj0l8n67WR7O8o1lPEZ3SRqJBOZuf98s2-7lNenfzGETZ6oIdl9nNZNjp62enrH_Dzv9h_X-wePbDu_-6_leyErStVhZfnOH1ydvhPChLnG5pdWcKvDW6GGOmz3jkxoJE66ZXNn0EanoaBJ_DbBH2ZjB7CXuL8Pvl5N0ivF-G93-lnfdvfgUAAP__wBp72w=="}}) // Drain the second node and expect the query to be planned on only the // first node. distServer := tc.Server(1).DistSQLServer().(*distsql.ServerImpl) distServer.Drain(ctx, 0 /* flowDrainWait */, nil /* reporter */) - expectPlan([][]string{{"https://cockroachdb.github.io/distsqlplan/decode.html#eJyUkM9Kw0AYxO8-xTKnVlba9LgnS60QqElNIgolyJp8hEC6G_cPKCHvLkkErVDR4843M79hO9jXBgLpdrfdZMybht0m8R07bJ_2u3UYsdlNmGbp_W7OPi2F9srNLueTT_mjzcGhdEmRPJKFOCBAztEaXZC12gxSNxrC8g1iyVGr1rtBzjkKbQiig6tdQxDI5EtDCcmSzGIJjpKcrJuxdmBdt6Y-SvMOjrSVygp2BY7YO8EirQh5z6G9--q3TlYEEfT87xvWVWWokk6bRXA6YRM_RNlzEj-ms_lZ1uo_rIRsq5WlE8655mWfc1BZ0fSnVntT0N7oYsRMz3jMjUJJ1k3XYHqEajoNA7-Hg1_Dqx_hvL_4CAAA__-lY7ge"}}) + expectPlan([][]string{{"Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJyUkF9LwzAUxd_9FOGCbJPI1j3mybFVLNZ2tpUJo0hsr6XQJjV_QBn97tJG0AkTfcy553fOIQfQrw0wSP3QX2ekFi-SXCfxHdn7j9twFURkugnSLL0PZ-TTU0grzPRi5nzCtjonuxs_8R0dBrc-mWxqXinenk-AgpAlRrxFDWwPHuQUOiUL1FqqQTqMhqB8A7agUIvOmkHOKRRSIbADmNo0CAwy_txggrxENV8AhRINr5sxdphx1am65eodKKQdF5qRS6AQW8NIJAVC3lOQ1nzla8MrBOb19O8bVlWlsOJGqrl3PGEdP0TZUxLv0unsZNfyP10J6k4KjUc9p5IXfU4Bywrdn2ppVYFbJYuxxj3jkRuFErVxV889AuFOw8DvsPcrvPwB5_3ZRwAAAP__flPAaw=="}}) // Verify correctness. var res int diff --git a/pkg/sql/logictest/testdata/logic_test/experimental_distsql_planning_5node b/pkg/sql/logictest/testdata/logic_test/experimental_distsql_planning_5node index c026dbedf80b..9cdc884e794c 100644 --- a/pkg/sql/logictest/testdata/logic_test/experimental_distsql_planning_5node +++ b/pkg/sql/logictest/testdata/logic_test/experimental_distsql_planning_5node @@ -45,9 +45,17 @@ statement ok SET experimental_distsql_planning = always query T -SELECT url FROM [EXPLAIN (DISTSQL) SELECT * FROM kv] +EXPLAIN (DISTSQL) SELECT * FROM kv ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJyk0s9q4zAQBvD7PoX5TruLjP_vwactbQqGNEnjHArBB9cagoljuZIdWoLfvUQupAlpqzZHSfPpNwOzg3qqECMdjUfXC6uTlXU7n95Zy9HDbHyVTKzfN0m6SO_Hf6y3kr9DwXqbgaEWnCb5hhTiJTww-GAIwBCCIULG0EhRkFJC7kt2OpDwZ8QuQ1k3Xbu_zhgKIQnxDm3ZVoQYi_yxojnlnKTjgoFTm5eVZtbb_40sN7l8AUPa5LWKLdvxkfUMomsPf6o2XxFir2cfuAeuq4XkJIkfUVl_prOJsEXjRCeF52n_iPbMR_a-HtnxbScwHNo3l30DObCd0FAOzOXAQA5tJzKUQ3M5NJAj-wcLdsadk2pErchof9z9AhJf0bCtSnSyoJkUhWaG41Tn9AUn1Q6v3nBIav2kG3wf9j4N_zsKu6dh_xI5uCQcXhKOvhXO-l-vAQAA__-hwaj8 +distribution: partial +vectorized: true +· +• scan + missing stats + table: kv@primary + spans: FULL SCAN +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJyk0s1K80AYBeD9dxXhrD5lQv5dZKVohUBta9OFIFnEzEsJTTNxJilKyb1LJ4vaUnW0y_k588wLZwv1WiHG6Gk2vkkm1v-7JF2kj-MLKx2NR7cL69K6n08frNUGDLXgNMnXpBA_wwODD4YADCEYImQMjRQFKSXk7spWBxL-hthlKOuma3fbGUMhJCHeoi3bihBjkb9UNKeck3RcMHBq87LSzGpz3chynct3MKRNXqvYsh0fWc8gunb_pmrzJSH2evaFu-e6WkhOkvgBlfUnfjYRtmic6Ojiado_oD3zkb2fR3Z82wkMh_bNZd9ADmwnNJQDczkwkEPbiQzl0FwODeTI_kPBTrhzUo2oFRn1x90VkPiShrYq0cmCZlIUmhmWU53TG5xUO5x6wyKp9ZH-4Oew92346iDsHof9c-TgnHB4Tjj6VTjr_30EAAD__2R3o50= # Note that we want to test DistSQL physical planning and the obvious choice # would be to use EXPLAIN (DISTSQL). However, this explain variant doesn't have diff --git a/pkg/sql/logictest/testdata/logic_test/explain b/pkg/sql/logictest/testdata/logic_test/explain index 18732411a867..09f79daf5361 100644 --- a/pkg/sql/logictest/testdata/logic_test/explain +++ b/pkg/sql/logictest/testdata/logic_test/explain @@ -3,11 +3,20 @@ statement ok CREATE TABLE t (a INT PRIMARY KEY) -# Test that EXPLAIN (DISTSQL) on a query with a subquery works. +# Hide the line with "vectorized:", which differs depending on the config. query T -SELECT url FROM [EXPLAIN (DISTSQL) SELECT * FROM (SELECT avg(a) OVER () FROM t)] +SELECT info FROM [EXPLAIN (DISTSQL) SELECT * FROM (SELECT avg(a) OVER () FROM t)] WHERE info NOT LIKE 'vectorized%' ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJyUkE1LwzAYx-9-ivA_tRLZumNOG1qlMNfZjimMHmLzMApdU5PUF0a_u6wZ6ISJHp__2y9kD_tSQyCP5_H1inWmZrdZes828dNyPksWLLhJ8lX-MA_ZMXLpA8HxlK_bQIYsXccZC0LvubAAR6MVLeSOLMQGEQqO1uiSrNXmIO2HQKLeIcYcVdN27iAXHKU2BLGHq1xNEFjJ55oykorMaAwORU5W9TDrpq2pdtJ8gCNvZWMFu0LRc-jOfQ1aJ7cEEfX879DHqlH6jcwoOiXO1nfBNArBkXZOsOnkLG7yH1xGttWNpRPYueVxX3CQ2pL_R6s7U9LS6HLA-DMdeoOgyDrvRv5IGm8dHvi9HP1anvwoF_3FZwAAAP__Ysu2sg== +distribution: local +· +• window +│ +└── • scan + missing stats + table: t@primary + spans: FULL SCAN +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJyUkF1L8zAUx--fTxEOPKyVyNZd5mpDqxbrOtuyCaMXsTmOQpfUJJ0vo99d1gx0wkQvz__tF7ID81wDgyyMw4ucVPJJkas0uSOr8GEeT6MZ8S6jLM_uY58cMmcu4B1Ovl173CfJIkyJ5zvP-gVZ3oRp6AZnSU7i6DYkgy2WVunqHcX_AVCQSuCMb9AAW0EABYVGqxKNUXov7fpAJF6BjShUsmntXi4olEojsB3YytYIDHL-WGOKXKAejoCCQMurup-1k0ZXG67fgELWcGkYOYeio6Ba-zloLF8jsKCjv4cuKynUC-phcEycLq69SeADhaS1jEzGJ3Hjv-BSNI2SBo9gp5ZHXUEBxRrdPxrV6hLnWpU9xp1J3-sFgcY6N3BHJJ21f-DXcvBjefytXHT_PgIAAP__H3zBmg== # Test that explaining a query that contains a subquery the result of which is # needed to make the physical plan is rejected. See #40677. diff --git a/pkg/sql/logictest/testdata/logic_test/explain_analyze_plans b/pkg/sql/logictest/testdata/logic_test/explain_analyze_plans index 8f50f2c2695f..0264566a5b2f 100644 --- a/pkg/sql/logictest/testdata/logic_test/explain_analyze_plans +++ b/pkg/sql/logictest/testdata/logic_test/explain_analyze_plans @@ -185,9 +185,16 @@ EXPLAIN ANALYZE (DISTSQL) EXPLAIN SELECT 1 # This query verifies support for zeroNode in DistSQL. query T -SELECT url FROM [EXPLAIN (DISTSQL) SELECT sum(k) FROM kv WHERE FALSE] +EXPLAIN (DISTSQL) SELECT sum(k) FROM kv WHERE FALSE ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJyUkF9LwzAUxd_9FOE-dRBY42OenFqxsH-u8w-MPIT2WseyZuYmIpR-d2kj6ISJPt5zzzm_5LZArwYkFNk0u1qz4Ay7WS1mbJM9LaeTfM6S67xYF3fTEfu0UNgnu1F07d7Y4222ytizNoQKODS2wrneI4HcgADF4eBsiUTW9VI7GPLqHWTKYdscgu9lxaG0DkG24LfeIEh40CYgjVPgUKHXWzM0puySJSkrX0KzoxGojoMN_quFvK4RZNrxv5Mmde2w1t66sTimFfez5EKcxoj_YFZIB9sQHiFOf0BxwKrGeDSywZW4dLYcMHFcDLlBqJB83Io45E1c9Q_8Hha_hs9_hFV39hEAAP__TsavHw== +distribution: full +vectorized: true +· +• group (scalar) +│ +└── • norows +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJyUkE1LxDAQhu_-ijCnLgS28ZiTq1YsdD9s1w-QHkI71tJuUzOJCKX_XZoeVoUVPc47eebJzAD01oKE6GmXrOINC67jbJ_dJQuWRUl0tWfkDkGzYDfpds2ad_Z4G6URe1EtIXDodIkbdUAC-QwCcg690QUSaTNFg38Qlx8gQw511zs7xTmHQhsEOYCtbYsg4UG1DmkZAocSrapbPzFklywIWfHquoYWkI8ctLPHKWRVhSDDkf_dtKoqg5Wy2izFd1t2vw4uxGmN-I8mRep15490VJxeIOeAZYXz0Ug7U-DO6MJr5nLrOR-USHbuirmIu7k1ffArLH6Fz3_A-Xj2GQAA__8VEanA # This query verifies stat collection for the tableReader and windower. query T diff --git a/pkg/sql/logictest/testdata/logic_test/inverted_filter_geospatial_dist b/pkg/sql/logictest/testdata/logic_test/inverted_filter_geospatial_dist index 3a212bcc1770..957b85f11dd4 100644 --- a/pkg/sql/logictest/testdata/logic_test/inverted_filter_geospatial_dist +++ b/pkg/sql/logictest/testdata/logic_test/inverted_filter_geospatial_dist @@ -32,10 +32,31 @@ SELECT k FROM geo_table WHERE ST_CoveredBy('MULTIPOINT((2.2 2.2), (3.0 3.0))'::g # Not distributed. query T -SELECT url FROM [EXPLAIN (DISTSQL) -SELECT k FROM geo_table WHERE ST_Intersects('MULTIPOINT((2.2 2.2), (3.0 3.0))'::geometry, geom) ORDER BY k] +EXPLAIN (DISTSQL) +SELECT k FROM geo_table WHERE ST_Intersects('MULTIPOINT((2.2 2.2), (3.0 3.0))'::geometry, geom) ORDER BY k ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJyUlNFP2z4Qx99_f4V1L7T6ea3tBG34qTDClqlQlnbaEK5Q1txYRLEz250yof7vUxIGtKiB-MHtne9zd9-znDtwv5YgYRqNo_czsrJLcpJMTsll9O18fBifkd5xPJ1NP4_75D7kpgm4RnPl0-9LJF8_RklEnL_KtUfrcOFdb-_0y3gWn0_is1mvJwaCiIHoU9ILBowEA9bv70n5IZqcRrPkgla5bvtkkhxHCTm6IDdzoKBNhmfpLTqQl8BhTqGwZoHOGVu57uqAOCtBMgq5Lla-cs8pLIxFkHfgc79EkDCrmkwwzdAOGVDI0Kf5sk77oGFUdXCV6wxLoDAtUu0kGSo4Uqr8kSlVcqZUyV7a4E1Xhisgqc5IwIjxP9E6mK8pmJV_1ON8eo0g-Zq-XnOsf6P1mJ3kS48W7ZBvCv93HpWFJUaTEZfEVaqJ86n1slYRvN1XigmmFGMvbUBQZ12xSvyWegqTlZdkxHfOQXSZwyeT6_urF7uuvrD5bWr_PJamI7GzetCl-sP0g83ajV9uPxnGWciaJe5_OePNn4PDg4fFePjMfozcWO_CZ_aefPryRqL_ipmHXVRPjfVoh-Gm5hH_f2f6_S7pE3SF0Q430u_KzNZzCphdY_PJcGZlF3huzaIu05iTmqsdGTrfnPLGiHVzVDX4FOatsGiHRSsctMNBKxy2w2ErvL8Fz9f__Q0AAP__-jPmKw== +distribution: full +vectorized: false +· +• sort +│ order: +k +│ +└── • filter + │ filter: st_intersects('01040000000200000001010000009A999999999901409A99999999990140010100000000000000000008400000000000000840', geom) + │ + └── • index join + │ table: geo_table@primary + │ + └── • inverted filter + │ inverted column: geom_inverted_key + │ num spans: 31 + │ + └── • scan + missing stats + table: geo_table@geom_index + spans: 31 spans +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJyUlFFP2zAQx9_3Kax7odW81naCNvxUGGHLVChLO21orlDW3FhEsTPbnTKhfvcpCQNa1ED84PbO_v3P_7OcW3C_lyAh-nY-PozPSO84ns6mn8d9Mo3G0fsZuSYnyeSUXKG59OmPJZKvH6MkIs5f5tqjdbjwrrd3-mU8i88n8dms1xMDQcRA9CnpBQNGggHr9_ek_BBNTqNZckErrZs-mSTHUUKOLsg1UNAmw7P0Bh3I78BhTqGwZoHOGVulbusNcVaCZBRyXax8lZ5TWBiLIG_B536JIGFWnTHBNEM7ZEAhQ5_my1r23sKoOsBlrjMsgcK0SLWTZKjgSKnyZ6ZUyZlSJXtugjddGa6ApDojASPG_0LrYL6mYFb-wY_z6RWC5Gv6cs-x_oPWY3aSLz1atEO-afz_elQWlhhNRlwSV7kmzqfWy9pF8HZfKSaYUow9NwFBnXXFKvNb7ilMVl6SEd_ZB9GlD59Mru-uXuy6-sLmN6n9-1CajsTO6kGX6vfdDzZrN3m5_WIYZyFrhrj75Yw3fw4OD-4H4-GT-GHnxngXPon35OOHNxL9F_Q87OJ6aqxHOww3PY_4653y-13kE3SF0Q435Hcps_WcAmZX2HwynFnZBZ5bs6jLNOGk5upEhs43q7wJYt0sVQd8DPNWWLTDohUO2uGgFQ7b4bAV3t-C5-tX_wIAAP__VL3gzA== # The inverted filterer handles five inverted index rows with decoded # datums, where the first column is the PK (k) and the second is the cellid @@ -62,10 +83,31 @@ replicas lease_holder # Not distributed, since both ranges of the index are on the same node, # which is also the gateway node. query T -SELECT url FROM [EXPLAIN (DISTSQL) -SELECT k FROM geo_table WHERE ST_Intersects('MULTIPOINT((2.2 2.2), (3.0 3.0))'::geometry, geom) ORDER BY k] +EXPLAIN (DISTSQL) +SELECT k FROM geo_table WHERE ST_Intersects('MULTIPOINT((2.2 2.2), (3.0 3.0))'::geometry, geom) ORDER BY k ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJyUlNFP2z4Qx99_f4V1L7T6ea3tBG34qTDClqlQlnbaEK5Q1txYRLEz250yof7vUxIGtKiB-MHtne9zd9-znDtwv5YgYRqNo_czsrJLcpJMTsll9O18fBifkd5xPJ1NP4_75D7kpgm4RnPl0-9LJF8_RklEnL_KtUfrcOFdb-_0y3gWn0_is1mvJwaCiIHoU9ILBowEA9bv70n5IZqcRrPkgla5bvtkkhxHCTm6IDdzoKBNhmfpLTqQl8BhTqGwZoHOGVu57uqAOCtBMgq5Lla-cs8pLIxFkHfgc79EkDCrmkwwzdAOGVDI0Kf5sk77oGFUdXCV6wxLoDAtUu0kGSo4Uqr8kSlVcqZUyV7a4E1Xhisgqc5IwIjxP9E6mK8pmJV_1ON8eo0g-Zq-XnOsf6P1mJ3kS48W7ZBvCv93HpWFJUaTEZfEVaqJ86n1slYRvN1XigmmFGMvbUBQZ12xSvyWegqTlZdkxHfOQXSZwyeT6_urF7uuvrD5bWr_PJamI7GzetCl-sP0g83ajV9uPxnGWciaJe5_OePNn4PDg4fFePjMfozcWO_CZ_aefPryRqL_ipmHXVRPjfVoh-Gm5hH_f2f6_S7pE3SF0Q430u_KzNZzCphdY_PJcGZlF3huzaIu05iTmqsdGTrfnPLGiHVzVDX4FOatsGiHRSsctMNBKxy2w2ErvL8Fz9f__Q0AAP__-jPmKw== +distribution: full +vectorized: false +· +• sort +│ order: +k +│ +└── • filter + │ filter: st_intersects('01040000000200000001010000009A999999999901409A99999999990140010100000000000000000008400000000000000840', geom) + │ + └── • index join + │ table: geo_table@primary + │ + └── • inverted filter + │ inverted column: geom_inverted_key + │ num spans: 31 + │ + └── • scan + missing stats + table: geo_table@geom_index + spans: 31 spans +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJyUlFFP2zAQx9_3Kax7odW81naCNvxUGGHLVChLO21orlDW3FhEsTPbnTKhfvcpCQNa1ED84PbO_v3P_7OcW3C_lyAh-nY-PozPSO84ns6mn8d9Mo3G0fsZuSYnyeSUXKG59OmPJZKvH6MkIs5f5tqjdbjwrrd3-mU8i88n8dms1xMDQcRA9CnpBQNGggHr9_ek_BBNTqNZckErrZs-mSTHUUKOLsg1UNAmw7P0Bh3I78BhTqGwZoHOGVulbusNcVaCZBRyXax8lZ5TWBiLIG_B536JIGFWnTHBNEM7ZEAhQ5_my1r23sKoOsBlrjMsgcK0SLWTZKjgSKnyZ6ZUyZlSJXtugjddGa6ApDojASPG_0LrYL6mYFb-wY_z6RWC5Gv6cs-x_oPWY3aSLz1atEO-afz_elQWlhhNRlwSV7kmzqfWy9pF8HZfKSaYUow9NwFBnXXFKvNb7ilMVl6SEd_ZB9GlD59Mru-uXuy6-sLmN6n9-1CajsTO6kGX6vfdDzZrN3m5_WIYZyFrhrj75Yw3fw4OD-4H4-GT-GHnxngXPon35OOHNxL9F_Q87OJ6aqxHOww3PY_4653y-13kE3SF0Q435Hcps_WcAmZX2HwynFnZBZ5bs6jLNOGk5upEhs43q7wJYt0sVQd8DPNWWLTDohUO2uGgFQ7b4bAV3t-C5-tX_wIAAP__VL3gzA== statement ok ALTER INDEX geo_table@geom_index EXPERIMENTAL_RELOCATE VALUES (ARRAY[2], 1152921574000000000) @@ -86,10 +128,31 @@ SELECT k FROM geo_table WHERE ST_Intersects('MULTIPOINT((2.2 2.2), (3.0 3.0))':: 7 query T -SELECT url FROM [EXPLAIN (DISTSQL) -SELECT k FROM geo_table WHERE ST_Intersects('MULTIPOINT((2.2 2.2), (3.0 3.0))'::geometry, geom) ORDER BY k] +EXPLAIN (DISTSQL) +SELECT k FROM geo_table WHERE ST_Intersects('MULTIPOINT((2.2 2.2), (3.0 3.0))'::geometry, geom) ORDER BY k ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJyUlNFP2z4Qx99_f4V1L7T6ea3tBG34qTDClqlQlnbaEK5Q1txYRLEz250yof7vUxIGtKiB-MHtne9zd9-znDtwv5YgYRqNo_czsrJLcpJMTsll9O18fBifkd5xPJ1NP4_75D7kpgm4RnPl0-9LJF8_RklEnL_KtUfrcOFdb-_0y3gWn0_is1mvJwaCiIHoU9ILBowEA9bv70n5IZqcRrPkgla5bvtkkhxHCTm6IDdzoKBNhmfpLTqQl8BhTqGwZoHOGVu57uqAOCtBMgq5Lla-cs8pLIxFkHfgc79EkDCrmkwwzdAOGVDI0Kf5sk77oGFUdXCV6wxLoDAtUu0kGSo4Uqr8kSlVcqZUyV7a4E1Xhisgqc5IwIjxP9E6mK8pmJV_1ON8eo0g-Zq-XnOsf6P1mJ3kS48W7ZBvCv93HpWFJUaTEZfEVaqJ86n1slYRvN1XigmmFGMvbUBQZ12xSvyWegqTlZdkxHfOQXSZwyeT6_urF7uuvrD5bWr_PJamI7GzetCl-sP0g83ajV9uPxnGWciaJe5_OePNn4PDg4fFePjMfozcWO_CZ_aefPryRqL_ipmHXVRPjfVoh-Gm5hH_f2f6_S7pE3SF0Q430u_KzNZzCphdY_PJcGZlF3huzaIu05iTmqsdGTrfnPLGiHVzVDX4FOatsGiHRSsctMNBKxy2w2ErvL8Fz9f__Q0AAP__-jPmKw== +distribution: full +vectorized: false +· +• sort +│ order: +k +│ +└── • filter + │ filter: st_intersects('01040000000200000001010000009A999999999901409A99999999990140010100000000000000000008400000000000000840', geom) + │ + └── • index join + │ table: geo_table@primary + │ + └── • inverted filter + │ inverted column: geom_inverted_key + │ num spans: 31 + │ + └── • scan + missing stats + table: geo_table@geom_index + spans: 31 spans +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJyUlFFP2zAQx9_3Kax7odW81naCNvxUGGHLVChLO21orlDW3FhEsTPbnTKhfvcpCQNa1ED84PbO_v3P_7OcW3C_lyAh-nY-PozPSO84ns6mn8d9Mo3G0fsZuSYnyeSUXKG59OmPJZKvH6MkIs5f5tqjdbjwrrd3-mU8i88n8dms1xMDQcRA9CnpBQNGggHr9_ek_BBNTqNZckErrZs-mSTHUUKOLsg1UNAmw7P0Bh3I78BhTqGwZoHOGVulbusNcVaCZBRyXax8lZ5TWBiLIG_B536JIGFWnTHBNEM7ZEAhQ5_my1r23sKoOsBlrjMsgcK0SLWTZKjgSKnyZ6ZUyZlSJXtugjddGa6ApDojASPG_0LrYL6mYFb-wY_z6RWC5Gv6cs-x_oPWY3aSLz1atEO-afz_elQWlhhNRlwSV7kmzqfWy9pF8HZfKSaYUow9NwFBnXXFKvNb7ilMVl6SEd_ZB9GlD59Mru-uXuy6-sLmN6n9-1CajsTO6kGX6vfdDzZrN3m5_WIYZyFrhrj75Yw3fw4OD-4H4-GT-GHnxngXPon35OOHNxL9F_Q87OJ6aqxHOww3PY_4653y-13kE3SF0Q435Hcps_WcAmZX2HwynFnZBZ5bs6jLNOGk5upEhs43q7wJYt0sVQd8DPNWWLTDohUO2uGgFQ7b4bAV3t-C5-tX_wIAAP__VL3gzA== # Data is distributed, but the filterer can't be distributed since it is not a union. query I @@ -99,10 +162,31 @@ SELECT k FROM geo_table WHERE ST_CoveredBy('MULTIPOINT((2.2 2.2), (3.0 3.0))'::g 7 query T -SELECT url FROM [EXPLAIN (DISTSQL) -SELECT k FROM geo_table WHERE ST_CoveredBy('MULTIPOINT((2.2 2.2), (3.0 3.0))'::geometry, geom) ORDER BY k] +EXPLAIN (DISTSQL) +SELECT k FROM geo_table WHERE ST_CoveredBy('MULTIPOINT((2.2 2.2), (3.0 3.0))'::geometry, geom) ORDER BY k ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJyUlFFP2zAQx9_3Kax7odW81naCNvxUGGHLVChLO20IVyjUNxZR4s52URDqd5-SMKBFDcQPbu98v7v7n-Xcg_s7BwnjaBh9npClnZOjZHRMzqNfp8P9-IR0DuPxZPx92CUPIdd1wBWaC59ezpH8_BolEXH-YmZu0aK-vOvsHP8YTuLTUXwy6XRETxDRE11KOkGPkaDHut0dKb9Eo-NokpzRMtVNl4ySwyghB2fkegoUcqPxJL1BB_IcOEwpLKyZoXPGlq77KiDWBUhGIcsXS1-6pxRmxiLIe_CZnyNImJQ9JphqtH0GFDT6NJtXaR8lDMoOLrJcYwEUxos0d5L0FRwoVfzWShWcKVWw1zb40JbhCkiaaxIwYvwftA6mKwpm6Z_0OJ9eIUi-om_XHOe3aD3qo2zu0aLt83Xh_8-jYmGJycmAS-JK1cT51HpZqQg-7irFBFOKsdc2IJjrtlgpfkM9hdHSSzLgW-cg2szhm8nyh6sX265-YbOb1N49laYDsbV60Kb64_SD9dq1X268GMZZyOolHn454_Wfvf29x8V4-MJ-ilxbn8IX9o58_vAGovuGkYdtRI-N9Wj74brkAX-_Nf1um_QJuoXJHa6l35aZraYUUF9h_cVwZmlneGrNrCpTm6OKqxwana9PeW3EeX1UNvgc5o2waIZFIxw0w0EjHDbDYSO8uwFPV-_-BQAA__-NuOUp +distribution: full +vectorized: false +· +• sort +│ order: +k +│ +└── • filter + │ filter: st_coveredby('01040000000200000001010000009A999999999901409A99999999990140010100000000000000000008400000000000000840', geom) + │ + └── • index join + │ table: geo_table@primary + │ + └── • inverted filter + │ inverted column: geom_inverted_key + │ num spans: 31 + │ + └── • scan + missing stats + table: geo_table@geom_index + spans: 31 spans +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJyUlFFP2zwUhu-_X2GdG1p9Xms7QRu-KoywZSqUpZ02NFco1GcsosSZ7aIg1P8-JWFAQQ3EF27PsZ_3-D2WcwfuzxIkRD9Ox_vxCekdxtPZ9Ou4T6bROPo4I1fkKJkck0s05z69WCL5_jlKIuL8-cLcoEV9cdvbOf42nsWnk_hk1uuJgSBiIPqU9IIBI8GA9fs7Un6KJsfRLDmjldR1n0ySwyghB2fkCijkRuNJeo0O5E_gMKdQWLNA54ytUnf1hliXIBmFLC9WvkrPKSyMRZB34DO_RJAwq46YYKrRDhlQ0OjTbFnLPjgYVQc4z3KNJVCYFmnuJBkqOFCq_KWVKjlTqmSvTfCuK8MVkDTXJGDE-N9oHczXFMzKP_pxPr1EkHxN3-45zm_QetRH2dKjRTvkm8b_rUdlYYnJyYhL4irXxPnUelm7CN7vKsUEU4qx1yYgmOuuWGX-mXsKk5WXZMS39kF06cMXk-X3Vy-2XX1hs-vU3j6WpiOxtXrQpfpD94PN2k1ePnswjLOQNUPc_3LGmz97-3sPg_HwRfy4c2N8CF_EO_LpuxuJ_htaHnYxPTXWox2Gm5ZH_P-t8rtd5BN0hckdbshvU2brOQXUl9h8MZxZ2QWeWrOoyzThpObqhEbnm1XeBHHeLFUHfArzVli0w6IVDtrhoBUO2-GwFd59Bs_X__0NAAD___MV38o= # Move all the index data that will be read to node 2 while the query executes # at node 1. The filtering moves to node 2 when it is distributable. @@ -126,10 +210,31 @@ SELECT k FROM geo_table WHERE ST_Intersects('MULTIPOINT((2.2 2.2), (3.0 3.0))':: # Filtering is placed at node 2. query T -SELECT url FROM [EXPLAIN (DISTSQL) -SELECT k FROM geo_table WHERE ST_Intersects('MULTIPOINT((2.2 2.2), (3.0 3.0))'::geometry, geom) ORDER BY k] +EXPLAIN (DISTSQL) +SELECT k FROM geo_table WHERE ST_Intersects('MULTIPOINT((2.2 2.2), (3.0 3.0))'::geometry, geom) ORDER BY k ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJyUlFFP2zAQx9_3Kax7odVMazspG34qjLBlKi1LO20IVyhrbiyi2JntTp1Qv_uUhgEFNSV-cHvn-93lf5bvDtzvOUgYR4Pow4Qs7JycJqMzchl9Px8cxUPSOonHk_GXQZvch9xUAddornz6Y47k26coiYjzV7n2aB3OvGvtnX0dTOLzUTyctFqiI4joiDYlraDDSNBh7faelB-j0Vk0SS5omeu2TUbJSZSQ4wtyMwUK2mQ4TG_RgbwEDhQETCkU1szQOWNL9906KM6WIBmFXBcLX7qnFGbGIsg78LmfI0gYmn1TdHtAIUOf5vN12IqCWfhHyPn0GkEerOiTxLw-8aTsQIJphrbLNtLDQ4P6pbyrXGe4BArjItVOkq6CY6WWPzOllpwptWS7NthvynAFJNUZCRgx_hdaB9s08yaaY_0HrcfsNJ97tGi7fFP4__NoWVhiNOlzSVypmjifWi_XKoJ3PaWYYEoxtmsDgjpripXin6mnMFp4Sfp8ax9Ekz58Nrm-v3qx7eoLm9-m9u9jadoXW6sHTao_dD_YrF355fP3yDgLWbXE_S9nvPpzeHT4sBgPX9iPkRvrffjC3pNPn3VftF_R87CJ6rGxHm033NTc52-3pu9tpN8xJxJ0hdEOXzUo2GpKAbNrrGaRMws7w3NrZusylTlac2tHhs5XpweVEevqqPzApzCvhUU9LGrhoB4OauGwHg5r4V493KuF2TN4unrzLwAA___ICRhW +distribution: full +vectorized: false +· +• sort +│ order: +k +│ +└── • filter + │ filter: st_intersects('01040000000200000001010000009A999999999901409A99999999990140010100000000000000000008400000000000000840', geom) + │ + └── • index join + │ table: geo_table@primary + │ + └── • inverted filter + │ inverted column: geom_inverted_key + │ num spans: 31 + │ + └── • scan + missing stats + table: geo_table@geom_index + spans: 31 spans +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJyUlFFP2zwUhu-_X2GdG1p9prWdlA1fFUbYMpWWpZ02NFcoa85YRLEz2506of73KQ0DAmogvnB7jv2ck_e17Ftwv5YgIfp6PjqKx6RzEk9n00-jLplGo-jdjFyT02RyRq7QXPr0-xLJlw9REhHnL3Pt0TpceNfZO_s8msXnk3g863RETxDRE11KOkGPkaDHut09Kd9Hk7NollzQstZNl0ySkyghxxfkGihok-E4vUEH8htwoCBgTqGwZoHOGVumb7eb4mwNklHIdbHyZXpOYWEsgrwFn_slgoSx2TdFfwAUMvRpvtxu21AwK_8AOZ9eIciDDX1UmDcXnpUGJJhmaPusVh7u_RmW6i5zneEaKEyLVDtJ-gqOlVr_yJRac6bUmr00wX5bhisgqc5IwIjxP9E62KWZt9Ec699oPWan-dKjRdvndeH_1qN1YYnRZMglcaVq4nxqvdyqCN4MlGKCKcXYSxMQ1FlbrBT_RD2FycpLMuQ7fRBtfPhocn139GLX0Rc2v0ntn4fWdCh2dg_adL93P6j3rvLy6XVknIWsGuLulzNe_Tk8OrwfjIfP4oedtfE2fBbvyce3eii6r_A8bKN6aqxH2w_rmof8_53lB7XyL7wTCbrCaIeveijYZk4Bsyus3iJnVnaB59Ystm2qcLLltokMna9WD6og1tVS-YGPYd4Ii2ZYNMJBMxw0wmEzHDbCg2Z40AizJ_B889_fAAAA___nMRL3 query I SELECT k FROM geo_table WHERE ST_CoveredBy('MULTIPOINT((2.2 2.2), (3.0 3.0))'::geometry, geom) ORDER BY k @@ -139,35 +244,128 @@ SELECT k FROM geo_table WHERE ST_CoveredBy('MULTIPOINT((2.2 2.2), (3.0 3.0))'::g # Filtering is at gateway node since the filter is not distributable. query T -SELECT url FROM [EXPLAIN (DISTSQL) -SELECT k FROM geo_table WHERE ST_CoveredBy('MULTIPOINT((2.2 2.2), (3.0 3.0))'::geometry, geom) ORDER BY k] +EXPLAIN (DISTSQL) +SELECT k FROM geo_table WHERE ST_CoveredBy('MULTIPOINT((2.2 2.2), (3.0 3.0))'::geometry, geom) ORDER BY k ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJyUlNFP2z4Qx99_f4V1L7T6mdZ2Ujb8VBhhy1RalnbaEK5QqG8sosSZ7aIi1P99SsOAghqIH9ze-T53-Z7luwf3Zw4SxtEg-jQhCzsnx8nohJxHP08HB_GQtI7i8WT8bdAmDyHXVcAVmgufXs6R_PgSJRFx_mJmbtGivrxr7Zx8H0zi01E8nLRaoiOI6Ig2Ja2gw0jQYe32jpSfo9FJNEnOaJnqpk1GyVGUkMMzcj0FCrnROExv0IE8Bw4UBEwpFNbM0DljS_f9OijWS5CMQpYXC1-6pxRmxiLIe_CZnyNIGJpdU3R7QEGjT7P5OmxFwSz8E-R8eoUg91b0WWJen3hSNiDBVKPtso308NiffinvIss1LoHCuEhzJ0lXwaFSy19aqSVnSi3ZWxvsNmW4ApLmmgSMGP8brYNtmnkTzXF-i9ajPs7mHi3aLt8U_u88WhaWmJz0uSSuVE2cT62XaxXBh55STDClGHtrA4K5boqV4l-opzBaeEn6fGsfRJM-fDVZ_nD1YtvVFza7Se3dU2naF1urB02qP3Y_2Kxd-eWL58g4C1m1xMMvZ7z6s3-w_7gYD1_ZT5Eb62P4yt6Rz191X7Tf0fKwieixsR5tN9yU3Of_b03f20j_xphI0BUmd_iuOcFWUwqor7AaRc4s7AxPrZmty1TmaM2tHRqdr073KiPOq6PyA5_DvBYW9bCohYN6OKiFw3o4rIV79XCvFmYv4Onqv78BAAD__9HCF1Q= +distribution: full +vectorized: false +· +• sort +│ order: +k +│ +└── • filter + │ filter: st_coveredby('01040000000200000001010000009A999999999901409A99999999990140010100000000000000000008400000000000000840', geom) + │ + └── • index join + │ table: geo_table@primary + │ + └── • inverted filter + │ inverted column: geom_inverted_key + │ num spans: 31 + │ + └── • scan + missing stats + table: geo_table@geom_index + spans: 31 spans +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJyUlFFP2zAQx9_3Kax7odVMazspG34qjLBlKi1LO21orlCobyyixJntoiLU7z6lYUBBDcQPbu_s3__yP8u-A_d3DhKin6eDg3hIWkfxeDL-NmiTcTSIPk3IFTlORifkEs25Ty_mSH58iZKIOH8-MzdoUV_ctnZOvg8m8ekoHk5aLdERRHREm5JW0GEk6LB2e0fKz9HoJJokZ7SUum6TUXIUJeTwjFwBhdxoHKbX6ED-Ag4UBEwpFNbM0Dljy_TdelOslyAZhSwvFr5MTynMjEWQd-AzP0eQMDS7puj2gIJGn2bz9bYVBbPwj5Dz6SWC3FvRJ8K8XnhS-k8w1Wi7bEMeHtrTL92dZ7nGJVAYF2nuJOkqOFRq-VsrteRMqSV7bYLdpgxXQNJck4AR4_-gdbDNM2_iOc5v0HrUx9nco0Xb5ZvG_69Hy8ISk5M-l8SVronzqfVy7SL40FOKCaYUY69NQDDXTbHS_DP3FEYLL0mfb-2DaNKHrybL749ebDv6wmbXqb19LE37Ymv1oEn1h-4Hm7WrvHx2GxlnIauGuP_ljFd_9g_2Hwbj4Yv4cefG-Bi-iHfk00vdF-03tDxsYnpsrEfbDTct9_n7rfK9DflXnokEXWFyh296J9hqSgH1JVZPkTMLO8NTa2brMlU4WnPrhEbnq9W9Kojzaqn8wKcwr4VFPSxq4aAeDmrhsB4Oa-FePdyrhdkzeLp69y8AAP__-8wR9Q== # Bounding box operations. statement ok SET CLUSTER SETTING sql.spatial.experimental_box2d_comparison_operators.enabled = on query T -SELECT url FROM [EXPLAIN (DISTSQL) -SELECT k FROM geo_table WHERE geom && 'POINT(3.0 3.0)'::geometry] +EXPLAIN (DISTSQL) +SELECT k FROM geo_table WHERE geom && 'POINT(3.0 3.0)'::geometry ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJyUk99v2jAQx9_3V1j30lZyi53ANvmJ_Ui3TBQYIG1TjaoM31i0YGe2M2VC_O9Tkq4UKkLJw0n343OX71m3Bvc7AwHTaBC9m5HCZuR6Mroht9HX8eBNPCTn7-PpbPp5cEHuS341BUs0dz75niH58jGaRJW_IrJgLHjZWHI2HsXD2Xl4xUh4xS7OhPgQjW6i2eTbHChoo3CYrNCBuAUOFAKYU8itWaBzxlbhdV0UqxIEo5DqvPBVeE5hYSyCWINPfYYgYGguTd7pAgWFPkmzumxDwRR-CzmfLBFEb0MfNebtjWeVwgkmCm2H7bSHhwX0K-l3qVZYAoVpnmgnSEfCWynLH0rKkjMpS3bMwOWpDJdAEq1IyIjxP9E6OKSZn6I51n_QelTXaebRou3wXeH_81GZW2I06XNBXKWaOJ9YL2oV4auelCxgUjJ2zABBrU7FKvF76imMCi9Inx_cQ3DKHj6ZVN8_fXDo6XObrhL7dzua9oOD08NTpj9sP9yd3cQF6Qd718Y44-zp97r7xD8T21N8xtK6O7995BIn6HKjHT7rFNlmTgHVEptrd6awCxxbs6jHNO6o5uqAQuebbK9xYt2kqh98DPNWOGiHg1Y4bIfDVrjbDndbYbYHzzcv_gUAAP__PV_M9g== +distribution: full +vectorized: false +· +• filter +│ filter: geom && '010100000000000000000008400000000000000840' +│ +└── • index join + │ table: geo_table@primary + │ + └── • inverted filter + │ inverted column: geom_inverted_key + │ num spans: 31 + │ + └── • scan + missing stats + table: geo_table@geom_index + spans: 31 spans +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJyUk29v0z4Qx5__XoV1T7pJ3mon7Q_kR-VPBkFdW9pKgHA1hfooEa0dbAcFVX3vKAlsS6emxA9Oujt_7vw96_bgfmxBQPRxNn4RT8jF63ixXLwfX5JFNI5eLcl3cjOf3pINmjuffNki-fA2mkelvyMyZyz4v7akN5vGk-VFeM1IeM0ue0K8iaa30XL-CShoo3CS7NCB-AwcKASwopBZs0bnjC3D--pSrAoQjEKqs9yX4RWFtbEIYg8-9VsEARNzZbL-ACgo9Em6ra4dKJjcP0DOJxsEMTzQR4V5e-FlKXCOiULbZ43ycK9_VCq_S7XCAigsskQ7QfoSXkpZfFVSFpxJWbBzBq66MlwCSbQiISPGf0Pr4JRm3kVzrH-i9ahu0q1Hi7bPm8L_5qMis8RoMuKCuFI1cT6xXlQqwmdDKVnApGTsnAGCWnXFSvFH6ilMcy_IiJ-cQ9BlDu9Mqv98fXDq6zOb7hL766E1HQUnu4ddut9PP2z2ruOCjIKjZWOccfb0PB888XuisYnnhjZoPPvMJs7RZUY7_KdVZIcVBVQbrLfdmdyucWbNumpTu9OKqwIKna-zw9qJdZ0qH_gY5q1w0A4HrXDYDoet8KAdHrTC7AheHf77HQAA__-eq8eX query T -SELECT url FROM [EXPLAIN (DISTSQL) -SELECT k FROM geo_table WHERE 'POINT(3.0 3.0)'::geometry::box2d && geom] +EXPLAIN (DISTSQL) +SELECT k FROM geo_table WHERE 'POINT(3.0 3.0)'::geometry::box2d && geom ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJyUk99v2jAQx9_3V1j3Qiu5wk5gm_zEWFONiUEHSEOqUZXhG4sW7Mx2pkyI_31K0rWlLaHJw0n343OX71m3A_c7BQHzaBx9XJDcpuRqNv1CbqLl9fjDaELOLkfzxfzr-JzclfyqCzZobn38PUXy7VM0i0iHccbZ8-9975nfEWI4XQaXROaMBW9rWzbcroCCNgon8RYdiBvgQCGAFYXMmjU6Z2wZ3lVFI1WAYBQSneW-DK8orI1FEDvwiU8RBEzMhcm6PaCg0MdJWpXtKZjcP0DOxxsE0d_TR415c-NFKX2GsULbZQft4X4zg1LSbaIVFkBhnsXaCdKVMJSy-KGkLDiTsmCnDFy0ZbgEEmtFQkaM_4nWwTHNvI3mkf6D1qO6SlKPFm2XHwr_n4-KzBKjyYAL4krVxPnYelGpCN_1pWQBk5KxUwYIatUWK8U_UU9hmntBBvzoHoI2e_hsEn339MGxp89sso3t34fRdBAcnR62mX6__fBwdh0XpDOcLs9CEtKQhOcd8eKtDYJX7KR38FcnDm2GLjPa4asuje1XFFBtsD5mZ3K7xmtr1tWY2p1WXBVQ6Hyd7dfOSNep8gcfw7wRDprhoBEOm-GwEe41w71GmD2BV_s3_wIAAP__ma7KMQ== +distribution: full +vectorized: false +· +• filter +│ filter: 'BOX(3 3,3 3)' && geom +│ +└── • index join + │ table: geo_table@primary + │ + └── • inverted filter + │ inverted column: geom_inverted_key + │ num spans: 31 + │ + └── • scan + missing stats + table: geo_table@geom_index + spans: 31 spans +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJyUk9Fv2j4Qx99_f8XpXmglV9gJ_Db5ibGmGhODDpCGNKMqwzcWDezMNlMmxP8-Jdna0o5Q_HDS3flz5-9Zt0P_Y40Sk_nt8M1gBBfXg-ls-nF4CdNkmLydwXe4mYw_wIrsXUi_rAk-vUsmCbS44II_P687z_yWlP3xPLoGteU8-r-2ZcENMjRW0yjdkEf5GQUyjHDBMHd2Sd5bV4Z31aWBLlByhpnJt6EMLxgurSOUOwxZWBNKHNkrm7c7yFBTSLN1dW3P0G7DA-RDuiKU3T17VFg0F56VyieUanJtflAe7wfTKxXdZUZTgQyneWq8hLbCvlLFV61UIbhSBT9l8OpcRiiE1GiIOdjwjZzHY5rFOZoH5ie5QPomWwdy5NriUPjffFLkDqyBnpDgS9XgQ-qCrFTEr7pK8Ygrxfkpg0BGn4uV4p-oZzjeBgk9cXQO0TlzeG8z8-fro2Nfn7tsk7pfD61ZLzraPT6n-_3048PedVxCqz-eX8QQsxjiy5b856r1ohfMpHPwqhOLNiGfW-PpRZvG9wuGpFdUL7O3W7ekW2eXVZvaHVdcFdDkQ53t1s7A1KnygY9h0QhHzXDUCMfNcNwId5rhTiPMn8CL_X-_AwAA__8rRsTS query T -SELECT url FROM [EXPLAIN (DISTSQL) -SELECT k FROM geo_table WHERE 'LINESTRING(1.0 1.0, 5.0 5.0)'::geometry ~ geom] +EXPLAIN (DISTSQL) +SELECT k FROM geo_table WHERE 'LINESTRING(1.0 1.0, 5.0 5.0)'::geometry ~ geom ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJyUlG1v2jAQx9_vU1j3hlZywU6CJvkVewhdJgpdQNqmGlUZubFowc5sM2VC7LNXSfoASIRiKY7ufL-7_M-6bMD-yUHANByFH2ZkbXIyjCc35C78djt6F43JxcdoOpt-GV2Sx5DfTcAS9b1LfuRIvn4K45B0RtE4nM7iaHx9wbuM8C6jpN9l1XPZEeI6nNyEs_g7-V-hqzlQUDrFcbJCC-IOOFDwYE6hMHqB1mpTuTd1UJSWIBiFTBVrV7nnFBbaIIgNuMzlCALG-koXvQAopOiSLK_DthT02r1A1iVLBNHf0p3EvD3xrBIZY5Ki6bG99PDcg0El6T5TKZZAYVokygrSk_BeyvJnKmXJmZQlO7XB1bkMl0ASlRLfI9r9QmPhmGZ-juZI_UXjMB1muUODpsf3hT-dh2VhiFZkwAWxlWpiXWKcqFX4b_tSMo9JydipDQiq9FysEn-gnsJk7QQZ8KN98M7pw2edqcer945dfWGyVWL-vZSmA-9odf-c6s_d9_drN35BOowzjzXr6b2zhswfttk8CNih3RF7kzrwXtHRYE_TiTGN0RZaWXzVnLLtnAKmS2x-BVavzQJvjV7UZRpzUnO1I0XrmtN-Y0SqOao-cBfmrbDXDnutsN8O-61w0A4HrTA7gOfbNw8BAAD__31t0nA= +distribution: full +vectorized: false +· +• filter +│ filter: '010200000002000000000000000000F03F000000000000F03F00000000000014400000000000001440' ~ geom +│ +└── • index join + │ table: geo_table@primary + │ + └── • inverted filter + │ inverted column: geom_inverted_key + │ num spans: 33 + │ + └── • scan + missing stats + table: geo_table@geom_index + spans: 33 spans +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJyUlG9v2j4Qx5__XoV1T2glF-wk6Cf5EfsTukwUuoC0TTOqMnxj0cDObDNlQuy1T0nWFpAIxVIc3Z0_d_meddmC-7kCAfGn-9GrZEyu3ibT2fTD6JpM41H8ZkZ-kGE6uSNLNA8--7pC8vFdnMakM0rG8XSWJuPbK95lhHcZJf0uq57rjhC38eQunqWfyZ8KXQMFbRSOszU6EF-AA4UA5hQKaxbonLGVe1sfSlQJglHIdbHxlXtOYWEsgtiCz_0KQcDY3JiiFwEFhT7LV_WxHQWz8c-Q89kSQfR3dC8xb088qzSmmCm0PXaQHp5aMKgUPeRaYQkUpkWmnSA9Ca-lLL8pKUvOpCzZuQ1uLmW4BJJpRcKAGP8drYNTmvklmhP9C61HNcxXHi3aHj8U_hiPy8ISo8mAC-Iq1cT5zHpRqwj_70vJAiYlY-c2IKjVpVgl_kg9hcnGCzLgJ_sQXNKH9ybX_64-OHX1hc3Xmf39XJoOgpPVw0uqP3U_PKzd-AXpMM4C1qzH994asnDYZvMoYsd2RxwM6iB4QUejA01nxjRFVxjt8EVzynZzCqiW2PwKnNnYBd5bs6jLNOak5mqHQuebaL8xEt2Eqg_ch3krHLTDQSsctsNhKxy1w1ErzI7g-e6_vwEAAP__M6HNEQ== query T -SELECT url FROM [EXPLAIN (DISTSQL) -SELECT k FROM geo_table WHERE geom ~ 'LINESTRING(1.0 1.0, 5.0 5.0)'::geometry::box2d] +EXPLAIN (DISTSQL) +SELECT k FROM geo_table WHERE geom ~ 'LINESTRING(1.0 1.0, 5.0 5.0)'::geometry::box2d ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJyUk9Fv2j4Qx99_f4V1L7SSK-wk6Kf5ibEGjYlBB0hDqlGV4RuLFuzMNlMmxP72KQltAYlQ8uDozvfx-fu1bgvuVwYCpvEw_jAjG5uR_mT8mTzG84fh-8GI3NwPprPpl-Et2Zf8rAtWaJ588i1D8vVjPInLeE3-khbjLGD19_w_-Pos7DfFPIrYadwSojeeB_cLoKCNwlGyRgfiEThQCGBBIbdmic4ZW6a3VdFAFSAYhVTnG1-mFxSWxiKILfjUZwgCRubO5O0IKCj0SZpVZTsKZuNfIeeTFYLo7OjBwbz54FnpywQThbbNjo6HF9u6pWFPqVZYAIVpnmgnSFtCT8riu5Ky4EzKgl1a4O5ahksgiVYkeEeM_4HWwTnN_BrNA_0brUfVTzOPFm2bHwt_3o-L3BKjSZcL4krVxPnEelGpCP_vSMkCJiVjlxYgqNW1WCn-RD2F8cYL0uVnfQiu8eGTSfX-6YNzT5_bdJ3YP6-taTc42z28pvuL--Fx7zovSDcoZ7Q3nt9wwmmHdG5bYj9ebzAiOrrKhemaoMuNdvim8WK7BQVUK6wn2JmNXeKDNcuqTR2OK65KKHS-3u3UwUDXW-UFD2HeCAfNcNAIh81w2AhHzXDUCLMTeLH7718AAAD__8h-zLQ= +distribution: full +vectorized: false +· +• filter +│ filter: geom ~ 'BOX(1 1,5 5)' +│ +└── • index join + │ table: geo_table@primary + │ + └── • inverted filter + │ inverted column: geom_inverted_key + │ num spans: 30 + │ + └── • scan + missing stats + table: geo_table@geom_index + spans: 30 spans +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJyUk9-LGjEQx9_7V4R5uTvIYZJdKc2TtbdSi9WrChUaObZmapdqsk1i2SL2by-72zt_gGvdhywzyWcm32-YLfifK5CQzB4Hb_tDcvvQn0wnnwZ3ZJIMkndT8oP0xqOPZIn2KaRfV0g-v0_GSRmvyR9ywzgTrP6e_wdfj0W9ppjHMTuNb6TsjmbiASgYq3GYrtGD_AIcKAiYU8idXaD31pXpbXWorwuQjEJm8k0o03MKC-sQ5BZCFlYIEob23uatGChoDGm2qo7tKNhN2EM-pEsE2d7Rg8K8ufC0tGWMqUbXYkfl4cW1TunXU2Y0FkBhkqfGS9JS0FWq-KaVKjhTqmCXFri_luEKSGo0EW-IDd_ReTinmV-juW9-oQuoe9kqoEPX4sfCn_eTInfEGtLhkvhSNfEhdUFWKqLXbaWYYEoxdmkBgkZfi5XiT9RTGG2CJB1-1gdxjQ8fbGb-Pb049_S5y9ap-71vTTvibPfomu4v7kfHveu8JB1Rjmh3NLvlhNM2ad_dyP10XTIiPrrKhekao8-t8fhf48V2cwqol1hPsLcbt8BHZxdVmzocVVyV0OhDvduug76pt8oLHsK8ERbNsGiEo2Y4aoTjZjhuhNkJPN-9-hsAAP___rvHVQ== diff --git a/pkg/sql/logictest/testdata/logic_test/inverted_filter_json_array_dist b/pkg/sql/logictest/testdata/logic_test/inverted_filter_json_array_dist index 2349175b125d..ef51c92fecf9 100644 --- a/pkg/sql/logictest/testdata/logic_test/inverted_filter_json_array_dist +++ b/pkg/sql/logictest/testdata/logic_test/inverted_filter_json_array_dist @@ -81,82 +81,260 @@ ALTER TABLE json_tab VALIDATE CONSTRAINT check_c # Filter with a scalar. query T -SELECT url FROM [EXPLAIN (DISTSQL) -SELECT a FROM json_tab WHERE b @> '1' ORDER BY a] +EXPLAIN (DISTSQL) +SELECT a FROM json_tab WHERE b @> '1' ORDER BY a ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJysUl-L00AQf_dTDPNyinsku6kv-1T1IhZqW5OCyhlk2x3PSNyNuxs5OPrdpZuKjdTYk3sJ2ZnfP37MHfrvDUos83n-cg2da-BVsXwD1_n71fz5bAGPr2blunw7fwIHiOoBX701n4LawLvXeZHDBqYfuzTNCC74BSyLq7yAFx9AVcjQWE0L9Y08ymvkyFAgwwwrhq2zW_Leuv3qLgJn-hZlyrA2bRf6cahDQyjROk2ONDLUFFTdRL0pf4rVrmK4tY5Q_kYv7KVtk8kAXe0Y2i4clCuGPqgbQpnt2JE7P3I_IbxWm4YKUppckg7D_CplGn9q8wMZlq0yXkLC04Rfxm-ycvS5vs2NBmU0cLDhCzlkuOyChCnHv8Xk94lZWhfIJeJUXaflxUBenN8CP78FEVsQD9fCP2IeWsj-t4V0XL4g31rj6awrS_dnSvqG-rP2tnNbWjm7jTb9cxl5caDJh377rH_MTL_aBzwm81GyGCeLUXI6IPM_ydkoeTLuPLmXc7V79DMAAP__bMeAtQ== +distribution: full +vectorized: true +· +• sort +│ order: +a +│ +└── • scan + missing stats + table: json_tab@json_inv + spans: 2 spans +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJysUt2KEzEUvvcpDudmFbNMkqk3uaq6IxZqW2cKKjpI2hzXkZqMSUYWlr67NLNiR-rYFW9Czs_3w8e5xfBthwqLt6v509kCHl7NqnX1ev4IqmJePF-Dhhfl8hV8Cc5-jHoDb14WZQEbmH7oOM8JLsQFLMurooRn70AjQ-sMLfRXCqjeo0CGEhnmWDNsvdtSCM4fRrdpcWZuUHGGjW272LdjE3eECp035MkgQ0NRN7vENxWPsd7XDLfOE6pf2wt36dpsMtiu9wxdF--Ya4Yh6mtCle_Zkbo4Uj9BvNabHZWkDfmMD838zGSaPo39jgyrVtugIBM8E5fpzVaePjU3hTWgrQEBLn4mjwyXXVQwFfgnm-I-NivnI_lMnorrNL0c0MvzUxDnpyBTCvL_pfAXm3cp5P-aAh-nLym0zgY668r44UzJXFN_1sF1fksr77ZJpi-XCZcahkLsp0_6Ymb70cHgMViMguU4WI6C-QAsfgfno-DJuPLkXsr1_sGPAAAA__-G2ntW # Filter with fully-specified arrays. query T -SELECT url FROM [EXPLAIN (DISTSQL) -SELECT a FROM json_tab WHERE b @> '[1, 2]' OR b @> '[3, 4]' ORDER BY a] +EXPLAIN (DISTSQL) +SELECT a FROM json_tab WHERE b @> '[1, 2]' OR b @> '[3, 4]' ORDER BY a ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJyUUlFv0zwUff9-xdV92fZhFDtBmuSnDJaJSGUtSSVATYTc-jKCgh1sZ6pU9b-jJGxQUAt7se4995yTc6Ts0H9rUWKZzbJXS-hdCzfF_A2ssveL2VV-C-fXebks384u4AdFTYQv3pqPQa3h3eusyOB8DWnVc54QnK0Eg7g-u4B5cYgnDF5M-HVWwMsPoGpkaKymW_WVPMoVCqwZds5uyHvrBmg3EnK9RckZNqbrwwDXDDfWEcodhia0hBKXat1SQUqTizgy1BRU0462D2nTcWjMPTIsO2W8hEjw6Mq5SDx_nKKFo0_NNjMalNFwCTZ8JueR4bwPElLB0hjrPUPbh59xfFB3hFLs2b9Hzs09uUD6pmkDOXKROMz9cM-2nQNrIBUS_JAbfFAuyAovq4pzPjzJ4yT-H9542hHI6L8TRYUwtk3-aHu0avyUqqV1gVwUHxZMxbOj9slT7AvynTWeDuyPOfN9zZD0HU0_mLe929DC2c34mWmdj7oR0OTDdBXTkpvpNAT8VSxOiuPT4vikOPlNXO__-x4AAP__WygsbA== +distribution: local +vectorized: false +· +• sort +│ order: +a +│ +└── • inverted filter + │ inverted column: b_inverted_key + │ num spans: 4 + │ + └── • scan + missing stats + table: json_tab@json_inv + spans: 4 spans +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJyUUmFv0zAQ_c6vON2XbWAUO0Ga5E8ZLBORylqSSoCWCLn1MYKCHWxnqlT1v6Mk2qCgFvrldPfu3vN7krfof7QoMfu4mF3lt3B-nZfL8v3sAspslr1ZgoKbYv4OvnlrPge1gg9vsyKD8xWkVc95QnB2JxjE9dkFzIt9PGHwasKvswJefwKFDI3VdKu-k0d5hwJrhp2za_LeugHajge53qDkDBvT9WGAa4Zr6wjlFkMTWkKJS7VqqSClyUUcGWoKqmlH2Uez6dg05gEZlp0yXkIkeHTlXCRePnXRwtGXZpMZDcpouAQbvpLzyHDeBwmpYGmM9Y6h7cMvOz6oe0Ipduz_LefmgVwgfdO0gRy5SOz7ftxnm86BNZAKCX7wDT4oF2SFl1XFOR9K8tSJ50ONpxmBjP73oagQxrTJX2kPRo1PiVpaF8hF8X7AVLw4KJ-cIl-Q76zxtCd_SJnvaoak72n6YN72bk0LZ9fjM9M4H3kjoMmHaSumITfTajD4O1kcJcfHyfFRcvIHud49-xkAAP__grwnDQ== # Filter with a path ending in an empty object. query T -SELECT url FROM [EXPLAIN (DISTSQL) -SELECT a FROM json_tab WHERE b @> '{"a": {}}' ORDER BY a] +EXPLAIN (DISTSQL) +SELECT a FROM json_tab WHERE b @> '{"a": {}}' ORDER BY a ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJzMVFFv0zwUff9-xdV92YcwSpxsIPwUYJmoNNaSVgK0RMitLyMo2MV2pkpV_jtKsmlNWbPtAYmXKL73nHtOjnWzRferQoHz9Dx9t4DaVnCWTT_AZfp5dv5mcgH_n07mi_nH82dwA5E94Icz-quXS_j0Ps1SWEKS12EYExxtc5Q5Ctg2zRFMs9M0g7dfQBbIUBtFF_InORSXyJFhhAxjLBiurVmRc8a2rW0HnKgNipBhqde178u-9BWhwFobq8iSQoaKvCyrtl80BcOVsYTiDnpaOl_qlQ-OB1hMWvlp7QUkHIuGoan9jU7B0Hl5RSjihh3wco_S3FhPNjjZ13l-cPzxYDwfH7-Qy4oykopsEA41bu8i6V5KfY0M52upnYCAh0F3H8G2ebF7CGaWvpWbVCuQWgEH47-TvcuEJdFB3_wpvif6mqwndVZWnizZIBqav-2nm7UFoyHhAlxrHpyX1oscX8k8D8OwffDXOQJptVcVOcLuZ7iD1qOB9ejxkfPHRx7tRh79jcgf8P1H5PG_E_kDS5SRWxvtaG-x758ctgtP6or6v4MztV3RzJpVJ9Mfpx2vKyhyvu_y_jDRfas1uEvmo-SX4-RolByPk-NRcjgg833y8Sj5ZFz55EnKRfPf7wAAAP__VywBrA== +distribution: full +vectorized: false +· +• sort +│ order: +a +│ +└── • inverted filter + │ inverted column: b_inverted_key + │ num spans: 2 + │ + └── • scan + missing stats + table: json_tab@json_inv + spans: 2 spans +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJzMVFFv0zwUff9-xdV92YcwSpysIPwUoJmoVNaSVgJEIuTWlxFU7GI7U6Uq_x0lYVpT1mx7QOIliu-5556TY93s0f3coMD043z6anIJ_48ni-Xi_fQJLNJp-mYJEi6y2Tv47oz-4uUKPrxNsxRWkORVGMYEZ_scZY4C9nV9BrNsnGbw-hNIZKiNokv5gxyKz8iRYYQMYywYbq1Zk3PGNtC-bZyoHYqQYam3le_KvvQbQoGVNlaRJYUMFXlZbhq8qAuGa2MJxW3ruHS-1GsfnPd6MWnkZ5UXkHAsaoam8r91CobOyytCEdfshJc7lBbGerLB6Fjn6cnx573xfHj8Uq42lJFUZIOwr3FzFUn7UuprZLjYSu0EBDwM2usI9vWzw0Mwt_S13KVagdQKOBj_jextJiyJTvrmj_E90ddkPamLcuPJkg2ivvkbPN1tLRgNCRfgGvPgvLRe5PhC5nkYhs2Dv8wRSKujqsgRDj_DnbQe9axHD4-cPzzy6DDy6G9Efo_vPyKP_53I71mijNzWaEdHi3335LBZeFJX1P0dnKnsmubWrFuZ7jhreW1BkfMdyrvDRHdQY_CQzAfJz4fJ0SA5HibHg-SwR-bH5PNB8mhYefQo5aL-71cAAAD__xdB_D4= # Filter with a path ending in an empty array. query T -SELECT url FROM [EXPLAIN (DISTSQL) -SELECT a FROM json_tab WHERE b @> '{"a": []}' ORDER BY a] +EXPLAIN (DISTSQL) +SELECT a FROM json_tab WHERE b @> '{"a": []}' ORDER BY a ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJzMVE9vm04Qvf8-xWgu-VXdChbs_uFEWxPVkhun2FJbGVStvaOUiu66u0sUyeK7V0AiGzcmidRDL4ideW_e462GHdpfJUa4SGbJ-yVUpoTzdP4RVsmXy9nb6QX8P5kulotPs2dwCxEd4IfV6psTa_j8IUkTWEOcVb4fEpztMhQZRrDK6zOYp5MkhXdfQeTIUGlJF-InWYxWyJFhgAxDzBlujd6Qtdo0rV0LnMobjHyGhdpWriu7wpWEEVZKG0mGJDKU5ERRNv28zhlutCGM9tBJYV2hNs4b9bAYN_LzykUQc8xrhrpytzo5Q-vEFWEU1uyEl3uUFto4Mt74WOf5yfGj3ng-PH4p1iWlJCQZz-9r3N1F3L4U6hoZLrZC2Qg87nvtfXir_MX-sKtBKAkctPtOZp8Ei4OTbvlT3E7VNRlH8rwoHRkyXtC3fNdPbrYGtIKYR2Aby2CdMC7K8JXIMt_3mwd_nSGQkkfVNxnC4WfYk9aDnvXg8UHzxwcdHAYd_L2gH3D7R9DhvxP0AwuTkt1qZeloie-f7DfLTfKKuj-B1ZXZ0KXRm1amO85bXluQZF3X5d1hqrpWY_CQzAfJL4fJwSA5HCaHg2S_R-bH5NEgeTysPH6Scl7_9zsAAP__S4D5cQ== +distribution: full +vectorized: false +· +• sort +│ order: +a +│ +└── • inverted filter + │ inverted column: b_inverted_key + │ num spans: 2 + │ + └── • scan + missing stats + table: json_tab@json_inv + spans: 2 spans +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJzMVF1v0zAUfedXXN2XgTBKnGx8-ClAM1GprCOtBKiJkFtfjaBiF9uZJlX57ygJU5uyZpvEAy9RfM8995wc62aL7tcaBaZfLidvxxfwdDSezWefJs9glk7S93OQcJ5NP8IPZ_Q3L5fw-UOapbCEJK_CMCY42eYocxSwKOoTmGajNIN3X0EiQ20UXcif5FAskCPDCBnGWDDcWLMi54xtoG3bOFY3KEKGpd5Uviv70q8JBVbaWEWWFDJU5GW5bvCiLhiujCUUu9ZR6XypVz447fVi0shPKy8g4VjUDE3l_-gUDJ2XV4QirtkRL3cozYz1ZIOzQ53nR8ef9sbz4fFzuVxTRlKRDcK-xu1VJO1Lqa-R4WwjtRMQ8DBoryNYFC92h20NUivgYPx3srskWBIddcsf43asr8l6Uufl2pMlG0R9y7d4erOxYDQkXIBrLIPz0nqR4yuZ52EYNg_-OkcgrQ6qb3KE_c9wR61HPevRw4PmDw862g86-ndB3-P2r6Dj_yfoexYmI7cx2tHBEt89OWyWm9QVdX8CZyq7oktrVq1Md5y2vLagyPkO5d1hrDuoMbhP5oPkl8PkaJAcD5PjQXLYI_ND8ukg-WxY-exRykX95HcAAAD__3dB9BI= # Filter with a nested array. This index expression is not tight. query T -SELECT url FROM [EXPLAIN (DISTSQL) -SELECT a FROM json_tab WHERE b @> '[[1, 2]]' OR b @> '[[3, 4]]' ORDER BY a] +EXPLAIN (DISTSQL) +SELECT a FROM json_tab WHERE b @> '[[1, 2]]' OR b @> '[[3, 4]]' ORDER BY a ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJyUk29vmz4Qx5__XsXpnrT9zRMYUlXyI9qVaqm6poNI25SgyQm3jonazDZVpijvfQLSbnQNSh6AfH8-d1_7dGu0P0sUmMY38bsp1KaEq2TyAWbx57ub8_EtHF-O02n68eYEtimyS_hhtfrq5AI-vY-TGI4XEM1r3w8JjmYzziDIsqMTmCQvIiGD0TZyGSdw8QVkhgyVzulWPpBFMUOOGcPK6CVZq03jWrcJ43yFwmdYqKp2jTtjuNSGUKzRFa4kFDiVi5ISkjkZz0eGOTlZlG3ZJ8VReyjUIzJMK6msAI_73rkx7cff9izvztC3YhWrHKTK4Qy0-07GIsNJ7QREnEUBZhuGunZ_ZFkn7wkF37D9pY_VIxlH-VVROjJkPN7X_xSPV5UBrSDiAmyjH6yTxok5ns3nvu83v_CVE_-_-QedjUAqPwThc4T2BcJ_XmDn9YNDrn-tC7UdXLBjcJUpHqT5td_bh4c0T7VxZLyw3zjib3aWHx1S_nmko36Dzi_gOApeWR8hxHU6ub3o1qifst2j55Q9pnF6iOKEbKWVpZ7eXZX9TcaQ8nvqdtXq2izpzuhl26YzJy3XOnKyrovyzhirLtQI_Bvmg3AwDAeDcDgMh4PwaBgeDcKnL-Bs89_vAAAA__9Mybuj +distribution: local +vectorized: false +· +• filter +│ filter: (b @> '[[1, 2]]') OR (b @> '[[3, 4]]') +│ +└── • sort + │ order: +a + │ + └── • index join + │ table: json_tab@primary + │ + └── • inverted filter + │ inverted column: b_inverted_key + │ num spans: 4 + │ + └── • scan + missing stats + table: json_tab@json_inv + spans: 4 spans +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJyUk9Fv2j4Qx99_f8XpXkp_85Q4oarkp7RrqlExYAnSNkE0GXLrMlE7s03FhPjfpyS0W7oSwUMi350_d1_f6bZof65QYPx5MrwajKB3M0in6cfhOaTxMH43BQm3yfgD_LBafXVyAZ_ex0kMvQVE87XvhwRnsxlnEGTZ2TmMkxeRkEF_H7mJE7j-AhIZKp3TSD6QRTFDjhnD0uglWatN5drWFwb5BoXPsFDl2lXujOFSG0KxRVe4FaHAqVysKCGZk_F8ZJiTk8WqTvskOKoPhXpEhmkplRXgcd-7Mqb--NuW5U0MfSs2scpBqhwuQbvvZCwyHK-dgIizKMBsx1Cv3R9Z1sl7QsF37HjpA_VIxlF-W6wcGTIeb-t_iseb0oBWEHEBttIP1knjxBwv53Pf96tf-MqJ_1_9g8ZGIJWfgvA5Qt2B8J8OHHx-cMrz73Sh9oMLDgyuNMWDNL-O6314SvFUG0fGC9uFI_7mYPr-KemfR9pvF2j8AnpR8Mr2CCHu0vHoutmi9pX9Gj1fOWIaF6coTsiWWllq6T2U2d9lDCm_p2ZXrV6bJU2MXtZlGnNcc7UjJ-uaKG-MgWpClcC_Yd4JB91w0AmH3XDYCfe74X4nfPECznb__Q4AAP__3TS2RA== # Combine predicates with OR. query T -SELECT url FROM [EXPLAIN (DISTSQL) -SELECT a FROM json_tab WHERE b @> '[1]' OR b @> '[2]' ORDER BY a] +EXPLAIN (DISTSQL) +SELECT a FROM json_tab WHERE b @> '[1]' OR b @> '[2]' ORDER BY a ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJzUVNFu0zAUfecrru7LNjBKnLQg5SmDZqJSWUtaCVAbIbe-jKBgF9uZKk39d5Rk65ayppvECy-Wfe859xznKL5B-7vACKfJKHk_g9IUcJGOP8I8-TIZnQ8v4XQwnM6mn0ZncAsRDeCn1eqbE0v4_CFJEzhdQrwofT8kOJnz7OQMxmm7GDTFQZLCu68gMmSotKRL8YssRnPkyDBAhiFmDNdGr8habarWTQ0cyg1GPsNcrUvXlF3uCsIIS6WNJEMSGUpyIi-qfrbNGK60IYzuoYPculytnNdrYTGu5MeliyDmmG0Z6tLd6mQMrRNXhFG4ZQe8PKI01caR8fr7Oq8Oju-1xvPu8TOxLCglIcl4flvjLpq43uTqGhlO10LZCDzue-fGePz1budNDH3PN4mSIJQEDtr9IHP_NVgcHHTMn-N4qK7JOJIXeeHIkPGCtu27frJZG9AKYh6BrWyDdcK4aIFvFwvf96sl3O34y2oNmjMCKXkcyBcIDy9rD14waF0weHok_OmRBLtIgn8eyRHHf0US_m-RHPkJU7JrrSztPQyPT_arB4PkFTWvi9WlWdHE6FUt0xzHNa8uSLKu6fLmMFRNqzL4kMw7yW-6yUEnOewmh51kv0Xm--ReJ7nfrdx_lnK2ffEnAAD__9gUEyw= +distribution: full +vectorized: false +· +• sort +│ order: +a +│ +└── • inverted filter + │ inverted column: b_inverted_key + │ num spans: 2 + │ + └── • scan + missing stats + table: json_tab@json_inv + spans: 2 spans +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJzUVNFv0z4Qfv_9Fad72fbDKHHSguSnDJqJSmUtaSVAa4Tc-hhBxS62M1Wa-r-jJKxbyppuEi-8WPbdffd9l0-5W3Q_Vygw_TQZnQ8v4XQwnM6mH0ZnME1H6dsZSLjIxu_huzP6i5cL-PguzVI4XUAyL8MwJji54vnJGYyzdjBqgoM0gzefQSJDbRRdyh_kUFwhR4YRMowxZ7i2ZknOGVulbuvCodqgCBkWel36JuwLvyIUWGpjFVlSyFCRl8WqyufbnOHSWEJxXzoonC_00ge9Vi0mFf249AISjvmWoSn9b56cofPymlDEW3ZAyyNMU2M92aC_z_PiYPteqz3vbj-TixVlJBXZIGxz3DmT1JdC3yDD6VpqJyDgYXBubcBf7m7BxNLXYpNqBVIr4GD8N7L3X4Ml0UHF_DmKh_qGrCd1Uaw8WbJB1JZ9l083awtGQ8IFuEo2OC-tF3N8PZ-HYVgd8e7G_6_OqHkjkFbHC_kc4eGw7uCAUWvA6OmW8KdbEu0sif66JUcU_2FJ_K9ZcuQnzMitjXa0txge7xxWC4PUNTXbxZnSLmlizbKmaZ7jGlcHFDnfZHnzGOomVQl8COad4Ffd4KgTHHeD405w2ALzfXCvE9zvZu4_iznf_vcrAAD___KFDc0= # Combine predicates with OR. query T -SELECT url FROM [EXPLAIN (DISTSQL) -SELECT * FROM json_tab WHERE b @> '[3]' OR b @> '[[1, 2]]' ORDER BY a] +EXPLAIN (DISTSQL) +SELECT * FROM json_tab WHERE b @> '[3]' OR b @> '[[1, 2]]' ORDER BY a ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJyUU91u00wQvf-eYjQ3_fkW2WunIO2VW-qKVCEJdiRAiYWceChG7q7ZXVdBUd4d2W4CBtmQm9X8nTlndjQ7NN8KFBiHk_D1AipdwF00ewvL8MN8cj2ewvntOF7E7yYX8Fxy2RZ8NUp-suka3r8JoxDO1xCsKtf1Cc6WfnJ2AbOoG1xyBl7SZm7DCG4-QpogQ6kymqaPZFAskWPCsNRqQ8YoXYd2TcE426JwGeayrGwdThhulCYUO7S5LQgFLtJ1QRGlGWnHRYYZ2TQvmrYHsUFj5PIJGcZlKo0Ah7vOtdaO_-JoOXNNn_NtKDNIZQZXoOwX0gYZziorIOAs8DDZM1SV_SnH2PSBUPA9-3fJY_lE2lJ2lxeWNGmHd3Uf8uG21KAkBFyAqXWDsam2YoWvVivXdevHP1r8sn5ftj4CyezvhXyF0Ezr_TFt76jeKaPeq1w-L8frWU6p88dUf-_8Mwv8Xn7_FP5YaUva8bvcAf-_t_3olPbHDY66BG1cwHngdQ9ECHEfz6Y37aF0sodLOZb0Srw6RWJEplTSUEdgX2d3nzCk7IHaGzSq0huaa7VpaFp31uCaQEbGtlneOmPZpmqBv4L5INgbBnuDYH8Y7A-CR8Pg0SD46jdwsv_vRwAAAP__eUGvYw== +distribution: local +vectorized: false +· +• filter +│ filter: (b @> '[3]') OR (b @> '[[1, 2]]') +│ +└── • sort + │ order: +a + │ + └── • index join + │ table: json_tab@primary + │ + └── • inverted filter + │ inverted column: b_inverted_key + │ num spans: 3 + │ + └── • scan + missing stats + table: json_tab@json_inv + spans: 3 spans +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJyUU02P0zAQvfMrRnPZD4wSJ12QfMoumxVdlbYklQC1EXKbYQnq2sF2V0VV_ztKQgsBJdCLNV9v3huPZof22xoFxh-mo-vhGM5vh-ksfTe6gDQexa9ncAl3yeQtfLVafXJyCe_fxEkM50uIFhvfDwnO5mF2dgGTpB2ccwZB1mRu4wRuPoJEhkrnNJaPZFHMkWPGsDR6RdZqU4V2dcEw36LwGRaq3LgqnDFcaUModugKtyYUOJPLNSUkczKejwxzcrJY120PWqPaKNQTMkxLqawAj_vetTFe-OJoeVNDn4ttrHKQKocr0O4LGYsMJxsnIOIsCjDbM9Qb90uOdfKBUPA9-3_JQ_VExlF-V6wdGTIeb-s-5ONtaUAriLgAW-kG66RxYoGvFgvf96snPFr8snpfNj4CqfzfhXyBUE8b_DVt56jBKaPe60L9XE7QsZzSFI_SfG_9M4vCTv7wFP5UG0fGC9vcEX_e2X5wSvvjBgdtgiYu4DwK2vchhLhPJ-Ob5k5a2cOhHEs6JV6dIjEhW2plqSWwq7O_zxhS_kDNDVq9MSuaGr2qaRp3UuPqQE7WNVneOEPVpCqBv4N5LzjoBwe94LAfHPaCB_3gQS_46g9wtn_2IwAA___7DKoE # More complex combination. query T -SELECT url FROM [EXPLAIN (DISTSQL) +EXPLAIN (DISTSQL) SELECT a FROM json_tab WHERE (b @> '[1]'::json OR b @> '[2]'::json) AND (b @> '3'::json OR b @> '"bar"'::json) -ORDER BY a] +ORDER BY a ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJyUklGL00AUhd_9FZf7slscSSZFhHnKrs1ipTY1Kag0Qaad6xqJM3VmshRK_7sk2aWN0uq-hJl77ndyDswe3a8aBebJLHm7hMbWcJelH2CVfF7MbqZzuJ5M82X-cTaCxxXZL_xwRn_1cg2f3iVZAtfXa4iLJgzHBFcrXl4J8T5P57cjSDMYaNFRG8HNfDJEx2fBAtfSFngCp9kkyeD2C8gSGWqjaC5_kkOxQo4lw601G3LO2Ha07xamaociZFjpbePbcclwYyyh2KOvfE0ocCnXNWUkFdkgRIaKvKzqzvapdNwdKv2ADPOt1E5AwMPgMeKrk3OwsPSt2iVagdQKOAfjv5N1yDBtvICYszjC8sDQNP6YyXl5Tyj4gf1_7ql-IOtJ3VW1J0s24MPwT3qy21owGmIuwLXhwXlpvSjwTVGEYdh-eFGEUdQ2OE4QSKt_bEUFQlf09V89z5aMnlMyN9aTDaJhtZi_PGs_fo59Rm5rtKOB_Tnn8FAyJHVP_ftyprEbWliz6X7TX9OO6waKnO9V3l-mupfagKcwvwhHl-HoIjz-Ay4PL34HAAD___dnP8Y= +distribution: local +vectorized: false +· +• sort +│ order: +a +│ +└── • inverted filter + │ inverted column: b_inverted_key + │ num spans: 6 + │ + └── • scan + missing stats + table: json_tab@json_inv + spans: 6 spans +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJyUklGL00AUhd_9FZf7si2OZCZFhHnKrs1ipTY1Kahsgkw71zVSZ-rMdCmU_ndJ4tJGad19CTP33O_kHJg9-l9rlJh-nk-vJzMYjCfFovg4HUKRTtO3C1Bwm2cf4Ie35mtQS_j0Ls1TGAyWkJRbzkcEV3eiupLyfZHNboaQ5dDT4qM2hOvZuI-OzoIlLpUr8QTO8nGaw80XUMjQWE0z9ZM8yjsUWDHcOLsi761rRvt2YaJ3KDnD2my2oRlXDFfWEco9hjqsCSUu1HJNOSlNLuLIUFNQ9bq1feyctIfaPCDDYqOMlxAJHv1J-OrkHM0dfat3qdGgjAYhwIbv5DwyzLZBQiJYEmN1YGi34ZjJB3VPKMWBPT33xDyQC6Rv63UgRy4S_fCPerrbOLAGEiHBN-HBB-WCLPFNWXLOm48oSx7HTYPjBIGM_s9WXCK0RV__0_Nsyfg5JQvrArko7ldLxMuz9qPn2OfkN9Z46tmfc-aHiiHpe-rel7dbt6K5s6v2N901a7l2oMmHThXdZWI6qQl4CouLcHwZji_Co7_g6vDidwAAAP__rm46Zw== # Combined with non-JSON predicates. query T -SELECT url FROM [EXPLAIN (DISTSQL) -SELECT a FROM json_tab WHERE b @> '[1]' AND a % 2 = 0 ORDER BY a] +EXPLAIN (DISTSQL) +SELECT a FROM json_tab WHERE b @> '[1]' AND a % 2 = 0 ORDER BY a ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJy0k--K00AUxb_7FJcLsi3OkkzSVhkQWm0WC7WtaUGlBpk21yUSM3VmIgtL312a1NpId7ZV_DZ_7u-ckxzmHs33HAXOo3H0egGlzuEmnr6FZfRhNh6MJtAajuaL-btxG_Yjsh74alTx2coVvH8TxRG0VtD_VPp-SHC15MlVGwaTIbRaEp5C0IaX4LdhGg-jGF59BJkgw0KlNJHfyKBYIkeGATIMMWG40WpNxii9u7qvBkfpHQqfYVZsSlsf28zmhAKVTklTigxTsjLLK70-f4bJNmG4VppQ_J6eqGu18XqN6WTLUJV2r5wwNFbeEorOlh258yP3E8ILucopJpmS9vxmmF-_ql8tsuIHMpxvZGEEeNz3Blp7_Pqw8maavmR3UbH7pGlpBfQ5PhSRXxLxJsstadJe0MxXnwto9fmuLSHEaLJ4UZW2Xz_oH1ziP1fakvY6p6o6LR825IPzG-DnNxAcGgj-vYFHIh4aCP9TA4_47xvo_m0Dvls-JrNRhaGzXpe_e56U3lL9nI0q9ZpmWq0rm3o7rbjqICVj69vn9WZU1Fe7gMcwd8KBGw6ccOiGQyfsN2D-J9xxwl23c9cJ99xw76LYyfbJzwAAAP__jDL5yA== +distribution: full +vectorized: true +· +• sort +│ order: +a +│ +└── • filter + │ filter: (a % 2) = 0 + │ + └── • scan + missing stats + table: json_tab@json_inv + spans: 1 span +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJy0k--K00AUxb_7FJcLsi3OkkyyrTIgtNosFmpb04LKGmTaXJdIzcSZiSwsfXdJUmsj3dlW8dv8-51zksO9R_N9gwKjD_PJcDyFzmi8WC7eTbqwiCbR6yVIuI5nb-GrUflnK1fw_k0UR9BZweBT6fshwcUNTy66MJyOoNOR8BSCLrwEvwuzeBTF8OojSGSYq5Sm8hsZFDfIkWGADENMGBZarckYpaur-_rhOL1D4TPM8qK0zbHN7IZQoNIpaUqRYUpWZptab8CfYbJNGK6VJhS_X0_VpSq8fut1smWoSrtTThgaK28JxdWWHbjzA_cjwku52lBMMiXt-e0wv_7UoF5k-Q9kuChkbgR43PeGWnv8cr_y5pq-ZHdRXn3SrLQCBhwfisjPiXidbSxp0l7QztecC-gMeFWWEGI8Xb6oO9utH_QPzvFfKG1Je1fHqjouH7bkg9Mb4Kc3EOwbCP69gUci7hsI_1MDj_jvGuj9bQO-Wz4mU6jc0EnT5VfjSektNeNsVKnXNNdqXds021nN1QcpGdvcPm8247y5qgIewtwJB244cMKhGw6dsN-C-Z_wlRPuuZ17TrjvhvtnxU62T34GAAD__2_w9Gk= # The split disjunction rule allows us to use the index for this query. query T -SELECT url FROM [EXPLAIN (DISTSQL) -SELECT a FROM json_tab WHERE b @> '[1]' OR a = 44 ORDER BY a] +EXPLAIN (DISTSQL) +SELECT a FROM json_tab WHERE b @> '[1]' OR a = 44 ORDER BY a ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJy8lF9vmzwUxu_fT2Gd96Kt5goMJGmRJqVbmZapazoSaZsyNDnBa5lSzGwztYry3Scgy9_GJk3WO8D-nfPY53mYgPw1Bh96wVXwto9yMUbvwu5HNAi-3FxddK7R8WWn1-99ujpBsy202vBT8vS7okP0-X0QBuh4iNrfctt2GToakOjoBHVDdEzRa-R5xfNlEKI3XxGNAEPKY3ZN75kEfwAEMDiAwYUIQyb4iEnJRbE0KTd24gfwbQxJmuWq-BxhGHHBwJ-AStSYgQ99OhyzkNGYCcsGDDFTNBmX5f_KbGciuafiETD0MppKH1med2p5nvU_YOjmykdtgtsORFMMPFeLZlLRWwY-meL6gnpcKCas1qqWNnm1tby3S_nLRKokHSmL2OsdisOImAkWFwdaa7eoMHxEd1TebdDRdCGpsVXSog6vej11Tq1u16B7PpKtF9Y8uLprfsozi3gr27e1b620J_X9Sbb4s3xI0t9LBiW2dSGERU7nT9aNYD-ShyCNa9yQs4vEDzxJZwpdY4JqxMXdpfksLo3nxsVQfm67sxdLCzloWsiB0-LUt6tT367O3K7O_nY1SFyyq3d4uxqaz-zafK5dDeXncz9_Mbs6B7Wr8w9_7k80DpnMeCpZrf-2XUhn8S2rjip5LkbsRvBR2aZ67ZZc-SFmUlWrpHrppNVSIXAZJlrY0cPOOkyW4fMVmOwGE28f2tXDrvbQhs6e_rob-itraOmmHm5q4ZYebmnhMz18ts-k9bBp0nraMOnzfSZNDMkyRUufLWIIF9mw-CruGvANk-8yMgNtmpkBNwyN6CO23jua_vcnAAD__0dAjWk= +distribution: full +vectorized: true +· +• distinct +│ distinct on: a +│ order key: a +│ +└── • sort + │ order: +a + │ + └── • union all + │ + ├── • index join + │ │ table: json_tab@primary + │ │ + │ └── • scan + │ missing stats + │ table: json_tab@json_inv + │ spans: 1 span + │ + └── • scan + missing stats + table: json_tab@primary + spans: [/44 - /44] +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJy8lF9v2jwUxu_fT2Gd96Kt5ipxEqCNNIluzTQmBiwgbVMXTYZ4bSYaZ7aZWiG--5SE8bfYobDeOXF-5zz2eZ5MQf4agw_Bl177qtVBp9et_qD_qX2G-kE7eDtAFL0Lux_RT8nT74oO0ef3QRig0yFqfpvYtsvQyQ2JTs5QN0SnFL1Gnpevr4MQvfmKKGBIecw69J5J8G-AAAYHMLgQYcgEHzEpuci3psWHrfgBfBtDkmYTlb-OMIy4YOBPQSVqzMCHAR2OWchozIRlA4aYKZqMi_J_VTYzkdxT8QgY-hlNpY8szzu3PM_6HzB0J8pHTYKbDkQzDHyils2korcMfDLD1QX1uVBMWI11LU3yamd5b5_y14lUSTpSFrE3O-SHETETLM4PtNFuWWH4iO6ovNuio9lSUm2npGUdXvZ66pxa3a5B92IkOy-sfnR1HX7OM4t4a5_vat9Ya0-q-5Ps8GexSNLfKwYltnUlhEXOFyurJ9iP5CFI4wo35Owj8QNP0rlC15igCnFx92k-j0vtuXExlF_Y7uLF0kKOmhZy5LQ41e3qVLers7Crc7hdDRJX7Ood366G5nO71p9rV0P5xdwvX8yuzlHt6vzDn_sTjUMmM55KVum_befSWXzLyqNKPhEj1hN8VLQpH7sFV7yImVTlLikfWmm5lQtchYkWdvSwswmTVfhyDSb7wcQ7hHb1sKs9tKGzp7_umv7Kalq6rofrWrihhxta-EIPXxwyaT1smrSeNkz68pBJE0OyTNHSZ4sYwkW2LL6OuwZ8y-T7jMxAm2ZmwA1DI_qIbfaOZv_9CQAA___7R4gK # We cannot use the index for this query. query T -SELECT url FROM [EXPLAIN (DISTSQL) -SELECT a FROM json_tab WHERE b @> '[1]' OR sqrt(a::decimal) = 2 ORDER BY a] +EXPLAIN (DISTSQL) +SELECT a FROM json_tab WHERE b @> '[1]' OR sqrt(a::decimal) = 2 ORDER BY a ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJyUkd3qm0AQxe_7FMPc_A1siWvvFgrmw1CLiakG2pJK2egQLMY1uyu0BN-9qC2JhZT2cs6cs_Pj7A3NtUKBaRAFqwO0uoJNEm_hGHzaR4twB846TA_ph2gGvyxyNHwzqv5q5Qk-vguSAJwT-F9a131D8HLk2csM4gQcc9XWkUKsg1W4XUQzeAtev1kHCSw_g8yQYa0K2skLGRRH5JgxbLTKyRile-k2GMLiOwqXYVk3re3ljGGuNKG4oS1tRSjwIE8VJSQL0nMXGRZkZVkNz_6G9RtdXqT-gQzTRtZGwGtkGLdWgM-Z72HWMVStvR8xVp4JBe_Yv4NsysqSJj3nU4pRF-D43rQsIcT7NN4tH0rz-bQ1cR_vxE9xvf_BTcg0qjY0gX32sttlDKk40_g3RrU6p71W-XBmHOMhNwgFGTtu-TiE9bjqAR_D_K9h749w1r36GQAA___a4Ni9 +distribution: full +vectorized: true +· +• filter +│ filter: (b @> '[1]') OR (sqrt(a::DECIMAL) = 2) +│ +└── • scan + missing stats + table: json_tab@primary + spans: FULL SCAN +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJyUkd_Km0AQxe_7FMPcfAa2xLV3CwXzx1CLiakG2pJK2egQLMY1uyu0BN-9qJTEQkq_yzlnz8yPszc01woFBl_20SLcgbMO00P6KZpBGkTB6gASNkm8hR9G1d-tPMHnD0ESgHMC_1vruu8IXo48e5lBnIBjrto6Uoh1sAq3i2gG78HrnXWQwPIrSGRYq4J28kIGxRE5ZgwbrXIyRuleug0PwuInCpdhWTet7eWMYa40obihLW1FKPAgTxUlJAvScxcZFmRlWQ1r_7D6jS4vUv9ChmkjayPgLTKMWyvA58z3MOsYqtbejxgrz4SCd-z_QTZlZUmTnvMpxagLcHxv2pUQ4mMa75YPnfl8Wpq4j3fip7jea3ATMo2qDU1gn212u4whFWca_8aoVue01yofzoxjPOQGoSBjR5ePQ1iPVg_4GOb_DHt_hbPuze8AAAD__3Di014= statement ok INSERT INTO array_tab VALUES @@ -185,35 +363,129 @@ NULL /10 {1} 1 /20 NULL {3} 3 query T -SELECT url FROM [EXPLAIN (DISTSQL) -SELECT a FROM array_tab WHERE b @> '{}' ORDER BY a] +EXPLAIN (DISTSQL) +SELECT a FROM array_tab WHERE b @> '{}' ORDER BY a ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJy0k1Fr2z4Uxd__n0Lcl_7HVGzZyQp68ra4LOAlnZ2xjcYUxboUgyd5klw6gr_7sN2tc9a4LWMvAune3z0nJ757sN8q4JDFSfx2QxpTkfN0_Z5cxp8vktfLFfl_scw22YfkBblrEUODMEZ8v3JiRz69i9OY7Ei0bXw_RHKyb0_IOl3EKXnzhYgcKCgtcSW-ogV-CQwoBEAhhJxCbXSB1mrTlfZ941LeAvcplKpu3PDsSlchcGiUNhINSqAg0Ymy6up5m1MotEHg962L0rpSFc6bjXoh6uTXjeMkYpC3FHTj7nRyCtaJawQetvSIlweUMm0cGm9-qPPy6PjZaDybHr8RuwpTFBKN5481fv0HkTDmqlQ3QCGrhbKceMw_9ZjvrT4mSX_c_2oaBUedsec4W6obNA7leVk5NGi8YGzvZz2-rQ3RikSME9vZI6gk38J2G56dDQeQo5aCkaXg6WGxp4cV-Kde8JdhPeLsj7DCfx_WIx9uirbWyuLBMj082e-WDOU1DhtpdWMKvDC66GWG67rn-geJ1g1VNlyWaih1Bn-H2ST8ahoOJuFwGg4nYX8Es0N4NgnPp5Xnz1LO2_9-BAAA__8dCNL7 +distribution: full +vectorized: false +· +• sort +│ order: +a +│ +└── • inverted filter + │ inverted column: b_inverted_key + │ num spans: 1 + │ + └── • scan + missing stats + table: array_tab@arr_inv + spans: 1 span +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJy0k9Fv0zAQxt_5K6x7GQhPiZOWSX4K0ExUCu1IigDRaHLj0xQp2MF2pqEq_ztKAoyUNduE9mLJvvvd9_Vrbg_2ewUc4s8XyevlijxfLLNN9iF5QbI4id9uiCDn6fo9EcaIH5dO7Mind3Eakx2Jto3vh0hO9u0JWaeLOCVvvhABFJSWuBLf0AL_CgwoBEAhhJxCbXSB1mrTlfZ941LeAPcplKpu3PDsSlchcGiUNhINSqAg0Ymy6up5m1MotEHgt62L0rpSFc6bjXoh6uTXjeMkYpC3FHTjfunkFKwTVwg8bOkRL3coZdo4NN78UOfl0fGz0Xg2PX4jdhWmKCQazx9r_PkLImHMZamugUJWC2U58Zh_6jHfW31Mkv64_dU0Co46Y49xtlTXaBzK87JyaNB4wdje73p8UxuiFYkYJ7azR1BJvoXtNjw7Gw4gRy0FI0vBw8NiDw8r8E-94D_DusfZP2GFTx_WPR9uirbWyuLBMt092e-WDOUVDhtpdWMKvDC66GWG67rn-geJ1g1VNlyWaih1Bv-G2ST8ahoOJuFwGg4nYX8Es0N4NgnPp5Xnj1LO22c_AwAA___3ic2c # Combined with non-Array predicates. query T -SELECT url FROM [EXPLAIN (DISTSQL) -SELECT a FROM array_tab WHERE b @> '{1}' AND a % 2 = 0 ORDER BY a] +EXPLAIN (DISTSQL) +SELECT a FROM array_tab WHERE b @> '{1}' AND a % 2 = 0 ORDER BY a ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJy0k-Fq2zAUhf_vKS4XRhOmEstOsiEYpFtcFsiSzg5sozNFiS_F4FmeJI-N4HcftkOXjFRNCvsTIul-5xwfoS2aHzkKjMN5-H4Flc7hOlp-hNvwy838araA3nQWr-JP8z7sRmQ3ILWWv--sXMPnD2EUQm8Nk2-V5wUEF1teX_ThajGFXk_CS_D78Ba8PiyjaRjBu68gE2RYqJQW8jsZFLfIkaGPDANMGJZabcgYpZujbTs4S3-h8BhmRVnZbttmNicUqHRKmlJkmJKVWd7qTfgrTOqE4UZpQvF3eqEuVTkYH0wnNUNV2Z1ywtBYeU8ohjXbc-d77keEV3KdU0QyJT3wDsM8dDWRWt9lxU9kGJeyMAIG3Bvwy-a3-fplZQVMOD4WiJ8T6DrLLWnSrfJemm5fQG_Cm7sRQswWqzftFe3-P-rvn-MfK21JD4bHLua4fHAg75_eNz-9b7_t239O308Eeug7-E99P-G_63v03L49t3xEplSFoZNejtc8PUrvqXuqRlV6QzdabVqbbrlsuXYjJWO709fdYlZ0R03AfZg7Yd8N-044cMOBE_YOYP4vPHTCI7fzyAmP3fD4rNhJ_eJPAAAA___F9u2X +distribution: full +vectorized: true +· +• sort +│ order: +a +│ +└── • filter + │ filter: (a % 2) = 0 + │ + └── • scan + missing stats + table: array_tab@arr_inv + spans: 1 span +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJy0k--K00AUxb_7FJcLsi3O0kzSVhkQutosFmq7JgUVDcu0uSyBmIkzE1FK3l2SlLWV7my7sF9K58_vnJMz3C2anzkKDL_czK9mC-hNZ_Eq_jTvQxzOw_crkHAdLT-C1Fr-ubVyDZ8_hFEIvTVMvleeFxBcbHl90YerxRR6PQkvwe_DW_D6sIymYQTvvoJEhoVKaSF_kEHxDTky9JFhgAnDUqsNGaN0c7RtL87S3yg8hllRVrbbtpnNCQUqnZKmFBmmZGWWt3oT_gqTOmG4UZpQ_Lu9UJeqHIwPbic1Q1XZnXLC0Fh5RyiGNdtz53vuR4RXcp1TRDIlPfAOw9xXNZFa32bFL2QYl7IwAgbcG_DL5rf5-mVlBUw4PhSInxPoOsstadKt8l6abl9Ab8KbpxFCzBarN-0L7f4_6O-f4x8rbUkPhsce5rh8cCDvn943P71vv-3bf0rfjwS67zt4pr4f8d_1PXpq355bPiJTqsLQSZPjNaNH6R11o2pUpTd0o9WmtemWy5ZrN1Iytjt93S1mRXfUBNyHuRP23bDvhAM3HDhh7wDm_8NDJzxyO4-c8NgNj8-KndQv_gYAAP__ZXjoOA== # The split disjunction rule allows us to use the index for this query. query T -SELECT url FROM [EXPLAIN (DISTSQL) -SELECT a FROM array_tab WHERE b @> '{1}' OR a = 1 ORDER BY a] +EXPLAIN (DISTSQL) +SELECT a FROM array_tab WHERE b @> '{1}' OR a = 1 ORDER BY a ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJy0k29r2z4Qx5__XoW434OmTMGW8neGQbbFYxlZ0jmBbXSmKPFRDK7lSfJYCXnvw3Zo6lCrTseeGEt3n_t-T8ftQP9MwIOVP_ffr0muEvIhWH4m1_63q_nb2YJ0prPVevVlfkkOKaJKEEqJ-xsjNuTrRz_wSWdDJj9y1-0hudix_cUlWQakI8gbworfqR-Qd9-JCIFCKiNciDvU4F0DAwocKPQgpJApuUWtpSpCuzJxFv0Gz6UQp1luqmsTmwTBgzyVKkKFEVCI0Ig4KeLhPqSwlQrBO6YuZFdmzvAkkYLMzaFsSEEbcYvg9fe0QfqJwiupDCpnVKsME_YKmsoPzik_jbWJ061xxqcCQGFZde-R6pSb8q9Jd1jTZXbdtdgkGKCIUDmsLv0w-IlQ6iZOfwGFVSZS7RGHuQ7rFl_ewhA_x9AnGacHP70mP5mK74S6P0rTCW9U79XUefvncJ-Xf3iOrsOc_9v5YS_1w9uPh5fj4S8ZzzOGHo2n_4_HcxR9avsBLPs_aLX_7jkLGqDOZKqxZeWQAka3WPWhZa62eKXktpSpjsuSKy8i1KaKsuowS6tQYfAxzKwwt8PcCr-2wz0r3LfDfSvs1mB2Cg-s8NgOD63wyG579DfK47N6Dvf__QkAAP__qvR3QQ== +distribution: full +vectorized: true +· +• distinct +│ distinct on: a +│ order key: a +│ +└── • sort + │ order: +a + │ + └── • union all + │ + ├── • index join + │ │ table: array_tab@primary + │ │ + │ └── • scan + │ missing stats + │ table: array_tab@arr_inv + │ spans: 1 span + │ + └── • scan + missing stats + table: array_tab@primary + spans: [/1 - /1] +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJy0k19r2zAUxd_3KcTdQ1umYEv5O8Mg2-KxjCzp7MA2NlMU-1IMqeVJ8lgJ-e7DdmnqUKtOx16MpavfPUc63B3oX1vwwP92uXg7X5Lz2Txch18WFyT0F_77NRHkQ7D6TIRS4vbKiA35-tEPfHK-IdOfhev2kZzt2P7sgqwCci7IG8LK35kfkHffiQAKmUxwKW5Qg_cDGFDgQKEPEYVcyRi1lqos7aqD8-QPeC6FNMsLU2-b1GwRPCgyqRJUmACFBI1It2U92kcUYqkQvMPRpezJ3BkdHaQgC3PXNqKgjbhG8AZ72iL9SONQKoPKGTc6w5S9grb2w1Paz1Jt0iw2zuRYACis6tt7pF4Vpvpr0x01dJlddy02WwxQJKgc1pS-z30qlLpKs99AIcxFpj3iMNdhvfLLOxjipxj6JNPszk-_zU-u0huhbg_SdMpb1fsNdd79Odyn5e-fo-cw52U3P-y5fnj3eHgVD39OPE8YehDP4D_HcxB9bPoBLPM_7DT_7ikDGqDOZaaxY-eIAibXWN9Dy0LFeKlkXMnUy1XFVRsJalNXWb2YZ3WpNPgQZlaY22FuhV_b4b4VHtjhgRV2GzA7hodWeGKHR1Z4bLc9_hflyUl3jvYv_gYAAP__5A1x4g== # The split disjunction rule allows us to use the index for this query. query T -SELECT url FROM [EXPLAIN (DISTSQL) -SELECT a FROM array_tab WHERE b @> '{1}' OR b @> '{2}' OR a = 1 ORDER BY a] +EXPLAIN (DISTSQL) +SELECT a FROM array_tab WHERE b @> '{1}' OR b @> '{2}' OR a = 1 ORDER BY a ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJzMVGFP20gQ_X6_YjX3AdAZ2bNOCFg6KXfFqKkooQlSWxELbeIRWAped3eNQCj_vXJsJZgk6wTRql-i7O68eW9mnucZ9I8pBDAMz8MPVyxXU3Y26H9m1-G3y_P_ehds_7Q3vBp-OT9gVYgoA4RS4unGiDH7-jEchGx_f8y6o9zzfGJ7zzjbO2D9Aatd8tneQXkr2L8Mi7-n4YD9_52JCBxIZUwX4p40BNeA4AAHB3yIHMiUnJDWUhVPz_PAXvwIgedAkma5Ka9NYqYEAeSpVDEpisGBmIxIpsV7NIscmEhFECxDTxNtknRi3HYtFroFfT83AesiRDMHZG4qnsgBbcQtQdCaORu0rGH6JJN0QCIm5R7VuRaN7GYquRfqaUntdPlG9vYu7EOpDCm387rKfzamP9ol_aKNJ-vaWA5jTSuXCcZP7E7ouxX0fGiVos5GRcs86wZflWmTjdigu9kMx--u7kIeysxF_5WL19Of1OjRPq4rMZ5SZUbcZEah1E2SPoADw0ykOmAuei4eFr_-dg7lu2jqpQ-kDMVnydSQIuXW6168h4-ZYjJlXQyYLoQxbYQywQhGI444AkZpXJ38EbCN6vyaOr59x7zmz3fRsUMX3b-36xa-VQ_ffoJ8PkH-xgk2aFqZYOtPmmC1AY_fugEb0i9XiffbViB_1xXIf-EKXEM8IJ3JVNNW280rpFN8S2WpWuZqQpdKTuY05bE_x80vYtKmfMXy0EvLp0LgSzBawdwO5lawbwf7r8H4EtyqgXE3MPp2dMuqu20Ht-3tbtmrPrKiO3Zwxwr27LqP7bobfHJiR3sNLrN7tEE52k2KDS7FFZvu4rQGdJPVcMWpVq9Fs79-BgAA__95wQ1F +distribution: full +vectorized: false +· +• distinct +│ distinct on: a +│ order key: a +│ +└── • sort + │ order: +a + │ + └── • union all + │ + ├── • index join + │ │ table: array_tab@primary + │ │ + │ └── • inverted filter + │ │ inverted column: b_inverted_key + │ │ num spans: 1 + │ │ + │ └── • scan + │ missing stats + │ table: array_tab@arr_inv + │ spans: 1 span + │ + └── • scan + missing stats + table: array_tab@primary + spans: [/1 - /1] +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJzMVGFv2jAQ_b5fYd0-tNVSJedAaSNNYltTjakrHVTapoEqQ05tJGpntqlaVfz3KQRBU8AB1E37grDP7967u5d7AvN7BBHEPy7PP7Qu2P5pq3vV_XZ-wLrxefzpigl21ml_ZUJr8XhtxYB9_xx3Yra_P2DN3jgIQmJ7TzjZO2DtDitd8sneQXEr2HuG-d_TuMM-_mQCPJAqoQtxRwaiX4DgAQcPQuh7kGk1JGOUzkNP04et5AGiwINUZmNbXNvUjggiGEulE9KUgAcJWZGO8nh_0vdgqDRBtHh6mhqbyqH166W30Mzp22MbsSZCf-KBGtsZT98DY8UNQVSbeGu0rGD6olLZIZGQ9o_KXPM-NjOd3gn9uKD2mnwte30b9q7SlrTfeFnlu7Xpj7ZJP2_jyao2FsNY0cpFgsEjuxXmdgk9HdpMUWOtokWeVYOflemSjVihu9oMx6-u7kIdqszH8IWLV9OflOjRPa4rMRjRzIy4zoxC6-tU3oMH3UxIEzEfAx8P899wM4fybTS15D1pS8lZOrKkSfvluufx-CHTTEnWxIiZXBgzVmgb9aDX44g9YCST2SnsAVurLiyp45t3LKj-fOcdO_TRf7tZt3BXPXzzCfLpBPmOE6zQtDTB2v80wdkGPN51A1akX6yS4J-tQP6qK5D_xRW4grhDJlPS0EbbLcilU3JDRalGjfWQLrUaTmmKY3uKm14kZGwRxeLQkkUoF_gcjE4wd4O5Exy6weFLMD4H10pg3A6MoRtdc-quu8F1d7tr7qqPnOiGG9xwggO37mO37gqfnLjRQYXL3B6tUI5uk2KFS3HJpts4rQJdZTVccqrTa_3Jmz8BAAD__zm3B-Y= # We cannot use the index for this query. query T -SELECT url FROM [EXPLAIN (DISTSQL) -SELECT a FROM array_tab WHERE (b @> '{2}' AND a = 3) OR b[0] = a ORDER BY a] +EXPLAIN (DISTSQL) +SELECT a FROM array_tab WHERE (b @> '{2}' AND a = 3) OR b[0] = a ORDER BY a ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJyUkVFr2zAUhd_3Ky73pQ6oRJZfhqDgbHGZIXM6JbAVzwwlvhSDa3mSDCvB_33YDmkzSLY93nPPuTroO6D7WaPETbJKPm6hszXcq_VnyJNvD6tFmkGwTDfbzZfVDI4WPRm0tfrlh9c7-PopUQkEwQ7i7x3nEcHNQfQ3M1hkSwg03EE0m8FaQbDLeQF3oIdpmSj48Ai6QIaNKSnTz-RQ5hgiwwgLhq01e3LO2EE-jKa0_IWSM6yatvODXDDcG0soD-grXxNKzMytaecCGZbkdVWPtp6h6fxryHn9RCijnr05HF4_vNW7mhTpkuycn53H02fEra2etX1BhptWN07CLTJcd15CHLJY4KUm4f80ua9qT5bsPDyvMekSgiAWJxgLpRaPuZBSptn2fXHEEocDl6N4xDNqscj5yfva_WJxcVb8L2wUudY0jv4JDu8LhlQ-0cTfmc7u6cGa_fjMNK7H3CiU5Py0jaYhbabVUPBtOLwaFtfD4mqY_xEu-ne_AwAA__8KtQyj +distribution: full +vectorized: true +· +• filter +│ filter: ((b @> ARRAY[2]) AND (a = 3)) OR (a = b[0]) +│ +└── • scan + missing stats + table: array_tab@primary + spans: FULL SCAN +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJyUkVFr2zAQx9_3KY57qQMqkeWXISg4W1xmyJxOCWwlM0OJj2JwLU-SYSX4uw_bIW0G8bbH--v-5x_-HdH9rFBi8u1htUgzCJbpZrv5sprBJlklH7eg4V6tP4O2Vr_88HoPXz8lKoEg2EP8veU8Irg5iu5mBotsCYGGO4hmM1grCPY7nsMd6H5aJgo-PIJGhrUpKNPP5FDuMESGEeYMG2sO5JyxfXwcltLiF0rOsKyb1vdxzvBgLKE8oi99RSgxM7emmQtkWJDXZTWsdQxN619LzusnQhl17M3hcPrwVu8rUqQLsnN-cR7P_yJubPms7Qsy3DS6dhJukeG69RLikMUCr5GE_0NyX1aeLNl5eIkx5hKCIBZnFwulFo87IaVMs-37_GQlDnstp_BkZ8hisePn3Vf2q-DiAvwvbhS5xtSO_kkO73KGVDzR6N-Z1h7owZrD8JlxXA-9ISjI-fE1Goe0Hp96wLflcLIspstissz_KOfdu98BAAD__xs0B0Q= diff --git a/pkg/sql/logictest/testdata/logic_test/inverted_join_geospatial_dist b/pkg/sql/logictest/testdata/logic_test/inverted_join_geospatial_dist index bdd639f71b65..04394e58e860 100644 --- a/pkg/sql/logictest/testdata/logic_test/inverted_join_geospatial_dist +++ b/pkg/sql/logictest/testdata/logic_test/inverted_join_geospatial_dist @@ -54,62 +54,217 @@ SELECT lk, rk FROM ltable JOIN rtable@geom_index ON ST_Intersects(ltable.geom1, 3 16 query T -SELECT url FROM [EXPLAIN (DISTSQL) SELECT lk, rk FROM ltable JOIN rtable@geom_index -ON ST_Intersects(ltable.geom1, rtable.geom) ORDER BY (lk, rk)] +EXPLAIN (DISTSQL) SELECT lk, rk FROM ltable JOIN rtable@geom_index +ON ST_Intersects(ltable.geom1, rtable.geom) ORDER BY (lk, rk) ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJzElF1v2jwYhs_fX2E9R0U1b3AC_chRtpVJqRjpoAebqqjKkkdd1mBntjN1qvjvUxI2CAUn7EOcYew79-VHl_wM6msGLszHk_GbW1LIjLydBe_I3fjDzeSVPyUnV_78dv5-0iOrI9kjJfKxPpXp6FOG5Drwp0RWv70HFIv7lCf4RIIpUfo-5Rqlwlirk_r4_-URRleBatUjwexqPCOvP5KT-vu9EChwkeA0WqAC9w4YULCBggMhhVyKGJUSstx6rg76yRO4Awopzwtd_h1SiIVEcJ9BpzpDcOG2bJxhlKC0BkAhQR2lWfX5ms3LZbqI5HegMM8jrlzSt8rSoNAu8Rj1bAiXFESh1yVKRw8ILlvS7iA-_4ZSY3ItUo7ScposL0YJ9Fdi_JTLrbF6NiXesNfApJ6zl9Q-hLQkXE3sbCflemITIR6LnHwRKSeCu8Qrr_VCgop21KDdj-ocgjoXUqO0LpuYHjulnn0KFBaRjj-TDLlL2N7G4d7GdZGQCUpMdveEyx1oU9EXucXsRmQfwqiBwLorzbopbdn9yriDpW5B2ZJ6eESpW0g3pD4_ttQtqCup2eAvWm13V8ruqJTT_x2hWkC2hBodUagW0g2hLo4tVAvqT6HYP3omd1TOUOWCK-z0-g3K9xOTB6zfXCUKGeONFHFVUy-DKlf9kaDS9S6rFz6vt0rAzTAzhm1z2DaGHXPYMYaHjTDbDg_Nd26pHhnTZ-bwmTF8bg6fG8MX5vDFn0zs0jyxQYsmLZK1WWbWjLV4xsyibd88XP73IwAA___909Eu +distribution: full +vectorized: true +· +• sort +│ order: +lk,+rk +│ already ordered: +lk +│ +└── • lookup join + │ table: rtable@primary + │ equality: (rk) = (rk) + │ equality cols are key + │ pred: st_intersects(geom1, geom) + │ + └── • inverted join + │ table: rtable@geom_index + │ + └── • scan + missing stats + table: ltable@primary + spans: FULL SCAN +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJzElF1v2jAUhu_3K6xzVVSz4AT6katsK5NSMdJBLzZNqMqSI5YR7Mw2ExPiv09J2CAUnLAPcYex37yPjx55BepbCi70PzwMXvlDcnHnjx_H7wctMu4P-m8eSTqjRM7I21HwjqQ6_JwiuQ_8IZHFb2-KYv6U8BiXJBgSpZ8SrlEqjLS6KI-_zI8wugkUqxYJRnf9EXn9kVyU328BBS5iHIZzVOB-AgYUbKDgwIRCJkWESgmZb62Kg368BLdDIeHZQud_TyhEQiK4K9CJThFceMwLRxjGKK0OUIhRh0lafL5E8zKZzEP5AyiMs5Arl7StvDRYaJd4jHo2TNYUxEJvS5QOpwguW9PmID7_jlJjfC8SjtJyqizPJgn0d6K_zOTeVD2bEq_bqmBSzzlKap9CmhNuJnZ1kHI7sYEQs0VGvoqEE8Fd4uXXeuZAQdur0B5HdU5BHQupUVq3VUyPXVLPvgQK81BHX0iK3CXsaGP3aOO2SMgYJcaHeybrA2hD0RaZxexK5BhCr4LAmivNmilt2e3CuJOlrkHZk7p7RqlrSHekvj631DWoG6lZ5x9abTdXym6olNP-E6FqQPaE6p1RqBrSHaFuzi1UDeovodh_eiYPVI5QZYIrbPT6dfL3E-Mplm-uEgsZ4YMUUVFTLoMiV_wRo9LlLisXPi-3csDdMDOGbXPYNoYdc9gxhruVMNsPd813rqnuGdNX5vCVMXxtDl8bwzfm8M3fTOzWPLFOjSY1ktVZZtaM1XjGzKLt33yyfvEzAAD__wq_y88= query T -SELECT url FROM [EXPLAIN (DISTSQL) SELECT lk, rk FROM ltable JOIN rtable@geom_index -ON ST_Intersects(rtable.geom, ltable.geom1) OR ST_DWithin(ltable.geom1, rtable.geom, 2) ORDER BY (lk, rk)] +EXPLAIN (DISTSQL) SELECT lk, rk FROM ltable JOIN rtable@geom_index +ON ST_Intersects(rtable.geom, ltable.geom1) OR ST_DWithin(ltable.geom1, rtable.geom, 2) ORDER BY (lk, rk) ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJzUVVFv2jwUff9-hXWfQDUFO9DSPKXfSiUqRjrgYVOFqoxcdVlTO7PN1qnqf5-coJVQsOn60r5h-x7uPcfnOA-gf-QQwnQwGnyYkaXKyfkk_kiuBp8vR6fDMWmcDaez6adRk6xK8ltK1G1VlZvka47kIh6OiSp_Rzco764zkeI9icdEm-tMGFQaF0Y3qpJDW0JX2HLBmiSe2Nr0V2a-ZaKxfkZJDcZt7dlgQv7_QhrVLM05UBAyxXFyhxrCK2BAgQOFAOYUCiUXqLVU9uihLBym9xB2KGSiWBq7PaewkAohfACTmRwhhJltOsEkRdXuAIUUTZLl5d9X40WFyu4S9RsoTItE6JC02rZpvDQhiRiNOMwfKcileWqiTXKDELJHuv8gQ_ETlcH0QmYCVTuoz_JMdqB_EYP7Qm1cQcQpibqbele7lPDDThiG56P4dNZv1qjQKNjJhr-EzVQqg6p9VGcRsQMaBQc7WwQvaWGFWl3cyVaxni5uJOXtsiDfZSaIFCGJrLrPfBv1KIn4VtF6DtF2K9bdSeeJhVQpKky36MStTlt4j2VLFm3Ga5BdI_RqI7D9s8D2y0Kbt0qrvjgNnlE20tB942nwsFml4fg1afC0WEsD67yHOPD9vcj39GLQ-hcnegbZcGLvjTvRw2blxP5rnOhpse5E9h6c6PnOTFAXUmjc673t2Bcb0xusXnktl2qBl0ouyjbVMi5x5UaK2lSnrFoMRXVkB1wHMyeYu8HcCQ7c4MAJ7tbAbBPcdXP2tO450Udu8JETfOwGHzvBfTe4_xrFTtyKdTw28ZjM5zK3zZjHZ8xttE3m88f__gQAAP__5mgOKA== +distribution: full +vectorized: true +· +• lookup join +│ table: rtable@primary +│ equality: (rk) = (rk) +│ equality cols are key +│ pred: st_intersects(geom, geom1) OR st_dwithin(geom1, geom, 2.0) +│ +└── • sort + │ order: +lk,+rk + │ + └── • inverted join + │ table: rtable@geom_index + │ + └── • scan + missing stats + table: ltable@primary + spans: FULL SCAN +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJzUVdFu2jAUfd9XWPcJVFOwAy3NU7qVSlSMdMDDpglVGbnqslI7s83Wqeq_T07QSijY6frSvmH7Hu49x-c496B_LiGEwefL0elwTBpnw-ls-mnUJNPBaPBhRpY3lKgbcj6JP5KlSb4tkVzEwzFRxe_oGuXtVSZSvCPxmGhzlQmDSuPC6EZZcmhL6BpbLFiTxBNbm_7OzPdMNDbPKKnAuK09G0zI-y-kUc7SBApCpjhOblFD-BUYUOBAIYA5hVzJBWotlT26LwqH6R2EHQqZyFfGbs8pLKRCCO_BZGaJEMLM9pxgkqJqd4BCiibJlsXfl9NFucpuE_UHKEzzROiQtNq2abwyIYkYjTjMHyjIlXlsok1yjRCyB1p_kKH4hcpgeiEzgaodVGd5ojrQf4jBXa62biDilETdbbnLXUr4YScMw_NRfDrrNytUaBTsZcOfw2YqlUHVPqqyiNgBjYKDvS2C57SwQq0v7mSnWI8XN5LyZpWTHzITRIqQRFbdJ7aNepREfKdoPYdo-xXr7qXzyEKqFBWmO3TiVqcdvMeyJfM24xXIvhF6lRFY_Sywello81Zh1WenwTPKVhq6rzwNHjbrNBy_JA2eFhtpYJ23EAde34u8pheD1v840TPIlhN7r9yJHjZrJ_Zf4kRPi00nsrfgRM93ZoI6l0Jjrfe2Y19sTK-xfOW1XKkFXiq5KNqUy7jAFRspalOesnIxFOWRHXATzJxg7gZzJzhwgwMnuFsBs21w183Z07rnRB-5wUdO8LEbfOwE993g_ksUO3Er1vHYxGMyn8vcNmMenzG30baZzx_e_Q0AAP__cTgIyQ== query T -SELECT url FROM [EXPLAIN (DISTSQL) SELECT lk, rk FROM ltable JOIN rtable@geom_index -ON ST_Intersects(ltable.geom1, rtable.geom) AND ST_DWithin(rtable.geom, ltable.geom1, 2) ORDER BY (lk, rk)] +EXPLAIN (DISTSQL) SELECT lk, rk FROM ltable JOIN rtable@geom_index +ON ST_Intersects(ltable.geom1, rtable.geom) AND ST_DWithin(rtable.geom, ltable.geom1, 2) ORDER BY (lk, rk) ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJzUVV1vGjsQfb-_wponUEzAXkiInzb3hkhEXDYFHlpFKNqyo2Sbxd7apk0V8d-r3aUNy4eX9ENK3rBnDuec4Yx5AvM5AQHj3qD334QsdEIuR8H_5Kb3_npw3h-S2kV_PBm_G9TJqiV5oEQ_FF2JDT8mSK6C_pDo_LN_h2p-G8sIH0kwJMbextKiNjizpla0H2ctjK4A-alOzocXWXP0Nbb3sayt1Sgpw3idBKOL3oj8-4HUCjH1KVCQKsJhOEcD4gYYUOBAwYMphVSrGRqjdFZ6yhv70SOIFoVYpgubXU8pzJRGEE9gY5sgCJhkrCMMI9TNFlCI0IZxkn99ochPdTwP9TegME5DaQRpNDPSYGEF8Rn1OUyXFNTCPpMYG94hCLakhwvpyy-oLUZXKpaom15Zy9bcgf5E9B5TvfEb-JwSv7018OKaEn7cEkJcDoLzSbde8kJ9b68d_hI7mY3VWE92Wnke60Cph0VKPqlYEiUF8TPvW7HKtXe2LXUoyUp7Le33473Ez1hpi7p5VvbisyPq8yOgMA_t7J4kKAVhexnbexmfiZSOUGO0m2e63CFtqBoqbTJeguyT0ClJYIcvBztsOZq8kWf3xetRIWVjPdqvfT0q7Kytx-mbWI8KP6v1YK0_uB_88HDyA8PpNX4lmhVCNqLZee3RrLCzFs3um4hmhZ8f0WR_6eneQTlCkypp8KAXuZW96RjdYfE_YNRCz_Baq1lOUxyDHJdfRGhsUWXFoS-LUiZwHcycYO4GcyfYc4M9J7hdArNNcNvtuYK640SfuMEnTvCpG3zqBHfd4O7vTOzMPbFWRUwqQlaVMnfMWEXOmDtom86ny3--BwAA__-jCRy4 +distribution: full +vectorized: true +· +• sort +│ order: +lk,+rk +│ already ordered: +lk +│ +└── • lookup join + │ table: rtable@primary + │ equality: (rk) = (rk) + │ equality cols are key + │ pred: st_intersects(geom1, geom) AND st_dwithin(geom, geom1, 2.0) + │ + └── • inverted join + │ table: rtable@geom_index + │ + └── • scan + missing stats + table: ltable@primary + spans: FULL SCAN +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJzUlV1v2j4Uxu__n8I6V6Cagh1oqa_S_0olKkY64GLThKqMHLVZg53ZZutU8d2nJN1KeHFgL1J7h19-nOc5PMc8gvmSgIDe--vBeX9Iahf98WT8blAn496g92ZCkntK9D25HAVvSWLDTwmSq6A_JDr_7N-imt_EMsIHEgyJsTextKgNzqypFdePsyuMPgH5qk7OhxfZ5ehbbO9iWVs5o6SM8ToJRhe9Efn_A6kVYupAQaoIh-EcDYiPwIACBwoeTCmkWs3QGKWzo8f8Yj96ANGiEMt0YbPtKYWZ0gjiEWxsEwQBk6zoCMMIdbMFFCK0YZzkX18I8lMdz0P9HSiM01AaQRrNrGiwsIL4jPocpksKamGfixgb3iIItqT7C-nLr6gtRlcqlqibXlnLRtuB_iJ6D6le-wl8Tonf3uh3sU0JP24JIS4HwfmkWy95ob630w4_xE5m46mtJ1utPLd1oNT9IiWfVSyJkoL4mfeNVOXaO5uWOpRkRzst7fbjHeJnrLRF3Twre_HZEfX5EVCYh3Z2RxKUgrCdFds7Kz4XUjpCjdH2OtPlFmlD1VBpk_ESsktCpySB7T8cbL_haPJGnt2Dx6NCytp4tF_6eFTYWRmP01cxHhV-nsaDtf7ifPD9w8n3DKfX-J1oVghZi2bnpUezws5KNLuvIpoVfn5Gk_2jp3tLyRGaVEmDe73IrexNx-gWi_8BoxZ6htdazfIyxTLIuXwjQmOLU1Ys-rI4ygSuwswJczfMnbDnhj0n3C7BbB1uuz1XlO446RM3fOKET93wqRPuuuHun3TszN2xVkVMKkJWlTJ3zFhFzpg7aOvOp8v_fgQAAP__FqkXWQ== query T -SELECT url FROM [EXPLAIN (DISTSQL) +EXPLAIN (DISTSQL) SELECT lk, rk FROM ltable JOIN rtable@geom_index ON ST_Intersects(ltable.geom1, rtable.geom) AND ST_Covers(ltable.geom2, rtable.geom) -AND (ST_DFullyWithin(rtable.geom, ltable.geom1, 100) OR ST_Intersects('POINT(1.0 1.0)', rtable.geom))] +AND (ST_DFullyWithin(rtable.geom, ltable.geom1, 100) OR ST_Intersects('POINT(1.0 1.0)', rtable.geom)) ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJzsVUFv2jAYve9XWN-lIBmIE6DUp1QrTKlo0gGHTRWqMuJ1WVM7s52uVcV_n5JUKwlgUk27wQnb7_l9ed_35BdQvxKgMB9Pxx8XKJMJmsyCK3Qz_nI9Pfd81Lrw5ov552kbvUKSe4zkfYlKdPgtYegy8Hwki__uHRMPtzGP2BMKfNRS-jbmmknFVlq1Snw3xxD8yihWbXTuXyClb1fikckK0K4CS2R-b_Q9S5Ln37H-EfPWBgSjqgyxrDYKZqhaysl14PmLFulaiHSt9klNZQkYuIiYHz4wBfQGCGCwAYMDSwypFCumlJD50UsB9KInoBaGmKeZzreXGFZCMqAvoGOdMKCwyAVmLIyY7FmAIWI6jJPi-rJkN5XxQyifAcM8DbmiqNOzYbnGIDL9dq_S4R0DSta4ubbHH5nULLoUMWey51Tlt5oH-C9j_JTKeiNdGyN3UO-a6xS7e1pUcop-dC1K6WQanC9Gu1pjEYtYW7-J5Uzq6xNK6adxcDVezL6W2oAhyDRFLsGujV0Hu_29BtrvMTA37rV3w53mvfVuKsR9lqKfIuZIcIrcfl7VVhoKQ4Y7TRzuNXGIUc77jyYOqybut8_Za9-baxkXMmKSRRXLlusdBvuiI9LeWQ24W7pfkSbNY0eaxa5nd3pOw-AdUK8Fr38MXj14BwzcCN7pMXjbwbObT7_dcPqdTsPZP6Bdm_3Bcfbrs3_AwI3ZHx1n3_zo7LBvxlQquGKN3hQrf5RYdMfKF0yJTK7YtRSrQqZcBgWv2IiY0uUpKRceL4_yAjfJxEi2zWTbSHYqZFInO-ayLbN038gemMkDI3loJg__5aNPjeSRWXlkJJ-ZyWfvKnu5_vAnAAD__96MMnU= +distribution: full +vectorized: true +· +• lookup join +│ table: rtable@primary +│ equality: (rk) = (rk) +│ equality cols are key +│ pred: (st_intersects(geom1, geom) AND st_covers(geom2, geom)) AND (st_dfullywithin(geom, geom1, 100.0) OR st_intersects('0101000000000000000000F03F000000000000F03F', geom)) +│ +└── • inverted join + │ table: rtable@geom_index + │ + └── • scan + missing stats + table: ltable@primary + spans: FULL SCAN +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJzslUFv4jgUx-_7Kax3KUgG4gRS6lOqLaxS0aQLHHY1QlWGeDqZpnbGdjqtKr77KEk1JQFMqtHc4ITt9_P_5f_ek19BfU-BwuS_29mlH6DOlb9YLv6dddFiMpv8vUTpA0byAU3n4Q1KdfQ5Zeg69AMky__ePROPdwmP2TMKA9RR-i7hmknF1lp1qvh-EUPwG1GuuugyuEJK363FE5O1QLseWEUW98Zf8jR9-ZHorwnvbIVgVJchltVF4RzVUzm7Df1g2SF9C5G-1T1rqAAGLmIWRI9MAf0EBDDYgMGBFYZMijVTSsji6LUM9ONnoBaGhGe5LrZXGNZCMqCvoBOdMqCwLO6fsyhmcmABhpjpKEnL66uMvUwmj5F8AQyLLOKKot7AhtUGg8j1-71KR_cMKNng9to-f2JSs_haJJzJgVOX36kd4F_E5DmTzTp6NkbeqFk0zyl3D1SoYspy9C1K6XQWXi7H-ypjEYtYO7-p5Uyb6zNK6T-T8GaynP9faQOGMNcUeQR7NvYc7A0PGmh_xMDCuLfauXvNe6_dTIiHPEPfRMKR4BR5wyKrnWEoDXH3mugeNNHFqOD-oIlu3cTD9jkH7Xt3LedCxkyyuGbZarPH4ED0RDa4aATulx7WpEn7sSPtxm5g9wZOy8E7ot4YvOFp8JqDd8TArcE7Pw3e7uDZ7bvfbtn9Tq9l7x_RbvT-6NT7zd4_YuBW749PvW9-dPbYN2cqE1yxVm-KVTxKLL5n1QumRC7X7FaKdSlTLcOSKzdipnR1SqqFz6ujIsFtmBhh2wzbRtipwaQJO-a0LbP00EiPzPDICLtm2P2djz43wmOz8tgIX5jhiw-lvdr89TMAAP__nZMtFg== # This query performs a semi-join, which is converted to paired joins by the # optimizer. query T -SELECT url FROM [EXPLAIN (DISTSQL) -SELECT lk FROM ltable WHERE EXISTS (SELECT * FROM rtable WHERE ST_Intersects(ltable.geom2, rtable.geom))] +EXPLAIN (DISTSQL) +SELECT lk FROM ltable WHERE EXISTS (SELECT * FROM rtable WHERE ST_Intersects(ltable.geom2, rtable.geom)) ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJzUlN9v2j4Uxd-_f4V1n8pXZpAEaJunTFuqpaLQAdIqVVGVxXdV1tTObGeiQvzvkxM2fghM2F7aR8fn5J7P1ZEXoH7k4MM0HIYfZqSUObmajG_IfXh3O3wfjcjZx2g6m34etshKkj_VilwnX3MkXz6Fk5CEd0ZFzlaa_2uJ3JQo_ZBxjVJhqtVZ7X73iOLZpSthdWq1YqDABcNR8owK_HtwgIILFDyIKRRSpKiUkOZqUQkjNge_SyHjRanN55hCKiSCvwCd6RzBh5kZMMGEoex0gQJDnWR59fs6SlDI7DmRL0BhWiRc-aTdMUPHpfZJ4NDAg3hJQZR6PUTp5BHBd5a0eZCI_0SpkV2LjKPseNtZ6kUEZhEPGWc4B_rHEc4LubPFwKUk6LWAwrdMKk2-i4yTjJMiySSytjluIrg08GjQPwjingJiAFYLHWxDzF4K9MkwvJqRaXgTketxNAL6m22956EQT2VRhxbcJ4FZxni0j3FgGBWmgjM75EE27yDbGqnkQjKUyLZ44uUe-pFoi6JzuSPcP7q3NdppXlSnWVE7brvq0clVPRJlp6q911vVIyAbVT1_c1V1m_fFbdgXr_03bTkSZKct_dfbliMgG225eHNtOfJoT1AVgits9G51zcOH7BHrV1KJUqZ4K0VajamP48pXfWCodH3r1IeI11cm4KbZsZpdu9m1mr0ts7Nr9uyxu_bRPau7bzf3reaB3Tz4F-hzq_nCPvnCar60my9Pih0v__sVAAD__xtCcVg= +distribution: full +vectorized: true +· +• lookup join (semi) +│ table: rtable@primary +│ equality: (rk) = (rk) +│ equality cols are key +│ pred: st_intersects(geom2, geom) +│ +└── • inverted join + │ table: rtable@geom_index + │ + └── • scan + missing stats + table: ltable@primary + spans: FULL SCAN +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJzUlE9v2kAQxe_9FKs5JdVSsA0k-OSqdVRHBFJAaqQKRa53ityYXXd3XREhvnu1Ni1_BItpL8lxvPM87zd6miWonxn4ED7c999HA3LxMRpPxp_7l2Qc9sMPE5I9kZvR8I5kOv6WIfnyKRyFJHwwXeRi3fO2apHbLUo_plyjVJhodVGp381QzF26biyry0ugwAXDQTxHBf5XcICCCxQ8mFLIpUhQKSHN07JsjNgC_BaFlOeFNp-nFBIhEfwl6FRnCD5MzP9HGDOUzRZQYKjjNCt_XzkJcpnOY_kMFMZ5zJVPGk0zdFhonwQODTyYriiIQm-GKB3PEHxnResbifgvlBrZrUg5yqa366XaQ2D28JhyhgugfxXhIpd7SwxcSoK2Wdj3VCpNfoiUk5STPE4lsoYptxFcGng06BwFcc8BMQDrhXZ3ISbPOfqkH95MyDi8i8jtMBoA_cO22XNfiKcir0wL7pPALGM4OMTYNYwKE8GZHfIom3eUbYNUcCEZSmQ7PNPVAfqBaIi82dtrPDy6vTPaqR9Up15Qm26jzNHZUT1hZS-q7Zcb1RMgW1G9enVRdevnxa2ZF6_xL2k5YWQvLZ2Xm5YTIFtpuX51aTlxtEeocsEV1rpbLXP4kM2wupJKFDLBeymSckxVDktd-YGh0tWrUxURr56MwW2xYxW7drFrFXs7Ymdf7Nltt-yj21Z1xy7uWMVdu7j7P9BXVvG1ffK1Vdyzi3tn2Z6u3vwOAAD__5qPa_k= # Left joins are converted to paired joins by the optimizer. query T -SELECT url FROM [EXPLAIN (DISTSQL) -SELECT lk, rk FROM ltable LEFT JOIN rtable ON ST_Intersects(ltable.geom1, rtable.geom)] +EXPLAIN (DISTSQL) +SELECT lk, rk FROM ltable LEFT JOIN rtable ON ST_Intersects(ltable.geom1, rtable.geom) ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJzUlF9vmzwUxu_fT2Gdq1Zy3gRI0pYrpo1KVFnoEiZNqlDF8FnFSm1mm6lVle8-gaPlzxpDtqtcGp_H53kOP51XUD9K8GEZzsL3CallSa4X8UdyF365nb2L5uTsQ7RMlp9m52RdUj5SIh9NVamzryWSWXidkJs4mhNpPsRzovR9wTVKhblWZ6bw_wcUTw5dV7Wn8xQocMFwnj2hAv8OHKDgAgUPUgqVFDkqJWRz9doWRuwZ_BGFgle1bj6nFHIhEfxX0IUuEXxImvcXmDGUwxFQYKizomyfN06CShZPmXwBCssq48ong2HTNK61TwKHBi6kKwqi1psmSmcPCL6zov2NRPwnSo3sRhQc5dDb9ZK8VOib6cWfk3DRzhAomPkEzXzuC87wGejvl8LnSu4NN3ApCcbnQOFbIZUm30XBScFJlRUS2aA57kSjgUeDycGA7jEBm2DrQU-PCrf5ATMhHuvKuBbcJ0EzpT8IakNOm5AKc8FZV0rvYD7vYL5NrJoLyVAi28mUrt6YwFwMRDW82it8u_V4p7XTH2KnH8RDd9AydjTGHVb2MB6fHsYdAbcwvjhJjN3-LLk9WfIGf0NSh5E9kianR1JHwC2SLk-SpI6Fv0BVCa6w174bNQsT2QOa7apELXO8lSJv25hj3OraDwyVNreOOUTcXDUGt8WOVezaxa5V7O2InX2xZ7c9srceW9UTu3hiFU_t4um_hL6wii_tnS-t4iu7-Ooo2-nqv18BAAD__94Qg5I= +distribution: full +vectorized: true +· +• lookup join (left outer) +│ table: rtable@primary +│ equality: (rk) = (rk) +│ equality cols are key +│ pred: st_intersects(geom1, geom) +│ +└── • inverted join (left outer) + │ table: rtable@geom_index + │ + └── • scan + missing stats + table: ltable@primary + spans: FULL SCAN +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJzUlF9vmzAUxd_3Kaz71ErOEiBJW56YNipRZaFLmDRpiiqG7ypWYjPbTKmifPfJUC1_1hiyPeXR2Mf3nMNPXoP6WYAP4Zf7ybtoSi4-RPNk_mlySebhJHyfkOKJEvlEbmfxR1Lo9FuBZBLeJuQujqZENh_iKVH6IecapcJMq4vm4NtHFEuHvpyqV5dAgQuG03SJCvyv4AAFFyh4sKBQSpGhUkKarXV9MGIr8AcUcl5W2nxeUMiERPDXoHNdIPiQmOtnmDKU_QFQYKjTvKivb4wEpcyXqXwGCvMy5convb4ZGlfaJ4FDAxcWGwqi0tshSqePCL6zod2NRPwXSo3sTuQcZd_b95I8l-g35cWfk3BWVwgUmnoCU89DzhmugP65KVyV8qDbwKUkGJoiv-dSafJD5JzknJRpLpH1zHIvGg08GoyOBnRPCWiCvRQ9Pinc9gdMhHiqysa14D4JTEt_AVSHHJuQCjPBWVtK72g-72i-bayKC8lQItvLtNi80sBU9ETZvzk4-Pro4d5opzvETjeI-26vZuxkjFusHGA8PD-MWwLuYHx1lhi73VlyO7Lk9f6FpBYjBySNzo-kloA7JF2fJUktD_4MVSm4wk7v3cA8mMgesXldlahkhvdSZPWYZhnXuvoDQ6WbXadZRLzZMgZ3xY5V7NrFrlXs7YmdQ7Fntz2wjx5a1SO7eGQVj-3i8f-EvrKKr-2Tr63iG7v45iTbi82b3wEAAP__-Mt-Mw== query T -SELECT url FROM [EXPLAIN (DISTSQL) +EXPLAIN (DISTSQL) SELECT lk, rk FROM ltable LEFT JOIN rtable@geom_index -ON ST_Intersects(rtable.geom, ltable.geom1) OR ST_DWithin(ltable.geom1, rtable.geom, 2) ORDER BY (lk, rk)] +ON ST_Intersects(rtable.geom, ltable.geom1) OR ST_DWithin(ltable.geom1, rtable.geom, 2) ORDER BY (lk, rk) ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJzcVV1vGjkUfd9fYd0nUEzAHiDET5PdEImIZbLASq0iFE2Z22SawZ7apk0U8d-rmaENEPBAP154tH2Pz_G598gvYD4nIGDU7Xf_GZO5TsjVMPiX3Hbf3fQvegNSueyNxqP_-lWyLEkeKdGPRVViww8Jkn73akyug96A6HzDv0c1u4tlhE8kGBBj72JpURucWlMpSk6zErq8IF-wKgmGWW30NbYPsaysnlGyBuNZ7WV3SP5-TyqFoOoEKEgV4SCcoQFxCwwocKDgwYRCqtUUjVE6O3rJC3vRE4gGhVimc5ttTyhMlUYQL2BjmyAIGGekQwwj1PUGUIjQhnGSX1_I81Mdz0L9DBRGaSiNILV6RhrMrSA-oz6HyYKCmttXEmPDewTBFnR_IT35BbXF6FrFEnXdW9cyfk5RFG0I_h93h3kzgMKbdgD9cVP3KdUbrfE5JX5zsw_FLiX8tCGEuOoHF-NOFSh8jLWx5JOKJYklScNYY1TLlmvPp75H_dZOE_ghJmSPXzajfZABr03qK_U4TwvVSgriZ06-mVG_TYnPtxrRfmuEwamSUZkT3k4PvEM8GCltUdfP19_vsxPq8xOgMAvt9IEkKAVhOxmbOxlfiZSOUGO0nWey2CJtoGoqrTO-BtklobUmge0fQ7ZfDOu8lqfk4CCWSNkIYvM4g1hiwkoQz442iCUeLIPIGr8xiXz_GPA9Y-DVfiYEJUI2QtA6zhCUmLASgs7RhqDEg-8hYH_oO9pCOUSTKmlwr1-mkf1TGN1j8bcZNddTvNFqmtMUyyDH5RsRGlucsmLRk8VRJnAVzJxg7gZzJ9hzgz0nuLkGZpvgpvvNJdQtJ7rtBred4DM3-MwJ7rjBnV9x7NztWKNkTEqGrGzK3GPGSuaMuQdt8-WTxV_fAgAA__8o6IH0 +distribution: full +vectorized: true +· +• sort +│ order: +lk,+rk +│ already ordered: +lk +│ +└── • lookup join (left outer) + │ table: rtable@primary + │ equality: (rk) = (rk) + │ equality cols are key + │ pred: st_intersects(geom, geom1) OR st_dwithin(geom1, geom, 2.0) + │ + └── • inverted join (left outer) + │ table: rtable@geom_index + │ + └── • scan + missing stats + table: ltable@primary + spans: FULL SCAN +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJzcVd9v2jwUff_-Cus-UdUU7AClfkq_r1Si4iMdMGnThKqM3LVZg53ZZmtV8b9PSbqVUHBgP1549I_jc-6598hPYL4kIKD37npw3h-S2kV_PBm_GRyRcW_Q-29CkntK9D25HAX_k8SGHxMkg97lhFwF_SHR-YZ_i2p-E8sIH0gwJMbexNKiNjizplZcOcmu0OcH8gU7IsEouxt9i-1dLGurZ5SUYDy7e9EbkX_fk1oh6AgoSBXhMJyjAfEBGFDgQMGDKYVUqxkao3R29JRf7EcPIJoUYpkubLY9pTBTGkE8gY1tgiBgknGOMIxQN5pAIUIbxkn-fKHOT3U8D_UjUBinoTSC1BsZabCwgviM-hymSwpqYV9IjA1vEQRb0t2F9OVX1BajKxVL1A2vrGXymKIouhC8nfRGeS-AwqtuAP35Uu8h1Wud8Tklfmu9DcUuJfykKYS4HATnk25m9qdYG0s-q1iSWJI0jDVG9WxZKp_6HvXbW03g-5iQFf_cjM5eBrw0aaDU_SItVCspiJ85-WpE_Q4lPt9oROe1EQZnSkZVTnhbPfD28WCstEXdOCvX77Nj6vNjoDAP7eyOJCgFYVsZW1sZX4iUjlBjtJlnutwgbajqKm0wXoJsk9AuSWC7x5DtFsMGr-cp2TuIFVLWgtg6zCBWmLASxNODDWKFB89BZM0_mES-ewz4jjHw6r8SggohayFoH2YIKkxYCUH3YENQ4cGPELC_9B1toByhSZU0uNMv08z-KYxusfjbjFroGV5rNctpimWQ4_KNCI0tTlmx6MviKBO4CmZOMHeDuRPsucGeE9wqgdk6uOWuuYK67UR33OCOE3zqBp86wV03uPs7jp25HWtWjEnFkFVNmXvMWMWcMfegrVc-Xf7zPQAA___a7XyV query T -SELECT url FROM [EXPLAIN (DISTSQL) +EXPLAIN (DISTSQL) SELECT lk, rk FROM ltable LEFT JOIN rtable@geom_index -ON ST_Intersects(ltable.geom1, rtable.geom) OR ST_DWithin(rtable.geom, ltable.geom2, 2) ORDER BY (lk, rk)] +ON ST_Intersects(ltable.geom1, rtable.geom) OR ST_DWithin(rtable.geom, ltable.geom2, 2) ORDER BY (lk, rk) ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJzclV9v2jAUxd_3Kaz7BKop2OFf85RupRIVIx0waVOFqozctVmDndlma1Xx3ackbIW0OKm2vfDoP8fn-udz5UfQ32NwYToYDd7NyErF5HzivydXg0-Xo9PhmNTOhtPZ9MOoTjZb4jtK1F2-KzbBlxjJaHA-Ixf-cExUNuHdoFxeRyLEe-KPiTbXkTCoNC6MruWa43QLoxtBNqoTf5LuDX9G5jYSta0lSrZUnBKe7j0bTMjbz6SWF1SfAwUhQxwHS9TgXgEDChwoODCnkCi5QK2lSpces43D8B7cFoVIJCuTTs8pLKRCcB_BRCZGcGGWuk4wCFE1W0AhRBNEcXZ8XpGXqGgZqAegME0CoV3SaHKYrynIlXk6V5vgBsFla1rdeyh-oDIYXshIoGo6u_azhwTdnLz_cTaYZPyBwrMXAPrnpMF9ogqv4XFKvE4Rveeks5Tw45bruucj_3TWrwOFr5HShnyTkSCRIEkQKQwb6RAo-CvjEo9Rj1PPoV6bet29HPhrOKT33zxB91UMnp5mJOXdKskLl8IlXjstuJjMjEXvGYseJSmPIguNCynCMhjtvQyc1zCYSmVQNU927--xI-rxI6CwDMzilsQoXML2Orb3Oj4ZSRWiwvBln_n6hdLGsiGTJuM7kn0ldHZKYNWbj1VrviZvNJ2K7VfiXmi_9sG2XwmHrfbrHWz7lTDYtB9r_cP-49XDzyuG32lUjH6JdyH6nYONfgmHrej3Dzb6JQx-R5_9p6_nBcsJ6kQKjZV-lFb6J2F4g_k_puVKLfBSyUVmkw_9TJdNhKhNvsrywVDkS2mB22JmFXO7mFvFjl3sWMXtHTEritv2O5dYd6zqrl3ctYp7dnHPKu7bxf2_IXZiJ9YqiUlJyMpSZo8ZK8kZswetePP5-s2vAAAA__9Rtnq9 +distribution: full +vectorized: true +· +• sort +│ order: +lk,+rk +│ already ordered: +lk +│ +└── • lookup join (left outer) + │ table: rtable@primary + │ equality: (rk) = (rk) + │ equality cols are key + │ pred: st_intersects(geom1, geom) OR st_dwithin(geom, geom2, 2.0) + │ + └── • inverted join (left outer) + │ table: rtable@geom_index + │ + └── • scan + missing stats + table: ltable@primary + spans: FULL SCAN +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJzclc1u2zgUhffzFMRdOQgdm5T_opUyEwdw4LEytgdoURiBat0mamRSJek2QeB3Lyilja3ElIK2Gy_5c3guP54LPoL-koIPw3dX47PRhDTOR7P57L_xEZkNx8N_5iS9o0TdkYtp-C9JTfQxRTIeXszJZTiaEJVPBDcoV9eJiPGehBOizXUiDCqNS6MbhebEbmH0SZCPjkg4tXvjb4m5TURja4mSLRWnhNu958Mp-fs9aRQFHQEFIWOcRCvU4H8ABhQ4UPBgQSFTcolaS2WXHvONo_ge_DaFRGRrY6cXFJZSIfiPYBKTIvgwt6ZTjGJUrTZQiNFESZofXxQUZCpZReoBKMyySGifNFscFhsKcm2ez9UmukHw2YbW9x6Jr6gMxpcyEaha3q79_CFDvwAf_j8fTnP8QOHFAwD9edLwPlOlxwg4JUG3TD7w7Cwl_KTt-_7FODybDyzfT4nShnyWiSCJIFmUKIybdggUwrXxScBowGng0aBDg95eDvwtHOz9n56g9yYGz08zlvJunRWFS-GToGMLLgczZ9F_waJPieVRZqFxKUVcBaOzl4H3FgYzqQyq1unu_QN2TAN-DBRWkVnekhSFT9hex85ex2cjqWJUGL_us9i8UtpENmXWYnxHsq-E7k4JrH7zsXrN1-LNllez_SrcS-3XOdj2q-Cw1X79g22_CgZP7cfav7H_eP3w85rh95o1o1_hXYp-92CjX8FhK_qDg41-BYMf0Wd_6Ot5xXKKOpNCY60fpW3_JIxvsPjHtFyrJV4pucxtimGY6_KJGLUpVlkxGIliyRa4LWZOMXeLuVPsucWeU9zZEbOyuOO-c4V116nuucU9p7jvFved4oFbPPgVYqduYu2KmFSErCpl7pixipwxd9DKN19s_voeAAD__6TrdV4= query T -SELECT url FROM [EXPLAIN (DISTSQL) +EXPLAIN (DISTSQL) WITH q AS ( SELECT * FROM ltable WHERE lk > 2 ) @@ -117,47 +272,178 @@ SELECT count(*), (SELECT count(*) FROM q) FROM ( SELECT lk, rk FROM q LEFT JOIN rtable ON ST_Intersects(q.geom1, rtable.geom) -) GROUP BY lk] +) GROUP BY lk ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJyUU09vm04Qvf8-xWhOJtpfbSDtgRNuShoiCinGSqPUsghMLGqyi3eXKlHk714tOGliyag-ofnzZt577Dyj2tTo4SyIgrMMWlnDeZp8g9vgx1U0DWMYfQln2ex7ZMF1mF3ABqYzGO26T_reWud3NcH1RZAGUK_hZzuZuASOBbu-QrRcj04s9op8yfQDNrvvS7VeM5DrXQ2i4DyDyySMQfaLkhiUXlZck1RUaDXafFiReLDZrqGLLAu-psn8Cj7fQL1eIEMuSorzB1Lo3aKNC4aNFAUpJaRJPXcNYfmI3oRhxZtWm_SCYSEkofeMutI1oYe1KPIaVJFzuGvv70nCZDxBhiXpvKq78UmrPfBt5ju42DIUrf47Tul8RejZW_bvK0P-m6Sm8lJUnOTYfr8te2rI631K5lmQdm4hw94O39ixrHhJj8heJwWPjdyz0XcY-KcWMryvpNLwS1QcKg5NXkkq_zchsjfSmO8y_-NBgc4xAo2wlPKS5Ng5Slwjq4dcPiHDSIh12_SsBffAdw3b_bfSifxkRCoqBC-HVR4U5x4jbrpaSVrlWsix-16cb_7kNL5Zxkm2jOdRNPJtw-0smcfZMk2uZyMTpsRLkh4Y8rsjebkgcyQb6yDP02N4pqQawRW943ho8mS7YEjlivrjUaKVBV1JUXRr-jDpcF2iJKX7qt0HIe9LhuBbsD0IdobBziDYHQa7g-DTPfBi-9-fAAAA__-Mnap8 +distribution: local +vectorized: true +· +• root +│ +├── • render +│ │ +│ └── • group +│ │ group by: lk +│ │ +│ └── • lookup join (left outer) +│ │ table: rtable@primary +│ │ equality: (rk) = (rk) +│ │ equality cols are key +│ │ pred: st_intersects(geom1, geom) +│ │ +│ └── • inverted join (left outer) +│ │ table: rtable@geom_index +│ │ +│ └── • scan buffer +│ label: buffer 1 (q) +│ +├── • subquery +│ │ id: @S1 +│ │ original sql: SELECT * FROM ltable WHERE lk > 2 +│ │ exec mode: all rows +│ │ +│ └── • buffer +│ │ label: buffer 1 (q) +│ │ +│ └── • scan +│ missing stats +│ table: ltable@primary +│ spans: [/3 - ] +│ +└── • subquery + │ id: @S2 + │ original sql: (SELECT count(*) FROM q) + │ exec mode: one row + │ + └── • group (scalar) + │ + └── • scan buffer + label: buffer 1 (q) +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJyUk09vm0wQxu_vpxjNyY72rQ2kVbUn3JQ0RBRSjJVGrWURmFjUZBfvLlWiyN-9WnDSxJKt-oTmzzPz_AZ4Qr2ukWPw_SqahDEMPofTbPotGsJ1mF3AGiZTGEyDKDjL4ATO0-Qr1Ca_rQmuL4I0gHoFP9vx2CNwh7DtK2QrzOBkyF6Uz5l-wHr7fK7WKwZqta1BFJxncJmEMah-URKDNotKGFKaCqMH63dLkvcO2zZ00XAIX9JkdgWfbqBeIUMhS4rze9LIf6CDc4aNkgVpLZVNPXUNYfmAfMywEk1rbHrOsJCKkD-hqUxNyLGWRV6DLnIBt-3dHSkYj8bIsCSTV3U3PmkNB99hvovzDUPZmr_jtMmXhNzZsH9fGYrfpAyVl7ISpEbO223ZY0O8P1Myy4K0OxYy7K_h22ssKlHSA7KXScFDo3au6LsM_NMhMryrlDbwS1YCKgFNXikq_7chsldozPeY_34voHsMoAVLKS9Jjdyj4BpV3efqERlGUq7apnctBQffs253P5UO8oOF1FRIUR6m3AvnHQM3WS4VLXMj1ch7C-fbNzmJbxZxki3iWRQNfMd6O0tmcbZIk-vpwIYpiZIUB2vednEextnHveZOjzGXkm6k0PTG2L7J482cIZVL6v8YLVtV0JWSRbemD5NO1yVK0qavOn0Qir5kDb4WOwfF7mGxe1DsHRZ7B8WnO-L55r8_AQAA___ZCqGV # Anti joins are also converted to paired joins by the optimizer. query T -SELECT url FROM [EXPLAIN (DISTSQL) -SELECT lk FROM ltable WHERE NOT EXISTS (SELECT * FROM rtable WHERE ST_Intersects(ltable.geom2, rtable.geom))] +EXPLAIN (DISTSQL) +SELECT lk FROM ltable WHERE NOT EXISTS (SELECT * FROM rtable WHERE ST_Intersects(ltable.geom2, rtable.geom)) ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJzUlFFvmz4Uxd__n8K6T81fzhIgSVueqDaqUWXQJUyrVEUVi-8qVmoz20ytqnz3yRCtCWocsj3l0XCO7_ldHfkF1M8CfJiH0_B9SipZkMtZ8onchjfX04soJicfonk6_zztkbWkeGgUhc6-FUi-fgxnIYmTlIQ3RklO1rr_G5nclCl9l3ONUuFSq5Pmhnf3KB5duhbWp15vARS4YBhnj6jAvwUHKLhAwYMFhVKKJSolpPn1Ugsj9gT-kELOy0qbzwsKSyER_BfQuS4QfEjNgBlmDOVgCBQY6iwv6uubKEEp88dMPgOFeZlx5ZP-wAxNKu2TwKGBB4sVBVHp1yFKZ_cIvrOi3YNE_BdKjexK5BzlwNvOkj6X6JNpeJmS5EsazshVEsVAoVlQYBZ0l3OGT0D_3BQ-lbK13cClJBj1gML3XCpNfoick5yTMsslsr45bqK5NPBoMN4J6B4CaMDWi57shLuI06jF9rr_qRAPVdmEFtwngVlSEr_FODGMCpeCMzvkTjZvJ9srUsWFZCiRbfEsVm_Qx6IvysF5S_j26NHWaKd7gZ1uBR64_bpfB1d4T5RWhUfHV-E9gBsVPj26Crvde-R27JHX_5sW7QnSatH4-Fq0B3CjRWdH16I9j_wMVSm4wk7v3NA8lMjusXlVlajkEq-lWNZjmmNS--oPDJVu_jrNIeLNLxNw0-xYza7d7FrN3pbZaZs9e-yhffTI6h7bzWOreWI3T_4F-tRqPrNPPrOaz-3m84NiL1b__Q4AAP__dTiGJQ== +distribution: full +vectorized: true +· +• lookup join (anti) +│ table: rtable@primary +│ equality: (rk) = (rk) +│ equality cols are key +│ pred: st_intersects(geom2, geom) +│ +└── • inverted join (left outer) + │ table: rtable@geom_index + │ + └── • scan + missing stats + table: ltable@primary + spans: FULL SCAN +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJzUlNFv0zAQxt_5K6x72pBLm6TttjxlgkxkKslog5iEqinExxSW2cF20Kap_ztyMrE2Wt0Unvpo-z7f9zt9uidQv0rwIby-mp1HMTn6EC3SxefZMVmEs_B9Sso7cjFPPpFSZ99LJF8_hvOQxElKwmtTSY6e6962ZXK9TOmbgmuUCnOtjtof3t2iuHfpc2FzOj4GClwwjLN7VOB_AwcouEDBgyWFSooclRLSPD01hRF7AH9EoeBVrc31kkIuJIL_BLrQJYIPqfl_jhlDORwBBYY6K8rm-9ZJUMniPpOPQGFRZVz5ZDA0TZNa-yRwaODBckVB1PqlidLZLYLvrGh_IxH_jVIjuxQFRzn0Nr2kjxX6ZBZepCT5koZzcplEMVBo5xOY-dwUnOED0L8_hQ-V7Aw3cCkJxmaQPwqpNPkpCk4KTqqskMgG5riO5tLAo8FkK6C7D6ABex70dCvceZxGHbaX-c-EuKur1rTgPgnMkJL4NcapYVSYC87skFvZvK1sL0g1F5KhRLbBs1y9Qh-LgaiGZ53C11uPN1o7_QPs9Avw0B00-do7wjusdCI8PrwI7wBci_DJwUXY7Z8jt2eOvMG_pGiHkU6KJoeXoh2Aayk6PbgU7Vjyc1SV4Ap77bmRWZTIbrHdqkrUMscrKfKmTXtMGl1zwVDp9tVpDxFvn4zBdbFjFbt2sWsVextipyv27LZH9tZjq3piF0-s4qldPP0f6BOr-NTe-dQqPrOLz_ayvVy9-RMAAP__XKWAxg== query T -SELECT url FROM [EXPLAIN (DISTSQL) +EXPLAIN (DISTSQL) SELECT lk FROM ltable WHERE NOT EXISTS ( SELECT * FROM rtable WHERE ST_Covers(ltable.geom1, rtable.geom) AND lk > 5 AND rk > 12 -) ORDER BY lk] +) ORDER BY lk ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJzcVV1vm0oUfL-_4ug82feurw3YjrNPpA1RiVxIMVVTpVZEzWlETVi6C1GiyP-9Atz4Q_XaaZ-Sx92d4czMjpZHVD9S5Dhxxs7bEEqZwlngv4cr5_JifOJ60Dp1J-Hkw7gNS0g6bxBpEX1NCT69cwIHPD8E57JCQmuJ-7eByXVYSxXXM3FHUrUa-v83JG4NtkTVqzaceKfQSufwpez1LIJBe7kln7YMs90GPzh1AnjzGdL5FBlmIiYvuiWF_AoNZGgiQwunDHMpZqSUkNXRYw1043vkPYZJlpdFtT1lOBOSkD9ikRQpIcewkhRQFJPs9pBhTEWUpPXnG_F2LpPbSD4gw0keZYpDp1sN9cuCg20w28TpgqEoi9UQVUQ3hNxYsMOFuNkdyYLic5FkJLvWppbwIScOY-csBP9j6ARw7rseMmwitatIr5MspntkT19y7nMJq7uwTQZ2v11J96BlG0_Jc85dLxwt87etVf6_TpDht0SqAr6LJIMkgzxKJMWdarkRBbMtZg92BmI-J5AqiOXFDHeGceKF7lYWq_saCzEv80a0yDjYVmN-K5Nh5U_RTGSx3uBOX9ZOXys7QsYkKd50Yhv_4XTxG_Oe6Ii8e7yB3jW9vzHdOLzvxmF975qduo7PbvweKVuN77_-xu8JZK3xRy-q8ebhnTMP7JzV-ZPG7RGy1bjB62_cnkDWGjd6UY3b8-8ISOUiU3TQ-9mrHmCKb6h5sJUo5YwupJjVY5qlX_PqjZhU0ZwazcLNmqNK4DrZ0JJNPdnUkq0NsrFNtvSye_rRfS17oCcPtOShnjz8G9NHWvJIP3mkJR_rycfPkj1d_PMzAAD__yZUqzs= +distribution: full +vectorized: true +· +• lookup join (anti) +│ table: rtable@primary +│ equality: (rk) = (rk) +│ equality cols are key +│ pred: st_covers(geom1, geom) +│ +└── • inverted join (left outer) + │ table: rtable@geom_index + │ on: (lk > 5) AND (rk > 12) + │ + └── • scan + missing stats + table: ltable@primary + spans: FULL SCAN +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJzcVU9vm04Qvf8-xWhO9q_r2oDtOHsibYhK5EKKqZqqtSJqphE1YekujhJF_u4V4MZ_VK9Je0qOOzOPee_t0_KA6meKHJ3Li_GJ60Hr1J2Ekw_jNkycsfM2hHQOZ4H_HtIi-pYSfHrnBA54fgjOZTkJrdXc__WY3BxrqeJqJm5JqlYNf31N4sZgq6nq1IYT7xRa6Ry-Lno9i2DQXpXkY8kw223wg1MngDefIZ0jw0zE5EU3pJB_QQMZmsjQwinDXIoZKSVk2XqoBt34DnmPYZLli6IsTxnOhCTkD1gkRUrIMSwZBRTFJLs9ZBhTESVp9fmau53L5CaS98hwkkeZ4tDplkv9RcHBNpht4nTJUCyK9RJVRNeE3Fiy5kTc7JZkQfG5SDKSXWubS3ifE4excxaC_zF0Ajj3XQ8Z1o7apaNXSRbTHbLHLzl3uYT1VdgmA7vfLql70LKNR-M5564Xjlb229ba_t8dZPg9kaqAHyLJIMkgjxJJcac8blnBbIvZg72GmE8xpDRidTHDvWaceKG748X6vsZCzBd5TVpkHGyrFr_jybDUp2gmslgvcK8ua6-utRwhY5IUbyuxjVc4Xf5BvCc6Iu8eb03v297f2m40z7vRLO9ds1PF8cmJP0BlJ_H9l5_4A4ZsJP7oWSXebJ45s2HmrM7fJO4AkZ3EDV5-4g4YspG40bNK3IF_R0AqF5miRu9nr3yAKb6m-sFWYiFndCHFrFpTH_0KVxViUkXdNeqDm9WtkuAm2NCCTT3Y1IKtLbCxC7b0tHv61X0teqAHD7TgoR48_BfRR1rwSL95pAUf68HHT6I9Xf73KwAA__9B_KXc # Bounding box operations. statement ok SET CLUSTER SETTING sql.spatial.experimental_box2d_comparison_operators.enabled = on query T -SELECT url FROM [EXPLAIN (DISTSQL) -SELECT lk, rk FROM ltable JOIN rtable@geom_index ON ltable.geom1 ~ rtable.geom] +EXPLAIN (DISTSQL) +SELECT lk, rk FROM ltable JOIN rtable@geom_index ON ltable.geom1 ~ rtable.geom ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJzElMGO2jwQgO__U1hz2pXMD0mAhZxStVTKiiZb4FBpFa1SPEIpwU5tZ0WF2GevkqBCKJjQSuUW2_N5Pnsm3oD6noIL09F49H5GcpmSj5PwE3kefXkav_MDcvfBn86mn8f3ZBeSLimRyyoq1fHXFMlj6AdElt_eAsXqJeEM1yQMdgH_F5MWedvFlMMIKHDBMIhXqMB9Bgso2EDBgYhCJsUclRKyWNqUgT5bg9uhkPAs18V0RGEuJIK7AZ3oFMGFWbH9BGOGst0BCgx1nKTl9pWJl8lkFcsfQGGaxVy5pNUukoa5dolnUc-GaEtB5HqfROl4geBaW9pcxOevKDWyR5FwlG2n7vLbVQH9RYzWmSRKv8zFK0p159mUeN37miL1nLOW9jWWhd3utvonDfe3NRZimWfkm0g4EdwlXnGkMCCeTd6I1zv0Oy_nnJXbO-VcSIYSWU0o2p7QD0RLZO3hUeDp1N1aaqt5G1nN2qhtt8oqX91IF1SOGql7o0a6YHnQSA__vpHs5tW0G1bTaf1JLS-IHNWyd6NaXrA8qOXgto_CCbkJqkxwhY3--U7xaCBbYPXCKJHLOT5JMS_TVMOw5MoJhkpXq1Y18Hm1VAgewpYRts2wbYSdGmwdw45Zu2NO3TXSPTPcM8J9M9z_m0M_GOGBOfPACA_N8PAq7Wj7388AAAD__5r_BqA= +distribution: full +vectorized: true +· +• lookup join +│ table: rtable@primary +│ equality: (rk) = (rk) +│ equality cols are key +│ pred: geom1 ~ geom +│ +└── • inverted join + │ table: rtable@geom_index + │ + └── • scan + missing stats + table: ltable@primary + spans: FULL SCAN +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJzElM2O2jAQgO99itGcdiVTSAIs5JSqpVJWNNkCh0oVWqVkhFKCndrOigqxz14lQeWnYEIrlVtsz-f57Jl4jepHii4OvjwN3_kB3H3wx5Px5-E9jAfDwfsJpAsGcgEfR-EnSHX0LSV4DP0AZPntzUksnxMe0wrCYBvwtpi04HUbUw6RIRcxBdGSFLpf0UKGNjJ0cMowk2JGSglZLK3LQD9eodtimPAs18X0lOFMSEJ3jTrRKaGLk2L3EUUxyWYLGcakoyQtt69EvEwmy0j-RIbjLOLKhUazSBrm2gXPYp6N0w1DketdEqWjOaFrbVh9EZ-_kNQUP4qEk2w6hy5_3BSy38RglUlQ-nkmXkiqO89m4LXvDxSZ55y1tK-xLOy2t9U9abi7raEQizyD7yLhILgLXnGkMADPhlfwOvt-5-Wcs3I7p5wLGZOk-EBoujmhH4iGyJr9o8DTqdsHqa36bWTVa6Om3SirfHUjXVA5aqT2jRrpguVeIz38_0ay61fTrllNp_E3tbwgclTLzo1qecFyr5a92z4KJ-RGpDLBFdX651vFo0HxnKoXRolczuhJilmZphqGJVdOxKR0tWpVA59XS4XgPmwZYdsM20bYOYCtY9gxa7fMqdtGumOGO0a4a4a7_3LoByPcM2fuGeG-Ge5fpT3dvPkVAAD__87dAUE= query T -SELECT url FROM [EXPLAIN (DISTSQL) -SELECT lk, rk FROM ltable JOIN rtable@geom_index ON rtable.geom ~ ltable.geom1] +EXPLAIN (DISTSQL) +SELECT lk, rk FROM ltable JOIN rtable@geom_index ON rtable.geom ~ ltable.geom1 ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJzElFFv2jAQx9_3Kax7aiUzSAIU8pRpY1IqRjrgYVIVVSk5oYxgZ7ZTUSH62ScnbBAGJmzSeIvP9_f_57uL1yB_pODCZDAcfJySXKTk8zj4Qh4H3x6GH_wRufnkT6aTr8Nbsk1JF5SIRZmVqug5RXIf-CMiim9vjnz5lLAYVyT4FXyvg-Rtm16srBAoMB7jKFqiBPcRLKBgAwUHQgqZ4DOUkgu9tS4S_XgFbotCwrJc6XBIYcYFgrsGlagUwYWpPn-MUYyi2QIKMaooSYvjS28vE8kyEq9AYZJFTLqk0dSmQa5c4lnUsyHcUOC52plIFc0RXGtD64P47AWFwvieJwxF06my_FEqoL8Vg1UmiFRPM_6CAuPn1xvPpsRr31YoqeecBLUvAdWA24J1j0LuCjbkfJFn5DtPGOHMJZ6-VTAiXoe8Ea9SxdNwzkm4HVPOuIj15StA4eYI_og3eNbsHyQet25XrK36k2TVm6Sm3SgaffEsnUE5mKX29WbpDOjeLN39_1my6zfUrtlQp_E37TwDctDOzvXaeQZ0r5296z4NR-DGKDPOJNb681v66cB4juU7I3kuZvgg-KywKZdBoSsCMUpV7lrlwmfllgbcF1tGsW0W20axUxFbh2LHjN0yW7eN6o5Z3DGKu2Zx918ufWcU98zOPaO4bxb3L8ION-9-BgAA__9vVwoz +distribution: full +vectorized: true +· +• lookup join +│ table: rtable@primary +│ equality: (rk) = (rk) +│ equality cols are key +│ pred: geom ~ geom1 +│ +└── • inverted join + │ table: rtable@geom_index + │ + └── • scan + missing stats + table: ltable@primary + spans: FULL SCAN +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJzElFFv2j4QwN__n8K6p1Yyf0gCFPKUaWNSKkY64GHShKoUn1BGsDPbqagQ_eyTk24QBiZs0njDZ_9yP98d3oD6noIPgy8Pw3fhiNx8CCfTyefhLZkMhoP3U5IuKZFL8nEcfSKpjp9SJPdROCKy-B0sUKweE85wTaKfwf9NkLy-HS9WDlDgguEoXqEC_yuYgAsUPJhRyKSYo1JCmq1NcTBka_BbFBKe5dqEZxTmQiL4G9CJThF8mJrPjzFmKJstoMBQx0lafL5MHWQyWcXyBShMspgrnzSaJmmUa58EDg1cmG0piFzvkigdLxB8Z0vri4T8GaVGdi8SjrLpVV1-qxTQX8RgnUmi9ONcPKNE9vRyE7iUBO3biiUNvJOi7iWiRvCtYN2jkruCDYVY5hn5JhJOBPdJYG4VjUjQIa8kqFTxtJx3Um7nlHMhmbl8RWi2PaI_Eg2RNfsHB4-nbldSO_Unyak3SU23UTT64lk6o3IwS-3rzdIZ0b1Zuvv3s-TWb6hbs6Fe40_aeUbkoJ2d67XzjOheO3vXfRqOyI1RZYIrrPXPb5mnA9kCy3dGiVzO8UGKeZGmXEYFVwQYKl3uOuUi5OWWEdyHHSvs2mHXCnsV2DmEPbt2y566baU7drhjhbt2uPs3l76zwj175p4V7tvh_kXas-1_PwIAAP__ct4E1A== query T -SELECT url FROM [EXPLAIN (DISTSQL) -SELECT lk, rk FROM ltable JOIN rtable@geom_index ON rtable.geom && ltable.geom1] +EXPLAIN (DISTSQL) +SELECT lk, rk FROM ltable JOIN rtable@geom_index ON rtable.geom && ltable.geom1 ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJzMlM-O2jAQh-99CmtOu5Ip-QMs5JSqpVJWlGyBQ6VttErxCKUEO7Wdigrx7lUSWggFE9oDvSBi-_N89m_kDahvKXgwHY6Gb2cklyl5Pwk_kOfhp6fRm2BM7t4F09n04-ie7JakS0rkslqV6vhLiuQxDMZElv_9BYrVS8IZrkn4a_B1MUg-55bl9KrfHVlO2BFQ4ILhOF6hAu8ZbKDgAAUXIgqZFHNUSshialMuDNgaPItCwrNcF8MRhbmQCN4GdKJTBA9mxf4TjBnKtgUUGOo4Scvtq9p-JpNVLH8AhWkWc-WRVrsoGubaI75NfQeiLQWR630RpeMFgmdvaXORgH9HqZE9ioSjbLt1lz9uDehvYrjOJFH6JeEapcK5Vne-Q4nfua9pUt89a-pcY1oY7m6sd9Jyf2MjIZZ5Rr6KhBPBPeIXxwrHxO_WY_ZrN3re0z3rudfLuZAMJbKaW7Q9cZKxaImsPThaeLp0p1babt5VdrOuajutMvSr--qCylFfdW7YVxdMD_rq4aZ95TQP12kYrtv6m2gviBxF271htBdMD6Lt_zdPxgnPCapMcIWNXgSreFKQLbB6f5TI5RyfpJiXZarPsOTKAYZKV7N29RHwaqoQPIRtI-yYYccIuzXYPoZds7ZlLt0x0l0z3DXCPTPc-5dDPxjhvrly3wgPzPDgKu1o--pnAAAA___waBaG +distribution: full +vectorized: true +· +• lookup join +│ table: rtable@primary +│ equality: (rk) = (rk) +│ equality cols are key +│ pred: geom && geom1 +│ +└── • inverted join + │ table: rtable@geom_index + │ + └── • scan + missing stats + table: ltable@primary + spans: FULL SCAN +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJzMlE-P2jwQh-_vp7DmtCuZl_wBFnJK1VIpK0q2wKFSi1YpHqGUYKe2U1EhvnvlZFsIBRPaA70gMs6TeezfyFtQXzMIYPjhafQqGpO7N9F0Nn0_uifT4Wj4ekayFSVyRd5O4nck08nnDMljHI2JLP-HSxTr55Qz3JD4Z_F_UySfCsfxetXvC1kuuECBC4bjZI0Kgo9gCh5Q8GFOIZdigUoJaZa25YsR20DgUEh5XmhTnlNYCIkQbEGnOkMIYGY-P8GEoWw7QIGhTtKs_HzVOsxluk7kd6AwzROuAtJqm6ZxoQMSujT0YL6jIAq9b6J0skQI3B1tLhLxbyg1skeRcpRtv-7y26EB_UUMN7kkSj-nXKNUuNDqLvQoCTv3NU0a-mdNvWtMjeHLifVOWu5PbCTEqsjJF5FyInhAQrOteEzCbj3lsHai5z39s557vYILyVAiq7nNdyd2MhYtkbcHRy-ebt2ptXabT5XbbKraXqsM_eq5uqByNFedG87VBdODuXq46Vx5zcP1Gobrt_4k2gsiR9F2bxjtBdODaPv_zJVxwnOCKhdcYaMbwTFXCrIlVvePEoVc4JMUi7JN9RiXXFlgqHS16lYPEa-WjOAh7Fphzw57Vtivwe4x7Nu1HXvrjpXu2uGuFe7Z4d7fbPrBCvftnftWeGCHB1dpz3f__QgAAP__-LoRJw== # Tests where the table with the inverted index has multiple columns in the primary # key. @@ -180,30 +466,106 @@ INSERT INTO rtable2 VALUES (16, 'POLYGON((1.0 1.0, 5.0 1.0, 5.0 5.0, 1.0 5.0, 1.0 1.0))', 32) query T -SELECT url FROM [EXPLAIN (DISTSQL) +EXPLAIN (DISTSQL) SELECT lk, rk1, rk2 FROM ltable JOIN rtable2@geom_index -ON ST_Intersects(ltable.geom1, rtable2.geom) ORDER BY (lk, rk1, rk2)] +ON ST_Intersects(ltable.geom1, rtable2.geom) ORDER BY (lk, rk1, rk2) ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJzMlF1v2jAUhu_3K6xzVVQzsAO0zVW2lUlUDDroxaYKVRk56rIGO7OdqVPFf5-cdCvJGifsQ-0NIsl58z45euQ70F8T8GE5no7fXJBMJeTtYv6OXI4_nE9fTWbk4HSyvFi-n3bI_UhyQ4m6YfaHF7OJCT8lSM7mkxlR-X8eXKPcXMUiwlsynxFtrmJhUGlcG31QzL-0I_Y1RSK_7JD54nS8IK8_koPdns4KKAgZ4SzcoAb_EhhQ4EDBgxWFVMk1ai2VfXSXD06iW_D7FGKRZsbeXlFYS4Xg34GJTYLgw4UtXmAYoer1gUKEJoyT_PUFYpCqeBOq70BhmYZC-6Tbs6XzzPgkYDTgsNpSkJl5KNEmvEbw2Za2B5mIb6gMRmcyFqh6Xpnl95UC_RUZ36aqst6AUxIMOiVOGng0GNbS8n1oLeX91kaPkz6sbSrlTZaSLzIWRAqfWIyBJas6kUOPStD5aB2xtw_xUiqDqndSpg3YIQ34IQ28Q6CwCc36M0lQ-ITVtg5qWx_KpIpQYVTftdo-gjiTXZn2GC_F6jCGJQzW3nLWzvIe7-YS7u15A0rF88ETe95Au-P50TPxvIH43nPW_8ei8_aG8ZaGed0_8asBpOLX8In9aqDd8ev4mfjVQPzTL_YfD9JHaheoUyk0tjob-_Z0xegai1NZy0yt8VzJdV5TXM7zXH4jQm2Kp6y4mIjikQXcDTNnmLvD3Bn23GHPGR6UwqwaHri_uaF66EyP3OGRM3zkDh85w8fu8PHfbOzEvbF-gyYNkjVZ5taMNXjG3KJVv3y1ffEjAAD__z3N3qQ= +distribution: full +vectorized: true +· +• sort +│ order: +lk,+rk1,+rk2 +│ already ordered: +lk +│ +└── • lookup join + │ table: rtable2@primary + │ equality: (rk1, rk2) = (rk1,rk2) + │ equality cols are key + │ pred: st_intersects(geom1, geom) + │ + └── • inverted join + │ table: rtable2@geom_index + │ + └── • scan + missing stats + table: ltable@primary + spans: FULL SCAN +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJzMlF9v0zwUxu_fT2Gdq1Vz39ZO2225CrAidSrNaHcBQtUUkqMRltrBdtHQ1O-OnAzWhMXJ-KPtpqpjP3l-OfrJt6C_ZODD9N35_MVsQQ5OZ6uL1dt5j6ym8-mrC5JdU6Kumf3h5PUyfEMyE33MkJyFswVRxX8eXKHcXKYiwRsSLog2l6kwqDTGRh-U5_-3R-xrykSx7JFweTpdkpfvycF-Tw8oCJngItqgBv8DMKDAgYIHawq5kjFqLZXdui0OzpIb8IcUUpFvjX28phBLheDfgklNhuDDhe1dYpSgGgyBQoImSrPi9SVhkKt0E6lvQGGVR0L7pD-wpeHW-CRgNOCw3lGQW3Nfok10heCzHe0OMhNfURlMzmQqUA28KsuvEwX6MzK9yVVtugGnJBj1Kpw08GgwbqTlj6G1lHdTmzxMej-2uZTX25x8lqkgUvjEYowsWV2JAnpSgS6ONhF7jyFeSWVQDU6qtAE7pAE_pIF3CBQ2kYk_kQyFT1hj66ix9b5MqgQVJs1d690DiAvZl_mA8UqsCWNcwWDdLWfdLB_wfiHhoz1vQal5Pnpiz1to9zw_eiaetxDfec6Gf1l03t0w3tEwr_87frWA1PwaP7FfLbR7fh0_E79aiH_4xf7hRfpA7RJ1LoXGTnfj0N6umFxheStruVUxnisZFzXlMixyxYMEtSl3WbmYiXLLAu6HmTPM3WHuDHvusOcMjyphVg-P3N_cUj12pifu8MQZPnKHj5zhY3f4-E8mduKe2LBFkxbJ2ixza8ZaPGNu0epfvt799z0AAP__-cXZRQ== query T -SELECT url FROM [EXPLAIN (DISTSQL) +EXPLAIN (DISTSQL) SELECT lk, rk1, rk2 FROM ltable LEFT JOIN rtable2@geom_index -ON ST_Intersects(ltable.geom1, rtable2.geom) ORDER BY (lk, rk1, rk2)] +ON ST_Intersects(ltable.geom1, rtable2.geom) ORDER BY (lk, rk1, rk2) ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJzUVV1v2jAUfd-vsO5TUc3ADh9tnrKtqUTFSAdM2lShKkvuuqzBzmwztar475OTbgVWHNjHAy9I_jj3nHM5N34A_S0HHybhMHwzJQuVk_Nx9JZchR8uh68GI3J0NphMJ--GDfJ4Jb-lRN0y-8Oru7mJP-VIhuH5lFxEgxFR5QYPblDOrzOR4h2JRkSb60wYVBoTo48q0Et7xdaqEOWyQaLxWTgmrz-So1WyxgwoCJniKJ6jBv8KGFDgQMGDGYVCyQS1lsoePZQXB-kd-G0KmSgWxm7PKCRSIfgPYDKTI_gwtcRjjFNUrTZQSNHEWV6WryQGhcrmsboHCpMiFtonzZYljRbGJwGjAYfZkoJcmCcSbeIbBJ8t6e5CBuI7KoPphcwEqpa3rmV6X6BftTh6Pw3HZaOBwu-tBvqrVHhXqI22B5ySoNMACp8zpQ35KjNBMkGKOFOYNu1yzRsNPBp0adDbapLvY9Kae2x2bz-DT__CUMrbRVEpl8InVmHHit6MWOm1b71qTKRI68yWdbbZ9PaxOZHKoGqdrlsM2DEN-DENvGOgMI9N8oXkKHzCtrJ2trI-kUmVosJ0O9ds-YzEkWzKosX4GmybjO6aDLb7RLHdJqrFm2Xg956pGikbM9U5zJmqMbkyU_1Dnqkam48zxdr_eKj47mnmO6bZa_5JlmuEbGS5e5hZrjG5kuWTQ85yjc2fWWb_8YF4hnaMupBC407f_LZ9NTC9weq10XKhErxUMilpqmVU4sqNFLWpTlm1GIjqyApcBTMnmLvB3An23GDPCe6sgdkmuOP2XEPddaJ7bnDPCe67wX0n-MQNPvmbjp26O9auiUlNyOpS5o4Zq8kZcwdt0_ls-eJHAAAA___Z7kVN +distribution: full +vectorized: true +· +• sort +│ order: +lk,+rk1,+rk2 +│ already ordered: +lk +│ +└── • lookup join (left outer) + │ table: rtable2@primary + │ equality: (rk1, rk2) = (rk1,rk2) + │ equality cols are key + │ pred: st_intersects(geom1, geom) + │ + └── • inverted join (left outer) + │ table: rtable2@geom_index + │ + └── • scan + missing stats + table: ltable@primary + spans: FULL SCAN +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJzUVV1v2jwYvX9_hfVctap5wQ4fba6yralExUgHTNo0oSpLnnVZg53ZZmpV8d8nJ90KrDhhHxfcVLKd43PO03PwA-ivOfgQvrsavRiOydH5cDqbvhkdk2k4Cl_NSH5Libpl9g8nF5PoNclN_DFHMgovZuQyGo6JKjd4cINycZ2JFO9INCbaXGfCoNKYGH1Ugf63n9i7KkS5PCbR5DyckJfvydE62TFQEDLFcbxADf4HYECBAwUP5hQKJRPUWip79FB-OEzvwO9QyESxNHZ7TiGRCsF_AJOZHMGHmeWdYJyianeAQoomzvLy-kphUKhsEat7oDAtYqF90mpb0mhpfBIwGnCYryjIpXki0Sa-QfDZijYXMhTfUBlML2UmULW9TS2z-wL9asLR21k4KecMFH6dNNCfV4V3hdqaesApCbp2kp8ypQ35IjNBMkGKOFOYtuxywxsNPBr0aNDfaZLvY9Kaexx2fz-DT_-FkZS3y6JSLoVPrMKuFb2dsNLrwHrVmEiR1pkt79ll09vH5lQqg6p9tmkxYCc04Cc08E6AwiI2yWeSo_AJ28na3cn6RCZVigrT3Vzz1TMSx7IlizbjG7BdMnobMljzRrFmjWrzVhn4vTtVI2WrU93D7FSNybVODQ65UzU2HzvFOn-5VLx5mnnDNHut38lyjZCtLPcOM8s1JteyfHrIWa6x-SPL7B8-EM_QTlAXUmhs9Jvfsa8GpjdYvTZaLlWCV0omJU21jEpcuZGiNtUpqxZDUR1Zgetg5gRzN5g7wZ4b7DnB3Q0w2wZ33Z5rqHtOdN8N7jvBAzd44ASfusGnfzKxM_fEOjUxqQlZXcrcMWM1OWPuoG07n6_--x4AAP__rvs_7g== query T -SELECT url FROM [EXPLAIN (DISTSQL) +EXPLAIN (DISTSQL) SELECT lk FROM ltable WHERE EXISTS (SELECT * FROM rtable2@geom_index -WHERE ST_Intersects(ltable.geom1, rtable2.geom)) ORDER BY lk] +WHERE ST_Intersects(ltable.geom1, rtable2.geom)) ORDER BY lk ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJzUlFFP2z4Uxd__n8K6T_Q_d22StkCeso2gBZWWtZXGhCKUxXcoI9iZ7Uwg1O8-OemAdNRNtxd4dHxO7vldHfke1I8cfJiH4_DDgpQyJ8ez6Sm5CM_Pxu-iCdk7iuaL-adxh6wk-XWtyHXyNUfy-WM4C0l4blRkb6X5v5bISuIGVyhuLjPO8HYlV_oy4xqlwlSrvfpPb43Kob9N1bHTIdPZUTgj77-Q_DoGClwwnCQ3qMC_AAcouEDBg5hCIUWKSglpru4rYcRuwe9TyHhRavM5ppAKieDfg850juDDwkybYcJQ9vpAgaFOsrz6fZ0rKGR2k8g7oDAvEq580u2ZodNS-yRwaOBCvKQgSv04ROnkCsF3lrR9kIj_RKmRnYiMo-x5zSx_rhLogyW8LeTaTgOXkmDQAQrfMqk0-S4yTjJOiiSTyLrm2GCggUeDIQ1GG2HcXWAMxGqpoybI4q5An4zD4wWZh6cROZlGE6APfI_LHgtxXRZ1cMF9YgIOTObJc6j7BlVhKjizs27k8zbyPWIJyVAiaxIFzhuIl88sYSK6ougdNtSbpg8a0532nXXadbbndqtK7dzaLVHWWjt42a3dAvOktfuvsrVu-964LXvjdf-mNVuCrLVm-LJbswXmSWsOXmVrtrzlM1SF4ApbvWN98xAiu8L64VSilCmeSZFWY-rjtPJVHxgqXd869SHi9ZUJ-NTsWM2u3exazV7D7KybPXvsvn30wOoe2s1Dq3lkN4_-BXrfaj6wTz6wmg_t5sOdYsfL_34FAAD__7Tvflc= +distribution: full +vectorized: true +· +• lookup join (semi) +│ table: rtable2@primary +│ equality: (rk1, rk2) = (rk1,rk2) +│ equality cols are key +│ pred: st_intersects(geom1, geom) +│ +└── • inverted join + │ table: rtable2@geom_index + │ + └── • scan + missing stats + table: ltable@primary + spans: FULL SCAN +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJzUlFFv0zAUhd_5FdZ9WsGlTdJ2W54CLBOZunaklRhC1RTiyxSW2cF20aap_x05KWtTVjeFl-3R8T0557s68gOonzn4EF5eDN9FI3JwEk2mk0_DFpmEw_DDlOQ35DQen5NcJ99yJJ8_hnFIwkszRQ6WM6-rEVmOuME1iturjDO8W44rfZVxjVJhqtVB9ae3Zsqhf0TlsdUi4_gkjMn7LyS_AQpcMBwlt6jA_woOUHCBggczCoUUKSolpLl6KAcjdgd-l0LGi7k2n2cUUiER_AfQmc4RfJgasxgThrLTBQoMdZLl5e-rWEEhs9tE3gOFSZFw5ZN2x5iO59ongUMDF2YLCmKuVyZKJ9cIvrOgzYNE_BdKjexMZBxlx6tn-XuTQB8l4V0hN1YauJQEvRZQ-J5JpckPkXGScVIkmUTWNscaAw08GvRpMNgK4-4DYyCWSx3UQab3BfpkGJ5OySQ8j8jZOBoBfeRbLXsoxM28qIIL7hMTsGcyj55CPTSoClPBmZ11K5-3lW-FJSRDiaxOFDhvYLZ4Ygkj0RZF57g2vc29V3N3mnfWadbZjtsuK7V3a3dE2Wht73m3dgfMWmsPX2Rr3ea9cRv2xmv_S2t2BNloTf95t2YHzFprjl5ka3a85TGqQnCFjd6xrnkIkV1j9XAqMZcpXkiRljbVcVzqyg8Mla5uneoQ8erKBFwXO1axaxe7VrFXEzubYs8eu2u37lnVfbu4bxUP7OLB_0AfWsVHducjq_jYLj7eK_Zs8ep3AAAA__8d9Xj4 query T -SELECT url FROM [EXPLAIN (DISTSQL) +EXPLAIN (DISTSQL) SELECT lk FROM ltable WHERE NOT EXISTS (SELECT * FROM rtable2@geom_index -WHERE ST_Intersects(ltable.geom1, rtable2.geom)) ORDER BY lk] +WHERE ST_Intersects(ltable.geom1, rtable2.geom)) ORDER BY lk ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJzUlFFv0z4Uxd__n8K6T-sflzZJ2215ymCZyFSSkQYxNFVTqC9TWGYH20Wbpn535KSwtaxuCk99dHyO7_k5R34E9b0EHybhOHybkbksyVmavCdX4eXF-CSKycFpNMkmH8YdspSUt42i1PmXEsmnd2EakjjJSHhplORgqfu_kcla5gY3KO6uC87wfmlR-rrgGqXCmVYHzWmvjcqhv0z1stMhSXoapuTNZ1LeToECFwzj_A4V-FfgAAUXKHgwpVBJMUOlhDRbj7UwYvfg9ykUvJpr83lKYSYkgv8IutAlgg-ZmZZizlD2-kCBoc6Lsj6-yRVUsrjL5QNQmFQ5Vz7p9szQZK59Ejg0cGG6oCDm-mmI0vkNgu8saPsgEf-BUiM7FwVH2fNWs2QPFfpkHJ5lJPmYhSk5T6IYKPx5xUB_HxXeV3LtrgOXkmDQAQpfC6k0-SYKTgpOqryQyLpmucJGA48GQxqMNkK6u0AauOVljzYCnsRZtM739BPGQtzOqya44D4xAQcmc_wS6qFBVTgTnNlZN_J5G_mesIRkKJGtEgXOK5guXriEWHRF1TteUW-aPliZ7rTvstOuyz23W1dt5zZvibLW5sF-tnkL5LM2H-5lm932fXJb9snr_k2btgRZa9NwP9u0BfJZm472sk1b3v4UVSW4wlbvXt88nMhusHlolZjLGV5IMavHNMuk9tUfGCrd7DrNIuLNlgn43OxYza7d7FrN3orZWTd79th9--iB1T20m4dW88huHv0L9KHVfGSffGQ1H9vNxzvFni7--xkAAP__UJCTJA== +distribution: full +vectorized: true +· +• lookup join (anti) +│ table: rtable2@primary +│ equality: (rk1, rk2) = (rk1,rk2) +│ equality cols are key +│ pred: st_intersects(geom1, geom) +│ +└── • inverted join (left outer) + │ table: rtable2@geom_index + │ + └── • scan + missing stats + table: ltable@primary + spans: FULL SCAN +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJzUlFFv0zAUhd_5FdZ9WsGlTdJ2W54yWCYylWSkQQyhagr1ZQrL7GC7aNPU_46cDLaU1c3gqY-O7_E5n3PkO1A_SvAhPD-bHkUx2TuOZtnsw7RHZuE0fJuR8oqcpMl7Uur8a4nk07swDUmcZCQ8N5Nk737uZTMm6zE3uERxfVFwhjf3EqUvCq5RKlxotdec9tpMOfS3qF72eiRJj8OUvPlMyiugwAXDOL9GBf4XcICCCxQ8mFOopFigUkKarbt6MGI34A8pFLxaavN5TmEhJIJ_B7rQJYIPmTFLMWcoB0OgwFDnRVkf38QKKllc5_IWKMyqnCuf9AfGNFlqnwQODVyYryiIpX4wUTq_RPCdFe0eJOI_UWpkp6LgKAdeO0t2W6FPpuFJRpKPWZiS0ySKgcLfNwz0z1HhTSXXrjpwKQlGPaDwrZBKk--i4KTgpMoLiaxvli02Gng0GNNgshHSfQ6kgbu_7MlGwKM4i9b5Hn7CVIirZdUEF9wnJuDIZI6fQt03qAoXgjM760Y-byPfA5aQDCWyNlHgvIL56olLiEVfVIPD1vQm91HL3eneZadblwduv67as9u8Jcpam0e72eYtkI_avL-TbXa798nt2Cev_y9t2hJkrU3j3WzTFshHbTrYyTZteftTVJXgCju9e0PzcCK7xOahVWIpF3gmxaK2aZZJras_MFS62XWaRcSbLRPwsdixil272LWKvZbYWRd79thDu_XIqh7bxWOreGIXT_4Het8qPrA7H1jFh3bx4bNiz1cvfgUAAP__IaeNxQ== diff --git a/pkg/sql/logictest/testdata/logic_test/inverted_join_json_array_dist b/pkg/sql/logictest/testdata/logic_test/inverted_join_json_array_dist index 258c2f324184..7d6cebb35aa4 100644 --- a/pkg/sql/logictest/testdata/logic_test/inverted_join_json_array_dist +++ b/pkg/sql/logictest/testdata/logic_test/inverted_join_json_array_dist @@ -71,66 +71,205 @@ NULL /10 {1} 1 # This query performs an inverted join. query T -SELECT url FROM [EXPLAIN (DISTSQL) -SELECT * FROM json_tab@foo_inv AS j1, json_tab AS j2 WHERE j1.b @> j2.b ORDER BY j1.a, j2.a] +EXPLAIN (DISTSQL) +SELECT * FROM json_tab@foo_inv AS j1, json_tab AS j2 WHERE j1.b @> j2.b ORDER BY j1.a, j2.a ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJzElF1v0zAUhu_5Fda5AuYusZPuI1cZLIii0o5kEqARTWlzmFK6ODjJNDT1v6MkpV9q7EzAdhnbb9_Hp4_8APnPOTgQeEPv7SUp5Zy888cfyZX35WJ4NhiRl-eD4DL4NHxFlkdeNwdmuUivi2jifhfiOknvyFlAZoyu1utvTj6_93yPzNjhhLjfStO0kMz44YSM_XPPJ2--VlsRrdaiECikIsZRdIs5OFfAgAIHChaEFDIpppjnQlZbD_XBQXwPjkkhSbOyqJZDClMhEZwHKJJijuDAZTSZo49RjNIwgUKMRZTM659f3SCTyW0kfwGFIIvS3CE9g5kQLiiIslj_dF5ENwgOW9Du9YP0DmWB8QeRpCgNq4VgOUOgq4B3n0ni2quhudUgxmXhENeiLqMubwXkjwGswJbjOdKOZyjEjzIjM5GkRKQOcat_aDwibn_Naa04K0ha0fZbUa3HoAZCFiiN021Mlx1Qlx9sttpNcWur3dq6LhMyRonxni7rAMLFHryR6InMYHwr0obQ30Jg3R1mXR02mNkzeFeNNQQ7GttPr7EGcEPj4-fWWIO61JiZ_9hj3l0i3lkibvY6GqSp3zGo__QGaQA3DDp5boM0qH8MYv_xJdxT62OeiTTHTg-cWT2RGN9g86zmopRTvJBiWtc0n-M6Vy_EmBfNLms-BmmzVQFuhpkyzNVhrgxb6rClDNtbYbYbttV31lT3lekjdfhIGT5Wh4-V4RN1-ORvJnaqnpip0UQjmc4ytWZM4xlTi7Z783Dx4ncAAAD__1YTsEg= +distribution: full +vectorized: true +· +• sort +│ order: +a,+a +│ +└── • lookup join + │ table: json_tab@primary + │ equality: (a) = (a) + │ equality cols are key + │ pred: b @> b + │ + └── • inverted join + │ table: json_tab@foo_inv + │ + └── • scan + missing stats + table: json_tab@primary + spans: FULL SCAN +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJzElF9v0zwUxu_fT2GdqxfmLrGTbl2uMlgQRaUdSSVAUE1pc5hSujg4yTRU9bujJKX_1NiZgO3Sdp88P5_-5CVkPxbggPfpenDZH5L_r_rBOPgweEECb-C9HpOX5I0_ek_mmUhu8nDqfhPiJk7uyWVA5oxu9qs1Jx_fer5H5ux0StyvhWlaSOb8dEpG_pXnk1efy6OQlnshUEhEhMPwDjNwvgADChwoWDChkEoxwywTsjxaVj_sRw_gmBTiJC3ycntCYSYkgrOEPM4XCA6Mw-kCfQwjlIYJFCLMw3hRfX5zgVTGd6H8CRSCNEwyh3QMZsJkRUEU-fbTWR7eIjhsRdvX95N7lDlG70ScoDSsBoL1CIFuAt5DKolrb2bmloMYFblDXIu6jLq8EZA_BrAEW4_nTDuegRDfi5TMRZwQkTjELf-h0ZC43S2nteEsIWlJ221EtR6DGgiZozQu9jFddkJdfrLbatfFja12Y-u2TMgIJUZHuqwTmKyO4A1FR6QG43uRJoTuHgJr7zBr67DBzI7B22qsITjQ2H56jTWAOxqfP7fGGtS1xsz8yx7z9hLx1hJxs9PSIE39gUHdpzdIA7hjUO-5DdKg_jaI_cOX8Eitj1kqkgxbPXBm-URidIv1s5qJQs7wWopZVVMvR1Wu2ogwy-tTVi_6SX1UAu6GmTLM1WGuDFvqsKUM23thdhi21XfWVHeV6TN1-EwZPleHz5Xhnjrc-5OJXagnZmo00Uims0ytGdN4xtSiHd58svrvVwAAAP__niuq6Q== # This query performs a cross join followed by a filter. +# Note that the distribution shows as either full or partial depending on the +# test config, so we hide it. query T -SELECT url FROM [EXPLAIN (DISTSQL) -SELECT * FROM json_tab@primary AS j1, json_tab AS j2 WHERE j1.b @> j2.b ORDER BY j1.a, j2.a] +SELECT info FROM [EXPLAIN (DISTSQL) +SELECT * FROM json_tab@primary AS j1, json_tab AS j2 WHERE j1.b @> j2.b ORDER BY j1.a, j2.a +] WHERE info NOT LIKE 'distribution:%' ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJysk9Fv0z4Qx99_f4V1Tz-Yu8ROt6E8ebCgFZVmJJUAjQi5zWmkyuJgOxKo6v-OkqCNVG1JaB99d19_7uvzrcF8z8GHOJgGb-ak0jl5G4XvyX3w6W56PZmR_28m8Tz-MH1Bfpe8bAtWRhVfrVyIUmePUv8k1zFZMfoUb86cfLwNooCs2PmCiC-V63pIVvx8QcLoJojI6891StI6JhOgUKgUZ_IRDfj3wIACBwoeJBRKrZZojNJ1at0UTtIf4LsUsqKsbB1OKCyVRvDXYDObI_gwl4scI5QpascFCilameXN9dsOgEJcysL4ZOQwF5INBVXZ56uNlQ8IPtvQf8N7J8HzvfhnalUonaLGtENMauXfSnZ4uJXm2zuVFaidy66FcEYEf5qrGAOFsLI-EYwKToVHxXivD2_IM8ZKW9TOVRcv2BkV3tlexLiDYP0nxfpOymHuyOF9_8qADsan6qD7XXj_DnjvDrg76vkAA_AXJ8HvX5Yd-AhNqQqD20uz82a33hRMH7DdPKMqvcQ7rZYNpj2Gja4JpGhsm-XtYVI0qeZ9_hSzAWK-LeYHxV5H7G6LvYPiV4fF42M8Xxzj-fIY8tUgcrL571cAAAD__04vVU0= +vectorized: true +· +• sort +│ order: +a,+a +│ +└── • cross join + │ pred: b @> b + │ + ├── • scan + │ missing stats + │ table: json_tab@primary + │ spans: FULL SCAN + │ + └── • scan + missing stats + table: json_tab@primary + spans: FULL SCAN +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJysk1Fv0zAQx9_5FNZJaMDcJXa6DeXJgwWtUJqRVAI0IuQ2x0jV2cV2JFDV746SThup2pKuffTd_f27v883B_trCiGkUT96OySF-qHJuyT-SG6iL9f9i96AvLjspcP0U_8lua95tSyYWK2-OzkSM1PcSfOHXKRkwuhDvD5z8vkqSiIyYScjIr6Vvh8gmfCTEYmTyyghb75WKUmrmMzui-smBvGQ9HsfInKUF9aZYlS6Qqvw-RFQUDrHgbxDC-ENMKDAgUIAGYWZ0WO0VpsqNa8Le_lvCH0KhZqVrgpnFMbaIIRzcIWbIoQwlKMpJihzNJ4PFHJ0spjW16_aBArpTCobko7HfMgWFHTpHq-2Tt4ihGxBn4YPDoLnG_GP1FJpk6PBvEHMKuX_StZ4uJL253tdKDTeWdNCPCCCPwxfdIFCXLqQCEYFpyKgorvRR7DLM6baODTeeRMv2DEVwfFGRLeBYO0nxdpOymN-x-Nt_8oOHXQP1UHzu_D2HfDWHXC_0_IBdsCfHgS_eVnW4BO0M60sri7N2pv9alMwv8Xl5lldmjFeGz2uMctjXOvqQI7WLbN8eeipOlW_z79itoOYr4r5VnHQEPur4mCr-PV2cXcfz6f7eD7bh3y-EzlbPPsbAAD___jRYVA= # This query performs an inverted join with an additional filter. query T -SELECT url FROM [EXPLAIN (DISTSQL) +EXPLAIN (DISTSQL) SELECT j1.*, j2.* FROM json_tab AS j2 INNER INVERTED JOIN json_tab AS j1 ON j1.b @> j2.b AND j1.b @> '{"a": {}}' AND j2.a < 20 -ORDER BY j1.a, j2.a] +ORDER BY j1.a, j2.a ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJzUk01v2kwUhffvr7i67yIQJthjQz5mNUlxJUfUTm1UtUpQZPA0MiUed2xHqRD_vbIhH47CAItK7ZLr-8w554qzwPznHBmGztD5MIJSzeFj4H-Ca-fr1fDc9aA1cMNR-HnYhvXKjHYPCcys7uFqc5bL9LaIJnAewswC1_OcAFzvixOMnAFc-q7XXKHge9BqzWh3AvymNE1bVK9N2nDuDaA5P1jcYHSDDBbL5UH7acPqRlAvTMEy2-AHAyeAi2-Vs6h2Fo2RYCpj4UX3Ikd2jRQJWjgmmCk5FXkuVTVe1Etu_IjMJJikWVlU4zHBqVQC2QKLpJgLZDiKJnMRiCgWyjCRYCyKKJnXTz-F45lK7iP1CwmGWZTmDI4MauJ4SVCWxcvTeRHdCWR0SXaXd9MHoQoRX8okFcqwNjj4LuVtkj4geQacx0xBi_eeL8qt9RVfzRpXZoxdhr530UaCflkw4JRwi3B7YxJrnyRVgvUde1vvOJTyR5nBTCYpyJQBtytTHrR4_51A_T0DEd7fmMneJ1MoVSGUcdzMw-0O4bTzrGoT3iO19kbV3kbVFzGpYqFE_EaLdgi3OzhevmPPk0cyM04bxCYH_YYDunsp6K6lMKh5ZNAz4_8dm7HFw5tm2H9xM7YkedWM_j_TjC2Z1s04-YPNeEc1EHkm01zs9I83q8qI-E6sapbLUk3FlZLTWmb106-5ehCLvFh9pasfbrr6VBl8DVMtbOlhSwvbetjWwr0GTN_CPS18plfua-FjPXyshU_08IkWPtXDp3sdbLz873cAAAD__7iL4aw= +distribution: full +vectorized: true +· +• sort +│ order: +a,+a +│ +└── • lookup join + │ table: json_tab@primary + │ equality: (a) = (a) + │ equality cols are key + │ pred: (b @> b) AND (b @> '{"a": {}}') + │ + └── • inverted join + │ table: json_tab@foo_inv + │ + └── • scan + missing stats + table: json_tab@primary + spans: [ - /19] +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJzUk19vmzAUxd_3Ka7uHpo0bsCQ9I-f3C5Mosqgg2jatEYVCV5FlmJmSNUpynefIP1HFZzkYdL2yLV_PudccZaY_5ojQ-fr1fDc9aA1cMNR-HnYhtAZOh9GMKPdQwIzq3sIHwP_E8xymd4U0QTOQ5hZ4HqeE4DrfXGCkTOAS9_16lco-B60WjPanQC_XpimLcrXJm049wZQnx8srzG6RgbL1eqg_XTD6kZQXZiCZbbBDwZOABffSmdR5SxCgqmMhRfdiRzZd6RI0MIxwUzJqchzqcrxsrrkxg_ITIJJmi2KcjwmOJVKIFtikRRzgQxH0WQuAhHFQhkmEoxFESXz6umnbDxTyV2kfiPBMIvSnMGRQU0crwjKRfHydF5EtwIZXZHd5d30XqhCxJcySYUyrAYHP6S8SdJ7JM-A85ApaPHe80K59bjEV7Pakhljl6HvXbSRoL8oGHBKuEW43ZjE2idJmeBxj72texxK-XORwUwmKciUAbdLUx60eH9DoP6egQjvN2ay98kUSlUIZRzX83C7QzjtPKvahPdIpd2o2mtUfRGTKhZKxG-0aIdwu4Pj1QZ7njySmXFaI5oc9GsO6O6loLuWwqDmkUHPjPc7NmOLhzfNsP_hZmxJ8qoZ_f-mGVsyPTbj5C82Y4NqIPJMprnY6Y83y8qI-Fasa5bLhZqKKyWnlcz606-4ahCLvFif0vWHm66PSoOvYaqFLT1saWFbD9tauFeD6Vu4p4XP9Mp9LXysh4-18IkePtHCp3r4dK-FjVfv_gQAAP__gXDcTQ== # This query performs a cross join followed by a filter. query T -SELECT url FROM [EXPLAIN (DISTSQL) +SELECT info FROM [EXPLAIN (DISTSQL) SELECT * FROM json_tab@primary AS j1, json_tab AS j2 WHERE j1.b @> j2.b AND j1.b @> '{"a": {}}' AND j2.a < 20 -ORDER BY j1.a, j2.a] +ORDER BY j1.a, j2.a +] WHERE info NOT LIKE 'distribution:%' ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJy8lN9vmzAQx9_3V1i3hzarG7ChP-In2pWqqbrQQaRtatDkBKsjojizQdoU5X-fgC0dUUJg3fbo833vc_flzBL01wQYBO6d-3aMcpWga997hx7cj_d3F8MROrwaBuPg_V0P_Ux5UyXMtUw_Z3zqLFT8xNV3dBGgOcHreHmm6MON67vo8HBO-lPkTHLTtASa0_60hy5GV6geP1hOgE-AoeVqddD7lUH7HJUJM0TNHvL8K9dHl5_QnPQ5LmrxEDCkMhIj_iQ0sAcggIECBgtCDAslZ0JrqYqrZZk4jL4BMzHE6SLPinCIYSaVALaELM4SAQzGfJoIX_BIKMMEDJHIeJyU5TdnBwzBgqeaoWODmBCuMMg8ey6tM_4ogJEV_jM8_St42gV_HSeZUEIZJ3V2FWfIodu_GmPsNvBGlzu7sHZ28QzPU6kioURUY4eFcl_KllFuuP5yK-NUKOO8Pow3Qo69nsMpbPbyjCGHYIdix8KOvXMOu4ubgVSZUMagjnesI-yQozW14OGSvZN6UqOS9itE2q6QQcxjgwyM1y3XuEMPVqceaNtN3tPBepNP_-km0_Y-2K19oOZxSxP24NcmnP2357ylC1_ohUy12HzWWyubxVsW0aOo_g1a5mom7pWclZjq6JW6MhAJnVW3VnUYpuVVua2_i0mjmNbE5qaYdiDTTbHVKLabyXajmJjN6pOXOHbaKD5rJp-9xLHzRvGgmTzoRA5Xr34EAAD__xvX5qg= +vectorized: true +· +• sort +│ order: +a,+a +│ +└── • cross join + │ pred: b @> b + │ + ├── • scan + │ missing stats + │ table: json_tab@primary + │ spans: [ - /19] + │ + └── • filter + │ filter: b @> '{"a": {}}' + │ + └── • scan + missing stats + table: json_tab@primary + spans: FULL SCAN +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJy8lG9v2jAQxt_vU5xumiirS2KH_sGv0q5UpWOkI0jb1KLJEK8LojGzHWkT4rtPCR1dEKRh3fbS53vud_fknDmab1PkGLa77TcDiJMvCi76wTu4aX-87p52erB33gkH4ftuHR5yXi8TJkYln60Y-TMd3wv9A05DmFCyiudnBh8u2_027O1NaGME_m3qup6ECWuM6nDaO4divDa_RXGLHOaLRa3-K4M1BOQJY2BuHYL-ebsPZ59gQhuCZLXE8AGTt98LBtDtvG1DLYqN1fEotbFK-KsaEkxUJHviXhrkN0iRIEOCHg4JzrQaS2OUzq7meWIn-o7cJRgns9Rm4SHBsdIS-RxtbKcSOQ7EaCr7UkRSOy4SjKQV8TQvv24QEgxnIjEcDhzq4nBBUKX2sbSx4k4ipwvyZ3j2V_BsF_xFPLVSS-0cFtnLOAefbf60nPOrMOidbe3C29rFIzxNlI6kllGBPcyUT6VsGOVSmK9XKk6kdk6KwwQ98JurOfzM5iC1HHxKfEZ8j_jNrXM0d3EzVNpK7bSKeN_bJz7dX1EzHsnZW6mHBSqtvkK06go51D1waMt5WXGNd-jB26kHVnWTn-hgtclH_3STWXUfmpV9YO5BRROewK9MOP5vz3lDF31pZioxcv1Zb6zsZm9ZRndy-W8wKtVjea3VOMcsj0GuywORNHZ56y0PnSS_yrf1dzEtFbOC2F0Xsx3IbF3slYqb5eRmqZi65erD5zh2VCo-LicfP8exk1Jxq5zc2ok8XLz4GQAA__-ZufKr # This query performs a left inverted join with an additional filter. query T -SELECT url FROM [EXPLAIN (DISTSQL) +EXPLAIN (DISTSQL) SELECT * FROM json_tab AS j2 LEFT INVERTED JOIN json_tab AS j1 ON j1.b @> j2.b AND j1.b @> '{"a": {}}' AND j2.a < 20 -ORDER BY j1.a, j2.a] +ORDER BY j1.a, j2.a ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJzklVFv4jgQx9_vU4zmpXA1ECdAqZ_SHqmUikt6kFvtqkVVIG4VlsZZJ1StEN99FUILQcVJ1X1qH23Pf2b88_zlJSa_5shwZA2sfzxYyDlcDN1_4dr6fjU4sx2o9e2RN_pvUIdNyN95wCwR0W3qT-BsBDMdBtaFB7bzzRp6Vh8uXdspRlBwHajVZrQ5AfNmoWkGh5nenNThzOlDcf9oeYP-DTJYrlZH9ZcIvenDOmAKulYHd9i3hnD-A2a06ZMslz9GgpEIuOM_8ATZNVIkqCNBA8cEYymmPEmEzI6W60A7eEKmEQyjeJFm22OCUyE5siWmYTrnyNDzJ3M-5H7AZUtDggFP_XC-Tv9yQTOW4YMvn5HgKPajhEGjRTUcrwiKRbpNnaT-PUdGV6R6eTt65DLlwaUIIy5bRrED7znmLGfv_u9ZwzV4JNvO7oS4DaNHJK-JrKdYQs1sv9I29Q3hnb3CCzDGLkeuc15Hgq4DJt0-A2PMdrweErwLZZLCTIQRhBHEfih50MiWmWiRMjApMXViGsTsHCSjv4dMRmTzLt13Utm-10CIn4s471tEDEwjv2TN7L4BqFsOKOFTEQXVQHQPgjDeA2IkZMpl67QIwTSOiUmPD5ZoHyyxzSxkwCUPDiV-oxdHNETconpBcqiFTqEFWt2HtKoPW1RrtPSqVizpYM-K7S9kxRIyO1Y8-dxWLAGxsSLVPuJFvboR9MpG0LVGRReUlN9zQecLuaCEzI4Lep_bBSUgXlxA_9SP9EaNIU9iESW80kejZV8VD-55_r0lYiGn_EqK6bpMvnTXuvVGwJM0P6X5wo7yo6zBXTFVinW1WFeKDbXYUIrbBTHdF7fVdy4p3VGqu2pxVyk-UYtPlOKeWtz7CLFTNTGtZExKhqxsytRjRkvmjKoHbf_m49VfvwMAAP__HTRo-Q== +distribution: full +vectorized: true +· +• sort +│ order: +a,+a +│ +└── • lookup join (left outer) + │ table: json_tab@primary + │ equality: (a) = (a) + │ equality cols are key + │ pred: (b @> b) AND (b @> '{"a": {}}') + │ + └── • inverted join (left outer) + │ table: json_tab@foo_inv + │ on: a < 20 + │ + └── • scan + missing stats + table: json_tab@primary + spans: FULL SCAN +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJzkld9P4kAQx9_vr5jMi3Au0G0BcZ-qR01quNaD3uUuJzGFrqYcdnvbYjSE__1SqkKJbGu8J33cH9-Z2c_ON7PE5O8cGVo_LwYntgO1vj3yRt8GdRhZA-uLB5_hbOh-hVkioqvUn8DJCGY6DKwzD2znhzX0rD6cu7ZTvEHBdaBWm9HmBMzLhaYZHGZ6c1KHE6cPxf2D5SX6l8hguVod1J9u6E0f1hemoGt1cId9awinv2BGmz7JYvlIMBIBd_xbniD7jRQJ6kjQwDHBWIopTxIhs6Pl-qId3CPTCIZRvEiz7THBqZAc2RLTMJ1zZOj5kzkfcj_gsqUhwYCnfjhfh396nxnL8NaXD0hwFPtRwqDRohqOVwTFIt2ETlL_hiOjK1I9vR3dcZny4FyEEZcto1iB9xBzlqN3v3vWcM0dyaayayGuwugOyXMg6z6WUDPbz7BN_RHw1l7hAxhj5yPXOa0jQdcBk25-gTFmO14PCV6HMklhJsIIwghiP5Q8aGTLTLRIGZiUmDoxDWJ29pLRX0MmI_L4L91XUtn810CIP4s4r1tEDEwjf2TN7L4AqFsOKOFTEQXVQHT3gjBeA2IkZMpl67gIwTQOiUkP96Zo702xiSxkwCUP9gV-oRZHNETconpBsq-ETqEEWt2HtKoPW1RrtPSqViypYMeK7Q9kxRIyW1Y8et9WLAHxaEWqvcWLenUj6JWNoGuNii4oSb_jgs4HckEJmS0X9N63C0pAPLmA_q-J9EKOIU9iESW80qDRslHFgxuej7dELOSUX0gxXafJl-5at94IeJLmpzRf2FF-lBW4LaZKsa4W60qxoRYbSnG7IKa74rb6zSWpO0p1Vy3uKsVHavGRUtxTi3tvIXasJqaVtElJk5V1mbrNaEmfUXWj7b58vPr0LwAA__-5e2Oa # This query performs a semi inverted join with an additional filter. query T -SELECT url FROM [EXPLAIN (DISTSQL) +EXPLAIN (DISTSQL) SELECT * FROM json_tab AS j2 WHERE EXISTS ( SELECT * FROM json_tab@foo_inv AS j1 WHERE j1.b @> j2.b AND j2.a < 20 ) -ORDER BY j2.a] +ORDER BY j2.a ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJzUkkFvm0AQhe_9FaPpxW7XgQXbVTmRNkQlcuzUWGqqFEUYJhHU2aW7ECWK_N8rwEpCZBPn1h53eB_z3ug9oP6zQgcDb-J9XUCpVnA8n53ChXd-Njn0p9A78oNF8H3Sh43kQyPItBSXRbSEwwAyC3588-YeeOeVGHrbpe6VlJepuK0RvkF6GT9YgvurNE2bILMOln04nB5BL7MOIqjHMVhmvw-z-ZE3hy8_K1EUIkMhE5pGN6TRuUCODC0MGeZKxqS1VNX4oRb5yR06JsNU5GVRjUOGsVSEzgMWabEidHARLVc0pyghZZjIMKEiSlf1rx_95yq9idQ9MgzySGgHBgY3MVwzlGXx9GtdRNeEDl-z_df74pZUQcmJTAUpw9rhYHNBZI-Ad5crcIePF3Qr9CpVuoBMpgJSAXmUKkoG1RMZzsrCAZcz12KuzdzRTv_WW_xXvjfXG7a9L-5zcmDiHS8g8E59OJn5U2TbjjqR8neZN7alcMC1K7tTcMftdJpiKZJX4-0MZu8M9pRHqoQUJe0oLv-I4XpL-qkcyNwYt9S7tg9b2_n-reT7ttLg5sDgn433e1bzFQ8vqmn_c9V8xf-zao7-32puCTYnnUuhaa_amVVvKbmmpudaliqmMyXjek3znNVcPUhIF81X3jx80XyqDD6HeSdsdcNWJ2y3YP4StjvhT92bh53wqBsedcLjbnj8pszh-t3fAAAA__8qVXLL +distribution: full +vectorized: true +· +• lookup join (semi) +│ table: json_tab@primary +│ equality: (a) = (a) +│ equality cols are key +│ pred: b @> b +│ +└── • inverted join + │ table: json_tab@foo_inv + │ + └── • scan + missing stats + table: json_tab@primary + spans: [ - /19] +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJzUkkFvm04Qxe__TzGa_8Vu14EF21U5kTZEJXJwCpaaqrUiDJMI6uzSXYgSRf7uFRAlIbKJc2uPMzu_nfdG7x717zU66J2fzQ79AAZHfrSIvs6GEHkz7_MC3sFxOD-FXEtxUcYrOIwgt-DbFy_0wDuvh2GwfdS9lPIiEzcNwh-QQc4PVuD-rEzTJsitg9UQDoMjGOTWQQxNOwHLHA5hHh55IXz6Xg_FyFDIlIL4mjQ6P5AjQwuXDAslE9Jaqrp93wz56S06JsNMFFVZt5cME6kInXsss3JN6OAiXq0ppDglZZjIMKUyztbN14_yC5Vdx-oOGUZFLLQDI4ObuNwwlFX59LUu4ytCh2_Y_ut9cUOqpPREZoKUYe1Q8HBAZI-Ad1socMePB3Rr9DJTuoRcZgIyAUWcKUpHdYkM51XpgMuZazHXZu5kp37rLfpr3Q_XG3e1L-4KcmDmHS8g8k59OJn7AbJtR51J-asqWtlSOODatdwA3GnXnaZEivRVezuN2TuNPfmRKiVFadeKy9_jcrPFfSBHsjCmneld28ed7Xz_VPJ9U2lwc2Twj8b_e0bzFQ0vomn_ddF8Rf-zaE7-3WhuMRaSLqTQtFfszDq3lF5Rm3MtK5XQmZJJs6Yt5w3XNFLSZfvK28IX7VMt8DnMe2GrH7Z6YbsD85ew3Qt_6N887oUn_fCkF572w9M3eV5u_vsTAAD__16MbWw= # This query performs an anti inverted join with an additional filter. query T -SELECT url FROM [EXPLAIN (DISTSQL) +EXPLAIN (DISTSQL) SELECT * FROM json_tab AS j2 WHERE NOT EXISTS ( SELECT * FROM json_tab@foo_inv AS j1 WHERE j1.b @> j2.b AND j2.a < 20 ) -ORDER BY j2.a] +ORDER BY j2.a ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJzUlFFv2joUx9_vpzg6T3CvKXEClOYp3NtUNxVLupBpnTpUBeJWYdTO7KRqVfHdpySoFFZMqj3xGPv8fM7P-csvqH4u0caJO3b_i6CQS7gIg09w415fjUeeD61zbxJNPo_bsC75uy5YKMFv83gGowksTPj6vxu64AcRuNclAK33y507IW5T_lhhdI21FvRkBs73wjAsBgvzZNaGkX8OrYV5EkO1PAfTaLchCM_dEP79VhbFUyTIRcL8-IEptG-QIkETCVo4JZhJMWdKCVluvVSFXvKEtkEw5VmRl8tTgnMhGdovmKf5kqGNUTxbspDFCZNdAwkmLI_TZXX8q0Mm04dYPiPBSRZzZUOnSw2crgiKIt8crfL4nqFNV6R5e48_Mpmz5FKknMmutT1B9JwxG8buRQTBl8gN4TLwfCS4e7tIXg9ynzIJTu_1dp3yggIfHLq5WNu2PT8aIsG7VKocFiLlkHLI4lSypFN-llCR2-BQ4pjEsYjT3ytsfkS4FF1f92Cv7MiPvN9cN39hLMSPIqvHFtwGx1o7Dra1FZsLnhzU2ytm7RXb-AiZMMmSbRWH_oPT1Tv2vuiIrHu2Vb2ve2-rO20eY9o0xl1qdLpm0yQfmGAnyb3jT_IB4TdJPj2uJJvNs2Q2zpJpdBoG6UD7nSD1jz9IB4TfBGl4XEE68NaHTGWCK9bouTPK95Il96x-X5Uo5JxdSTGv2tSfQcVVCwlTeb1L6w-P11vlgG9hqoVNPWxqYWsLpruwpR_b0Lfuaem-Hu5r4YEeHvyJ9KkWHuo7D7XwmR4--9DY09VfvwIAAP__8vKDjQ== +distribution: full +vectorized: true +· +• lookup join (anti) +│ table: json_tab@primary +│ equality: (a) = (a) +│ equality cols are key +│ pred: b @> b +│ +└── • inverted join (left outer) + │ table: json_tab@foo_inv + │ on: a < 20 + │ + └── • scan + missing stats + table: json_tab@primary + spans: FULL SCAN +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJzUlEFv2jAUx-_7FE_vBJspcQKU-hS2ploqlnQh0zptqArErcKondmhalXx3aeEqhRWTKqdOMb2z-_9Xv7yI-o_c2ToXV4MB34AjVN_FI--Dpsw8obepxjew1kUfoGZluKqSCYwGMHMhu-fvciDIIzBuywBaLx-3L2W8ioTdxVGn7DGjB5NwP21sCyHw8w-mjRhEJxCY2YfJVAtT8G2mk0Io1Mvgo8_ykMJEhQy5UFyyzWyn0iRoI0EHRwTzJWccq2lKrceq4N-eo_MIpiJfFGUy2OCU6k4skcssmLOkWGcTOY84knKVdtCgikvkmxeXf-skKvsNlEPSHCUJ0IzaLWpheMlQbko1lfrIrnhyOiS1C_vizuuCp6ey0xw1XY2O4gfcs5g6J3FEH6LvQjOQz9AgtvDRfJ8kXefK3A7z8N1ywGFAbh0PVfGmB_EfSR4nSldwExmAjIBeZIpnrbKzxJaFAxcSlybuA5xuzuF7bcIl6JP4-7tlB0Esf-P6_ovDKX8vchXbUvBwHWeHHub2ppPpUj36u0Uc3aKrX2kSrni6aaKSz_gePmKfSBbMm-fbJzeVb2zUZ3WjzGtG-M2tVptu26S93SwleTO4Sd5j_CLJB8fVpLt-lmya2fJtlo1g7Sn_FaQuocfpD3CL4LUP6wg7XnrI65zKTSv9dxZ5XvJ0xu-el-1XKgpv1ByWpVZfYYVVy2kXBerXbr68MVqq2zwJUyNsG2GbSPsbMB0G3bMbVvm0h0j3TXDXSPcM8O9_5E-NsJ9c-W-ET4xwydvanu8fPc3AAD__9WHfi4= statement ok INSERT INTO array_tab VALUES @@ -156,65 +295,201 @@ NULL /3 {1} 1 # This query performs an inverted join. query T -SELECT url FROM [EXPLAIN (DISTSQL) -SELECT * FROM array_tab@foo_inv AS a1, array_tab AS a2 WHERE a1.b @> a2.b ORDER BY a1.a, a2.a] +EXPLAIN (DISTSQL) +SELECT * FROM array_tab@foo_inv AS a1, array_tab AS a2 WHERE a1.b @> a2.b ORDER BY a1.a, a2.a ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJzEk11v0zAUhu_5Fda5AuouzUc_yJUHC6KotCOpBGhEk9scpkAXB8eZNlX978hJ1Y-pcdsLtMsc-_H76PTtEoq_C_AhCkbBhykp5YJ8DCdfyE3w_Xp0ORyT11fDaBp9Hb0h6ytv6wtcSv50q_iM_RLiNs0eyGVEuE23B9XAId8-BWFAuH0xI-xn2em4SLhzMSOT8CoIyfsf-ohTPeMxUMhEgmN-jwX4N2ADBRdiCrkUcywKIfV4WV0aJo_gdyikWV4qPY4pzIVE8JegUrVA8GHKZwsMkScorQ5QSFDxdFE9vfXPZXrP5RNQiHKeFT5pWy7EKwqiVNunC8XvEHx7RU-PH2YPKBUmn0WaobScJoP1BoFuiOAxl4R5m40xzU5K5RPmUmZT5jQaOucYarP1frzj-xkJ8afMyW-RZkRkPmH695mMCetuRd2NqLakWrfb6Oqe4xoJqVBavX1PZrcoc1q7qV4d3JjqNaZuw4RMUGJyIMttQbw6oDcWbZFbgz2iyaC7Z2CfXmL75BJbbvvEEh-Jf1Zi9wVKfMRwp8TdFy_xEdd1ifv_scQHUkMscpEVeFI5O7rdmNxh_Y8oRCnneC3FvIqpPycVVw0SLFR9atcfw6w-0oK7sG2EHTPsGGHXDLtG2NuD7eewZ4TfmZO7RrhnhntGuG-G-0Z4YIYHZy0sXr36FwAA__9gwadr +distribution: full +vectorized: true +· +• sort +│ order: +a,+a +│ +└── • lookup join + │ table: array_tab@primary + │ equality: (a) = (a) + │ equality cols are key + │ pred: b @> b + │ + └── • inverted join + │ table: array_tab@foo_inv + │ + └── • scan + missing stats + table: array_tab@primary + spans: FULL SCAN +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJzEk81u2kwUhvffVYzO6mszxNhjfurVpI2rUlFIbaS2alE04NPILfG443GUCHHv1diInwgPsKiy9Dk8fh8dXi-h-LOAAMKvN8OrwYj8fz2IJ_Hn4SsSh8Pw3YS8Ju-j8ScilBJPt1rM-E8pb9PsgVzFRLh0u6gGHvnyIYxCItzLGeE_ynabIRHe5YyMo-swIm-_mZWgZiaAQiYTHIl7LCD4Di5QYDClkCs5x6KQyoyX1Y8GySMEbQpplpfajKcU5lIhBEvQqV4gBDARswVGKBJUThsoJKhFuqhevdXPVXov1BNQiHORFQFpOQymKwqy1NtXF1rcIQTuip4eP8geUGlMPso0Q-V4TQbrAwLdEOFjrgj3Nwfjhh2XOiCcUe5S7jUaeucYGrP1ffzj9xlK-bvMyS-ZZkRmAeHm_xmPCO9sRdlG1FhSo9tpdGXnuMZSaVROd9-TuxeUexe7qX4d3JjqN6Zuw6RKUGFyIItdwHR1QG8kWzJ3-ntEk0Fnz8A9vcTuySV2WOvEEh-Jf1Zi9gIlPmK4U-LOi5f4iOu6xL1_WOIDqREWucwKPKmcbdNuTO6w_iIKWao53ig5r2Lqx3HFVYMEC11v3fphkNUrI7gLu1bYs8OeFWZ2mFlhfw92n8O-FX5jT-5Y4a4d7lrhnh3uWeG-He6fdbDp6r-_AQAA__8ezaIM # This query performs a cross join followed by a filter. query T -SELECT url FROM [EXPLAIN (DISTSQL) -SELECT * FROM array_tab@primary AS a1, array_tab AS a2 WHERE a1.b @> a2.b ORDER BY a1.a, a2.a] +SELECT info FROM [EXPLAIN (DISTSQL) +SELECT * FROM array_tab@primary AS a1, array_tab AS a2 WHERE a1.b @> a2.b ORDER BY a1.a, a2.a +] WHERE info NOT LIKE 'distribution:%' ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJysklFv0zAQgN_5FdY9AfOW2O54yJMHC1pRaUZSCdCIkNucRqQsDrYjMVX97ygOoqS0pWV9zN199-V8twT7vYIIsngSv5mR1lTkbZq8J3fxp9vJ1XhKnl-Ps1n2YfKC_Cp52RcoY9TjV6fmsjHlgzKP5CojitF1wgc4-XgTpzFR7GJO5Jc2DAUSxS_mJEmv45S8_tylFO1iKgcKtS5wqh7QQnQHDCgIyCk0Ri_QWm268NIXjYsfEIUUyrppXRfOKSy0QYiW4EpXIUQwU_MKU1QFmiAECgU6VVa-9V__DxSyRtU2IueBgHxFQbdu3do6dY8QsRX9Pz0_iZ7v1K-tba1NgQaLgTHvyH-VbJnhRtlv73RZowlGwxGSKZH8905ll01aFxHJqORUCipHO-cQxzxjpo1DE1wO9ZKdUSnOdipGAwU7fFPs4E0F4vzAQzlCL06i330oW_Qp2kbXFjcPZmvnsLsSLO6xvzqrW7PAW6MXXtN_Jp7zgQKt67O8_xjXPuXf50-YHQHzTZjvhcUADjdhsRd-tR8ePWXmy6NmzlfPfgYAAP__cRjYUg== +vectorized: true +· +• sort +│ order: +a,+a +│ +└── • cross join + │ pred: b @> b + │ + ├── • scan + │ missing stats + │ table: array_tab@primary + │ spans: FULL SCAN + │ + └── • scan + missing stats + table: array_tab@primary + spans: FULL SCAN +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJyskk9v00AQxe98itFIqEC39Z9NOfi0hRrVEOJiRwJULLSOh2Ip9ZrdtUQV5bsj2xXBIQkJ7dEz8-bnt_MWaH7MMcA0HIevp1BW3xS8SeL3cB1-uhqfRxN4dhGl0_TD-Dncz7zoB6TW8u6rlbmodXkr9R2cpyA9tmp0BR8-XoZJCNI7zUF8aVyXE0j_NIc4uQgTePW5bUnW1mR2P9z9xiSewjh6F8JRURqry7yxpaqCp0fIsFIFTeQtGQyu0UOGHDOGtVYzMkbptrzohqLiJwYuw7KqG9uWM4YzpQmDBdrSzgkDnMp8TgnJgrTjIsOCrCzn3eq_TCLDtJaVCeDE4ZgtGarGrlYbK28IA2_J_g_vPwre34pfUZtK6YI0FQNi1ir_NbLBw6U039-qsiLtjIYW4gkI__fhRduNGxuA8JjwmeBMjLb64Ic8Y6q0Je2cDfHCO2aCH29FjAYIb_9LeXtfyuEnewblADx_FPz2oGzAJ2RqVRlaD8zGzW6bEipuqE-dUY2e0ZVWsw7Tf8adrisUZGzf9fuPqOpa3fv8KfYOEPvrYn-nmA_E7rqY7xS_3C0ePcTz2UGes-WTXwEAAP__FEvkVQ== # This query performs an inverted join with an additional filter. query T -SELECT url FROM [EXPLAIN (DISTSQL) +EXPLAIN (DISTSQL) SELECT * FROM array_tab@primary AS a2 INNER INVERTED JOIN array_tab@foo_inv AS a1 ON a1.b @> a2.b AND a1.b @> '{1}' AND a2.a < 5 -ORDER BY a1.a, a2.a] +ORDER BY a1.a, a2.a ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJzUk0Fv2kAQhe_9FaPpIdBsMGvjhO5paXElR9SkBlWNUhQteBu5JV53bUeJEP-9sqEJpPECUg_t0bPzzbw3el5g9nOODEfewHs_hkLP4UM4_AhX3peLQc8PoNH3R-PRp0ET1i1vVg1Ca_FwnYspT3V8K_QD9EYgbPCDwAvBDz574djrw_nQDzZ6vyl1HSd3VS-FYQCNhqCtKfCvRbvtSBB2a9qEXtCH7frRgi6Pmr9f7JaA6mEGbhOGYd8L4d0lCNoSpBwhJkgwUZEMxK3MkF0hRYIOTgimWs1klildlhdVkx_dI2sTjJO0yMvyhOBMaYlsgXmczyUyHIvpXIZSRFJbbSQYyVzE82r0H4dAgqNUJBmDE8vByZKgKvKn0VkubiQyuiT7r_eTO6lzGZ2rOJHasusUrM-L5JHw7lMNDd55vCS311fcqPXCsHd5RRljfjDuTppIcFjkDDgl3Ca83oR9iIlS_PqEnd0nHCj1o0jhu4oTUAkD7pSqAmhw9wUv7t5eCHdr7TiH2BkpnUttnW5b4c4x4fS4dkWndsXTZKUjqWVUN_gFLYE6UanV3SLqFLhbCuj-uad7595yTqyO9XrP7O-Q8Cz7zr-Z_R0mNrLv_g_Z32Fnnf2zv5X9F1aEMktVksm9Mt0ufwoZ3cjVj5SpQs_khVazas3qc1hxVSGSWb56pasPP1k9lQI3YWqEbTNsG2HHDDtGuLMF0-dwxwi_NW92jfCpGT41wmdm-MwId81w96CDTZavfgUAAP__gPjVgw== +distribution: full +vectorized: true +· +• sort +│ order: +a,+a +│ +└── • lookup join + │ table: array_tab@primary + │ equality: (a) = (a) + │ equality cols are key + │ pred: (b @> b) AND (b @> ARRAY[1]) + │ + └── • inverted join + │ table: array_tab@foo_inv + │ + └── • scan + missing stats + table: array_tab@primary + spans: [ - /4] +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJzUk0Fv2kAQhe_9FaPpIdBsMGvjhO5paXElR9SkBlWNUhQteBu5JV53baJEiP9e2dAE0ngxUg_t0TP7zbw3el5i9nOODL0vF4OeH0Cj74_Go0-DJoy8gfd-DG_gQzj8CEJr8XCdiylPdXwr9AP0RiBs8IPAC8EPPnvh2OvD-dAPtt5-U-o6Tu7KtxSGATQagramwL8u2m1HgrBb0yb0gj7s1o-WdHXU_N2xWwLKxgzcJgzDvhfCu0sQtCVIMUIgwURFMhC3MkN2hRQJOjghmGo1k1mmdFFelo_86B5Zm2CcpIu8KE8IzpSWyJaYx_lcIsOxmM5lKEUktdVGgpHMRTwvR_9xByQ4SkWSMTixHJysCKpF_jQ6y8WNREZXpP56P7mTOpfRuYoTqS27SsHmukgeCe8-1dDgncdDcntzxK1aLwx7l1eUMeYH4-6kiQSHi5wBp4TbhFebsA8xUYjfnLCz_4QDpX4sUviu4gRUwoA7haoAGtx9wYtb2wvhbqUd5xA7I6Vzqa3TXSvcOSacHleu6FSueJqsdCS1jKoGv6AlUCcqtbo7RJUCd0cBrZ97Wjv3lnNidazXNbO_R8Kz7Dv_Zvb3mNjKvvs_ZH-PnU32z_5W9l9YEcosVUkma2W6XfwUMrqR6x8pUws9kxdazco1689hyZWFSGb5ukvXH36ybhUCt2FqhG0zbBthxww7RrizA9PncMcIvzVvdo3wqRk-NcJnZvjMCHfNcPegg01Wr34FAAD__4SP0CQ= # This query performs a cross join followed by a filter. query T -SELECT url FROM [EXPLAIN (DISTSQL) +SELECT info FROM [EXPLAIN (DISTSQL) SELECT * FROM array_tab@primary AS a1, array_tab AS a2 WHERE a1.b @> a2.b AND a1.b @> '{1}' AND a2.a < 5 -ORDER BY a1.a, a2.a] +ORDER BY a1.a, a2.a +] WHERE info NOT LIKE 'distribution:%' ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJy8k1GPk0AQx9_9FJPx4a7eXmGBXi_7RLVcrqa2JzTRSyVmWyYnCQd1gcRL0-9uAG2ltlxR4-POzH9-O7P_XWP6NUKBnjN23swgVxHcuNN3MHc-3o0HowmcD0fezHs_7sCPkldVgVRKPn3O5MJeqfBRqicYeCA52yXKgAEfbh3XgfNzybsLsD_lum4SSKO76MBgMoR6_GzNN2ednxmjK6FMLKHXgak7dFx4fQ-SdyUrWkgfGcZJQBP5SCmKOXJkaKLPcKWSJaVpoorwuiwaBd9Q6AzDeJVnRdhnuEwUoVhjFmYRocCZXETkkgxIaToyDCiTYVS2_m1gZOitZJwKuNRM9DcMkzzbtU4z-UAo-Ib9Gd74J3ijDf4mjDJSpDSrzq7iAmxj-1AD1x3cz7kQYjSZXftH-eZR_g6bx4kKSFFQo_qF8rmSA0PcyvTL2ySMSWlX9TGmE7Ct7QR2seBpngmwObMNZpvMto7OYbXZo5eojJTWr-Nt84LZ_GJLLXisZB-l9mpUfrp5-Mnm0cxLzdJenujfFlcw21zhRP8-g9_6t_cf_HuA71K6SuKU9n18sLNemJeCB6o-Q5rkakl3KlmWmOo4LXVlIKA0q7JmdRjFZap8n1_FvFFs1MT6vthoQTb2xWaj2GomW43i62Zx728WdtUo7jeT-60W5m9efA8AAP__VGJi2w== +vectorized: true +· +• sort +│ order: +a,+a +│ +└── • cross join + │ pred: b @> b + │ + ├── • scan + │ missing stats + │ table: array_tab@primary + │ spans: [ - /4] + │ + └── • filter + │ filter: b @> ARRAY[1] + │ + └── • scan + missing stats + table: array_tab@primary + spans: FULL SCAN +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJy8k1Fv0zAQx9_5FKdDqCvzmjpJt8lPKSzTCqUZSSWYRoTcxoxIXVxsR2Kq-t1RktGR0WYNIB5zd__73Z3_WaH-tkCGkT_2X08hzb5IOA-Dd3Dtf7wcD0cTODgbRdPo_bgL9zUvqwKuFL_7bPjMW6r0lqs7GEbAKXlIlAEbPlz4oQ8HB5z2ZuB9yvt9RwC3e7MuDCdnUI93VnTd6f7M2D0OZWIOgy4E4Zkfwqsr4LTHSdGCx_fdy7knwRTGo7c-dJJUG5XOcpPKjL3oIMFMJmLCb4VGdo0UCToYE1wqORdaS1WEV2XRKPmOrE8wzZa5KcIxwblUAtkKTWoWAhlO-WwhQsEToaw-EkyE4emibP3bVZBgtOSZZnBkORivCcrcPLTWht8IZHRN_gxv_xO83QZ_ni6MUEJZbp1dxRl49uY1h2E4vLqmjLHRZHoa7-Q7O_kP2DyTKhFKJDVqXCifKtmyxAXXX9_INBPKOq6vEUzAczcbeMWBg9ww8CjxbOI5xHN37uG2uWMklRHKOqnjPeeQePRwQy14pGTvpA5qVLq_eeje5rGcI8u1nu_p3xYjOG1G2NO_T-A3_h38B_9u4YdCL2WmxWMfb-3cL8wrkhtR_Qxa5mouLpWcl5jqMyh1ZSAR2lRZp_oYZWWqfJ9fxbRRbNfE_cdiuwXZfix2GsVuM9ltFJ82iwd_c7DjRvFJM_mk1cHi9bMfAQAA__-KD27e # This query performs a left inverted join with an additional filter. query T -SELECT url FROM [EXPLAIN (DISTSQL) +EXPLAIN (DISTSQL) SELECT a1.*, a2.* FROM array_tab@primary AS a2 LEFT INVERTED JOIN array_tab@foo_inv AS a1 ON a1.b @> a2.b AND a1.b @> '{1}' AND a2.a < 5 -ORDER BY a1.a, a2.a] +ORDER BY a1.a, a2.a ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJzkk19v2koQxd_vpxjNSyAsf9YGwvXTci-O5Iia1LhVo9SKFryJ3BKvu7ajRIjvXtmmBJKwgYe-tI87M2fO-GedJaY_Fmjh1B7b__uQqwWce5MPcG1_uRwPHRdqI2fqTz-O67Ae4bR1SoAbrdNqkivFn24yPmOJiu65eoLhFLgBY_vcB8f9bHu-PYKLieNujd5KeRPFD-UohYkLtRqnrRmwr3mnY4pi_awOQ3cEu_WTJV2d1H91jBaHsjGHXh0m3sj24L-r4kJeXsgDJBjLULj8XqRoXSNFgiYGBBMl5yJNpSrKy3LICR_R6hCM4iTPinJAcC6VQGuJWZQtBFro89lCeIKHQrU7SDAUGY8W5epXHJDgNOFxakGzbWKwIijz7Hl1mvE7gRZdkcPtnfhBqEyEFzKKhWobuxf4T4mwKu6TT77tldCR4CvsSDab7MdEQY11N4SZsaa7VRt63vDqmlqW5bj-IKgjwYkLjG7grztI8DZSaQbfZBRDFEPCIyXCZvEsNHlmAaOEGYSZhPX2MjGOYVKwWP-R7rE8nv_UWMrveVIdLmMLmFl9ZI3130DT16FJxVzG4WEM-nsZmMcwmEqVCdXu734_MxuE0cbG1SSsS0rvva7dva7PZlKFQonwhRdtEGY2MFi9cZ4rmzJpD3YU-y7o7VxAD48jPTiObbN5YBzfsX8RR_OviOM7TLbi2Ptj4_gOg3Ucz35jHN9w9USayDgVB8WsU-RUhHeiynYqczUXl0rOS5vqOSl1ZSEUaVZ1afVw4qpVHLgtplqxoRcbWrGpF5tacXdHTF-Ku1rxv3rnnlbc14v7WvGZXnymFQ_04sFRwILVPz8DAAD__5NyLgU= +distribution: full +vectorized: true +· +• sort +│ order: +a,+a +│ +└── • lookup join (left outer) + │ table: array_tab@primary + │ equality: (a) = (a) + │ equality cols are key + │ pred: (b @> b) AND (b @> ARRAY[1]) + │ + └── • inverted join (left outer) + │ table: array_tab@foo_inv + │ on: a < 5 + │ + └── • scan + missing stats + table: array_tab@primary + spans: FULL SCAN +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJzkk11v2jAUhu_3K47OTaGYDydAWa7MRiqlYkkXsmlVhypD3CobjTMnVK0Q_31Kwii0xcDFbrZLfzx-T57oXWD6a4YW2t8uh33HhcrAGQWjz8MqjOyh_TEAThunBLjROIVz3_sEXCn-dJPxCUtUdM_VE_RHwA0Y2ucBOO5X2w_sAVx4jrtx9VbKmyh-KK5S8FyoVDhtTIB9n7dapsifn1Sh7w5ge_9kQZcn1T8nRoNDcTCFThU8f2D78OEqn5AXE3IkGMtQuPxepGhdI0WCJo4JJkpORZpKlW8viktO-IhWi2AUJ_Ms3x4TnEol0FpgFmUzgRYGfDITvuChUM0WEgxFxqNZ8fQrDUhwlPA4taDeNHG8JCjn2fPTacbvBFp0SQ6Pd-IHoTIRXsgoFqppbE8QPCXCKrV7XwLbL5wjwVfWkaxfsh8TBRXWXgtmxkruxl7f9_tX19SyLMcNeuMqEvRcYHTtfnWCBG8jlWbwQ0YxRDEkPFIirOfLnJlnFjBKmEGYSVhnpxPjGCe5i9UfaR_r4_lPDaX8OU_KwWVsATPLj6yw7htqujo1qZjKODzMQXenA_MYByOpMqGa3e3vZ2aNMFpbp5qEtUmRvTO1vTP1OUyqUCgRvsiiNcLMGo6Xb4znyrpMmr0tYtcEna0J6OF1pAfXsWnWD6zjnvgXdTT_izrucbJRx84_W8c9DlZ1PPuLdXwj1RdpIuNUHFSzVt5TEd6JstupnKupuFRyWsSUS6_gio1QpFl5SsuFE5dH-YCbMNXChh42tLCph00t3N6C6Uu4rYXf65M7Wrirh7ta-EwPn2nhnh7uHSVsvHz3OwAA__8sYyim # This query performs a semi inverted join. query T -SELECT url FROM [EXPLAIN (DISTSQL) +EXPLAIN (DISTSQL) SELECT a2.* FROM array_tab@primary AS a2 WHERE EXISTS ( SELECT * FROM array_tab@foo_inv AS a1 WHERE a1.b @> a2.b ) -ORDER BY a2.a] +ORDER BY a2.a ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJzUkkFP204Qxe__TzGaE_y7IbGdpJJPpsWoRiGhdqRSUQtt4gG5Dbvu7hqBonz3au0IMCROuLXHmZ3fvnmjt0T9e4E-JuEo_DyFUi3gNJ6cw1V4eTE6jsZwcBIl0-Tr6BDWI9w9-r-e4Urxx2vDZ0Gh8juuHuE4Ae7Cty9hHEJ4aUE4WGNvmBspr3NxXzHOmuHO0QyCH2Wv55EVmh3CJD4JY_j03ZY8RYZCZjTmd6TRv0IHGXqYMiyUnJPWUtn2shqKsgf0ewxzUZTGtlOGc6kI_SWa3CwIfZzy2YJi4hmpbg8ZZmR4vqi-fuMOGSYFF9qHTtfDdMVQlub5a234LaHvrNj-8pG4J2UoO5O5INV1t22wvhWyJyJ8KBQE_adjBZa9yZU28FPmAnIBBc8VZR1bIsNJaXwIHBa4LPBYMNhqwH2PAbv4-nz95vLTx4J8GIWnU0jC8wjOJtEY2carjqT8VRb13lL4EHh23zEEw6Y9TXMpsp3-tjrztjp7NiRVRoqyppfA-YDpaoP9sezIojtsTG9T7zfUnf1z6eydy67X2TOXO-Rf5dL7-3K5w8CLXA7-4VxucBaTLqTQtFfmeja0lN1SHXItSzWnCyXnlUxdTiquamSkTf3q1EUk6ie74EvYaYXddththb0G7LyGvVb4Y7tyvxUetMODVnjYDg_f5Tld_fcnAAD__9D2czw= +distribution: full +vectorized: true +· +• lookup join (semi) +│ table: array_tab@primary +│ equality: (a) = (a) +│ equality cols are key +│ pred: b @> b +│ +└── • inverted join + │ table: array_tab@foo_inv + │ + └── • scan + missing stats + table: array_tab@primary + spans: FULL SCAN +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJzUklFP2zAQx9_3KU73BJtLm6TtpDyFjaAFlZYllca0VcitD5St2JntIBDqd5-cVECApuVtezzbP9_9Tv97NH-WGGJ8fjY6TMawd5Rk0-zraB-yeBR_ngL3D97DcTo5Ba41v7uwfB4VOr_m-g4OM-A-fPsSpzHE5w6EvTX2grlU6iKXNxXjrRnuHcwh-ln2egG5RvN9mKRHcQqfvruSI0OpBI35NRkMf6CHDAOcMSy0WpAxSrvj--pRIm4x7DHMZVFadzxjuFCaMLxHm9slYYhTPl9SSlyQ7vaQoSDL82X19Qs5ZJgVXJoQOt0AZyuGqrSPXxvLrwhDb8V2b5_IG9KWxInKJemuv2mC9aqQPRDxbaEh6j_sKnLsZa6NhV8ql5BLKHiuSXRciQwnpQ0h8ljksyhg0WCjgP8WATf4en395vDTu4JCGMXHU8ji0wROJskY2atbHSn1uyzquZUMIQrcvGOIhk09QwslxVa_jWbBRrNHIaUFaRJNl8j7gLPVK_pj1VFFd9h4val7v9Hd2z2X3s657AadHXO5pf2zXAb_Xi63CDzJ5eA_zuUrZimZQklDO2Wu50JL4orqkBtV6gWdabWo2tTlpOKqA0HG1rdeXSSyvnIDPoW9Vthvh_1WOGjA3nM4aIU_tnfut8KDdnjQCg_b4eGbnGerd38DAAD__z1Wbd0= # This query performs an anti inverted join. query T -SELECT url FROM [EXPLAIN (DISTSQL) +EXPLAIN (DISTSQL) SELECT a2.* FROM array_tab@primary AS a2 WHERE NOT EXISTS ( SELECT * FROM array_tab@foo_inv AS a1 WHERE a1.b @> a2.b ) -ORDER BY a2.a] +ORDER BY a2.a ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJzUks9O20AQh-99itGcoN2Q2E5SySenxahGqU0dV6WiFtrEA3Ibdt1dGxFFeXdkOyKYECccOe6fb2a-0W-J-v8cbZy4Y_drBIWaw1kYfIcr9_JiPPJ8ODr1JtHkx_gY1l-4efKx_sOV4ovrnE-dTKV3XC1gNAFuwq9vbuiCH0TgXpYwHK3RLe5GyutU3Fecsea4cTIF50_R61lUNpseQxCeuiF8-V0eeYwMhUzI53ek0b5CAxlaGDPMlJyR1lKV18vqk5c8oN1jmIqsyMvrmOFMKkJ7iXmazwltjPh0TiHxhFS3hwwTynk6r0pvGSLDScaFtqHTtTBeMZRFvimtc35LaBsrdnh7T9yTyik5l6kg1TWbE0SLjGwYu2cRBD8jN4TzwPOR4dYOkT1Vch8yBU7_aYlOWfMmVTqHvzIVkArIeKoo6ZRHZBgUuQ2OwRyTORZzBjvFzLeIlULrtfZ3So38yNt22mx7LOW_IqvnlsIGxyrn9cEZNvU0zaRI9vrtNLN2mm2EpEpIUdJ0cYxPGK9e0fdlR2bdYeP3ru79Rnfj8LwaB-e1a3UOzOue9i_yar2fvO4Re5bXwTvO6ytmIelMCk0HZbFXhpmSW6rDr2WhZnSh5KxqUx-DiqsuEtJ5_WrUB0_UT-WAz2GjFTbbYbMVthqw8RK2WuHP7Z37rfCgHR60wsN2ePgm53j14TEAAP__MAmBdQ== +distribution: full +vectorized: true +· +• lookup join (anti) +│ table: array_tab@primary +│ equality: (a) = (a) +│ equality cols are key +│ pred: b @> b +│ +└── • inverted join (left outer) + │ table: array_tab@foo_inv + │ + └── • scan + missing stats + table: array_tab@primary + spans: FULL SCAN +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJzUksFum0AQhu99itGcknYdG7BdiRNpQ1QiF1JM1VStFa3NJKJ1dukuRLEsv3u1YMUhjrFzzHEWvpn5Rv8S9b85uuhfXY5OgxCOzoJxMv42OoaxP_I_J8Dtk_dwHkdfgSvFF9cFn3q5yu64WsDpGLgNP774sQ9hlIB_ZWA4WqNb3I2U15m4rzhrzXHrZAre77LXc8gMmx5DFJ_5MXz6aUqODIVMKeR3pNH9hRYydHDCMFdyRlpLZZ6X1U9B-oBuj2Em8rIwzxOGM6kI3SUWWTEndDHh0znFxFNS3R4yTKng2bxqvSWIDMc5F9qFTtfByYqhLItNa13wW0LXWrHDxwfinlRB6YXMBKmu3dwgWeTkwsg_TyD6nvgxXERBiAy3TojssZP_kCvw-o839EzPm0zpAv7ITEAmIOeZorRjSmQYlYULnsU8m3kO8wY7xezXiBmh9Vn7O6VOwyTYdtpceyTl3zKv95bCBc8x-4bgDZt6mmZSpHv9dpo5O802QlKlpChtunjWB5ysXtAPZUfm3WHj713T-43p1uF5tQ7Oa9fpHJjXPeOf5dV5O3ndI_Ykr4M3nNcXzGLSuRSaDspiz4SZ0luqw69lqWZ0qeSsGlOXUcVVDynpov5q1UUg6k9mwaew1Qrb7bDdCjsN2HoOO63wx_bJ_VZ40A4PWuFhOzx8lfNk9e5_AAAA__-FYnwW diff --git a/pkg/sql/logictest/testdata/logic_test/merge_join_dist_vec b/pkg/sql/logictest/testdata/logic_test/merge_join_dist_vec index 71762e5c3059..1c2789694155 100644 --- a/pkg/sql/logictest/testdata/logic_test/merge_join_dist_vec +++ b/pkg/sql/logictest/testdata/logic_test/merge_join_dist_vec @@ -43,9 +43,27 @@ start_key end_key replicas lease_holder NULL /2 {3} 3 query T -SELECT url FROM [EXPLAIN (DISTSQL) SELECT * FROM l LEFT OUTER JOIN r USING(a) WHERE a = 2] +EXPLAIN (DISTSQL) SELECT * FROM l LEFT OUTER JOIN r USING(a) WHERE a = 2 ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJzEk9FvmzAQxt_3V1i3l2ZzBXbYi6VKTBvdqFLogGqTKh7ccEuQKGa2kRZF-d8noFIGS7NU07Y3bN_vu_u-E1sw3yoQkAaL4F1GWl2RyyS-JnfBl5vF2zAiZ-_DNEs_LWbkseTVUFCRRXCZkas4jIgmt2kYfSBnckY-fwySgEhyQXgOFGpVYCQf0IC4AwYUOOQUGq2WaIzS3fW2LwqL7yBcCmXdtLa7zikslUYQW7ClrRAEZPK-wgRlgdrptAq0sqx6ae03unyQegMU0kbWRhCHnzvceQn5joJq7aPsXu1-Q9bSrMc6PoN8l1MwVq4QBN_RJ8bb67S10gVqLEZKeUf-ruSAx2vUK7xSZY3amY9nyzYNiiH2-DYLkj58oFDhV3vms9ezC12u1sMnUIhbK4jPqM-p701S2Duc_4HDA-NH6lw1jjeN4mBrb9Sanb57d5xL9Xd2z54c71_snv_X3R8YLkHTqNrgSat1O3tYrHCIy6hWL_FGq2XfZjjGPdcnW6Cxw6s3HMK6f-p_v9NhdhxmU9j9GeYjmE1hfhR-M4LdKTx_hudfOh-H2XHYe5bnfPfiRwAAAP__WUL0nA== +distribution: full +vectorized: true +· +• merge join (left outer) +│ equality: (a) = (a) +│ left cols are key +│ right cols are key +│ +├── • scan +│ missing stats +│ table: l@primary +│ spans: [/2 - /2] +│ +└── • scan + missing stats + table: r@primary + spans: [/2 - /2] +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJzEk9GPk0AQxt_9KzbjS6t7gd3iyyaXYJRTLj04gYsmhoe9MrYkHIu7S2LT9H83gEkFe7UXo76xu_P7Zr5vwg7M1woEBJ9ul6_DiMzehmmWfljOSRosgzcZeUGukviGVGQZXGXkOg4josldGkbvyEzOycf3QRIQSS4JBwq1KjCSD2hAfAYGFDjkFBqtVmiM0t31ri8Ki28gXApl3bS2u84prJRGEDuwpa0QBGTyvsIEZYHa6bQKtLKsemntN7p8kHoLFNJG1kYQh1843HkO-Z6Cau0P2YPa_ZZspNmMdXwG-T6nYKxcIwi-p4-Md9Bpa6UL1FiMlPKO_F3JEY83qNd4rcoatbMYz5ZtGxRD6vFdFiR99kChwi925rOX80tdrjfDJ1CIWyuIz6jPqe9NUjg4XPyBwyPjR-pCNY43jeJoa2_Ump2_e3ecS_V3ds8eHe9f7J7_190fGS5B06ja4FmrdTt7WKxxiMuoVq_wVqtV32Y4xj3XJ1ugscOrNxzCun_qf7_zYXYaZlPY_RnmI5hNYX4SfjWC3Sm8eILnXzqfhtlp2HuS53z_7HsAAAD___ZW7z0= # Test that we can handle merge joins with equality columns of integers with # different widths. diff --git a/pkg/sql/opt/exec/execbuilder/testdata/distsql_agg b/pkg/sql/opt/exec/execbuilder/testdata/distsql_agg index 093d2d3408b7..24792d653adf 100644 --- a/pkg/sql/opt/exec/execbuilder/testdata/distsql_agg +++ b/pkg/sql/opt/exec/execbuilder/testdata/distsql_agg @@ -29,203 +29,669 @@ NULL /1 {1} 1 /9 NULL {5} 5 query T -SELECT url FROM [EXPLAIN (DISTSQL) SELECT sum(a) FROM data] +EXPLAIN (DISTSQL) SELECT sum(a) FROM data ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJyslNGKm0AUhu_7FMO5SmBER00261WWNoVAdrONKRQWL6aZgw0Yx86M0BLy7kUtrAm7o2V6qc4_3_9x5JxB_ywggXS1WX3ck1oV5PNu-0heVt-eNw_rJzL5tE736ZfNlPw9ouvThE-7U4IbngGFUgp84ifUkLwAAwohUIiAQgwUZpBRqJQ8oNZSNUfObWAtfkESUDiWVW2a1xmFg1QIyRnM0RQICez59wJ3yAUqPwAKAg0_Fi2mYS8rdTxx9RsopBUvdUI8nxFeCsKIND9QAYVtbRKyZJBdKMjavLK04TlCwi50fJ-HPFeYcyOVP7uuk359nCzZ9F1M-C7m9fa6lEqgQnF1dXaxF2HBvzWJrpqw8QNgYwbgM88PnUYw0KhnPncZQThePBwlHnp-5CQ-0KgnfuciHo0Xj0aJR54fO4kPNOqJL1zE4_Hi8Sjx2PNnTuIDjXri9_9r27yB2aGuZKnxZuu8fXPQbCMUOXarS8taHfBZyUOL6R63ba59IVCb7ivrHtZl96kp2A8zazi8CrPbcGgnD6Ajazq2h2OX3jNreG4nz13Id9bwwk5euJDv7bMKBn4T-092y84uH_4EAAD__x2N4J0= +distribution: full +vectorized: true +· +• group (scalar) +│ +└── • scan + missing stats + table: data@primary + spans: FULL SCAN +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJyslF1r2zAUhu_3K8S5akDGlu2kqa9StgwCadPFGQyGL7To4AUSy5Nk2Aj578P2RZ3QyhrapT9ePe_DEecM-tcRMlh-e1k_rp7J3adVvsu_rCckX66XH3dEN6c7PiGft5snIrjhQKGSAp_5CTVk34EBhRgoJEAhBQpTKCjUSu5Ra6naX85dYCV-QxZROFR1Y9rXBYW9VAjZGczBHBEy2PEfR9wiF6jCCCgINPxw7DAtelGrw4mrP0Ahr3mlMxKEjPBKEEak-YkKKGwak5EFg-JCQTbmlaUNLxEydqHufR7LUmHJjVTh9LpO_vXpbsEm72LidzGvpzeVVAIViquji4u9CIv-rUly1YS5D4C5DCBkQRh7jWCk0cB85jOC2F08dhKPgzDxEh9pNBC_9xFP3MUTJ_EkCFMv8ZFGA_G5j3jqLp46iadBOPUSH2k0EH_4X9vmDcwWdS0rjTdb5-2To3YboSixX11aNmqPL0ruO0z_uOly3QuB2vRfWf-wqvpPbcFhmFnD8VWY3YZjO3kEnVjTqT2c-vSeWsMzO3nmQ763hud28tyH_GCfVTRyTeyX7JZdXD78DQAA__-VJNs- query T -SELECT url FROM [EXPLAIN (DISTSQL) SELECT sum((a-1)*1000 + (b-1)*100 + (c::INT-1)*10 + (d-1)) FROM data] +EXPLAIN (DISTSQL) SELECT sum((a-1)*1000 + (b-1)*100 + (c::INT-1)*10 + (d-1)) FROM data ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJzUVV9r4k4Uff99iuE-Je2EZJLY2jwprT8IqO2qCwslD1Pn4gqacWcS2EX87kuSLSbSTrJkX_TJ--fMuefcwD2C_rGDCJaT6eRxRXK1I_8vnmfkdfLtZTqO58R6iper5ZepTf606HxvFT9OHMJsckOY53k2uSWW9VZL2VVqHUXxfDU8F6q8KBN2xSV4xhOgkEqBc75HDdErMKDgA4UAKIRAYQAJhYOSa9RaqqLlWAJi8RMij8I2PeRZkU4orKVCiI6QbbMdQgQr_rbDBXKByvWAgsCMb3clTcE9OqjtnqtfQGF54KmOiOMywlNBGJHZd1RAYYGpQBWRQvmIOSyqdNk3hfr34NayRn6z9v6_rAVV0OioNYzCsvI0eYxn46kNyYmCzLOzLp3xDULETrS79vFmo3DDM6ncQVP68uvMGrHPafxPac6v56lUAhWKxtPJyTwI8_5ukqAxCeu-bNZl2S5zXP9q1t2ivubyXZ91-91N9juZ7DtucDUmt6ivmXzfx-Sgu8lBJ5MDxw2vxuQW9TWTh31MDrubHHYyOXTcwdWY3KK-ZvLDv7oOH9AsUB9kqvHiSnz8sldcDxQbrE6Nlrla44uS65KmCp9LXJkQqLOqyqogTqtSMWAdzIxgvwFml2DfzNxCHRjRoRkc9pl7YATfmZnv-jDfG8FDM_OwD_ODeVdey2di_sguuZPTf78DAAD__6jVaAU= +distribution: full +vectorized: true +· +• group (scalar) +│ +└── • render + │ + └── • scan + missing stats + table: data@primary + spans: FULL SCAN +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJzUVUGL4kwQvX-_oqlTMtMh6SQ6Tp-UGT8IqDOrLiwsHnrswhU07XZH2EX870sSBhOZ6WTJXswpVdWvX71XDXUC83MHHMbfXiejZEac52SxXHyZuGQxnoyflsQc907-CeIR5pI7woIgcMk9cZy3SsotU2vOk9lycCmUeVkkXPL__GVKpMgEUEiVxJnYowH-HRhQCIFCBBRioNCDFYWDVms0Run8yKkAJPIX8IDCNj0cszy9orBWGoGfINtmOwQOS_G2wzkKidoPgILETGx3BU1OPTzo7V7o30BhcRCp4cTzGRGpJIyo7AdqoDDHVKLmJBc-ZB7jpSz3Lhf_Htw7zjCs197_i1pUBrUTlQPDuKg8j5-S6WjiwupMQR2ziy6TiQ0CZ2faXvtos9G4EZnSfq8uffF16gzZ5zThpzSX24-p0hI1ytrVq7O9ERb8XSdRrRPWftiszbB95vnhzYy7QX3F5X6XcYftTQ5bmRx6fnQzJjeor5j80MXkqL3JUSuTI8-Pb8bkBvUVkwddTI7bmxy3Mjn2_N7NmNygvmLy47_aDh_QzNEcVGrwakt8fHOQbw-UGyxXjVFHvcZXrdYFTRm-FLgiIdFkZZWVQZKWpbzBKphZwWENzK7BoZ25gTqyomM7OO7Sd88K7tuZ-12YH6zggZ150IX50T6roOGZ2B_ZNffq_N-fAAAA__9ghWKm query T -SELECT url FROM [EXPLAIN (DISTSQL) SELECT sum(a), count(a), max(a) FROM data] +EXPLAIN (DISTSQL) SELECT sum(a), count(a), max(a) FROM data ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJy0lF2L2kAUhu_7K4ZzFWEkThJdN1fK1oLgx9YoXVjCMnUOVtBMOjOBLeJ_L0lKN8o6CQTvnExen5fnhHMC_fsAIUST2eRpTTJ1IN9Wyzl5nbw8z8bTBXG-TqN19H3WIf9e0dnR4R1KtjJLTPHryN8d3ilzghseA4VEClzwI2oIX4EBBQ8o-EAhAAp9iCmkSm5Ra6nyV05FYCreIexR2CdpZvLHMYWtVAjhCczeHBBCWPOfB1whF6jcHlAQaPj-UGBy9ihV-yNXf4BClPJEh6TrMsITQRiR5hcqoLDMTEhGDOIzBZmZD5Y2fIcQsjNt3me82ynccSOV27-sE23mzoh1gMLTcrNYv62WPyInP87HL8XFLb53k_-BzRKpBCoUF8z4bG_IercqRpv523Sxdkbe_4b-7Yb-RUPWfGKsycRc1nW9VjOraVQxMrjLzLzmRrxGRryu67cyUtOoYuThLkb85kb8Rkb8rhu0MlLTqGJkeBcjQXMjQSMjQdfttzJS06hi5PHum-4T_gp1KhONVxvv83_u5ZsQxQ7Ltallprb4rOS2wJTHZZErHgjUprxl5WGalFd5wWqYWcPeRZhdhz07uQbtW9OBPRy06d23hgd28qAN-cEaHtrJwzbkR_usejWfif0ju2bH5y9_AwAA__9VDgnf +distribution: full +vectorized: true +· +• group (scalar) +│ +└── • scan + missing stats + table: data@primary + spans: FULL SCAN +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJy0lF2L2kAUhu_7K4ZzFWEkThJ33VwpWwuCH1ujdKHIMs0cUkEz6cwEtoj_vSSBbpR1EgjeORnfPC_PCecE-s8BQpi-vswnsyVxvs6iTfR93iPRdD593hCdHx3eoySWeWrKX0f-7vAe-bZeLYjghgOFVApc8iNqCH8CAwoeUPCBQgAUhrCjkCkZo9ZSFX85lYGZeIdwQGGfZrkpHu8oxFIhhCcwe3NACGHDfx1wjVygcgdAQaDh-0OJKdDjTO2PXP0FClHGUx2SvssITwVhRJrfqIDCKjchGTPYnSnI3HywtOEJQsjOtH2fSZIoTLiRyh1e1om2C2fMekDhebVdbt7Wqx-RUxwXk9fy4hbfu8n_wOapVAIVigvm7mxvyAa3KkbbxdtsuXHG3v-G_u2G_kVD1n5irM3EXNZ3vU4za2hUM_Jwl5l57Y14rYx4fdfvZKShUc3I412M-O2N-K2M-H036GSkoVHNyOguRoL2RoJWRoK-O-xkpKFRzcjT3TfdJ_w16kymGq823udvHhSbEEWC1drUMlcxvigZl5jquCpz5QOB2lS3rDrM0uqqKFgPM2vYuwiz67BnJzegfWs6sIeDLr2H1vCDnfzQhfxoDY_s5FEX8pN9VoOGz8T-kV2zd-cv_wIAAP__TJ4EgA== query T -SELECT url FROM [EXPLAIN (DISTSQL) SELECT sum(a+b), count(a+b), max(a+b) FROM data] +EXPLAIN (DISTSQL) SELECT sum(a+b), count(a+b), max(a+b) FROM data ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJy0lF9r6j4Yx-9_ryI8V8oiNWl1rlfKfh4Q_LNjlTMYZWTmwSNo40lS2EF874e2Y1OZaUG9a5p--_nyeUJ2YP6sIYSoP-w_zkiq1-THdDIiL_3np2FvMCa1_wfRLPo5rJOPT0y6qQlyR97qlCxUmtjP1Ua8fzwX_5DCihgoJEriWGzQQPgCDChwoOADhQAotCCmsNVqgcYonX2yywMD-Q5hk8Iq2aY2ex1TWCiNEO7AruwaIYSZeFvjFIVE7TWBgkQrVusck7G7W73aCP0XKERbkZiQNDxGRCIJI8r-Rg0UpphI1CHpsrsuh3hPQaX2i2isWCKEbE-rt-otlxqXwirttY5LRfNRrcvqQOFxMh_PXqeTX1EtW456z_nGOT4_y__CponSEjXKI2a8dzdkzXMVo_nodTCe1br8s6F_vqF_1JBVnxurMjePNTx-hcmV9Drw0r7J5Hh1L7ySF97w_Ct4Kel14OX-Jl786l78Sl78hhdcwUtJrwMvnZt4Cap7CSp5CRpe6wpeSnodeHm4-Q34DX-KZqsSgyc34fd_bmY3JMolFtepUale4JNWixxTLCd5Ln8h0dhilxWLQVJsZQUPw8wZ5kdhdhrmbnIJ2nemA3c4uKR3yxluu8ntS8j3znDHTe5cQn5wz6pZckzch-yUHe__-xcAAP__UpEVHw== +distribution: full +vectorized: true +· +• group (scalar) +│ +└── • render + │ + └── • scan + missing stats + table: data@primary + spans: FULL SCAN +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJy0lF1r4kAUhu_3VwznSulInEm0NldK1wXBj65RtrBImToHV9CMOzOBLuJ_X5KUNkqdBNQ7J-Ob5-U54ezB_N1ACP3np2FvMCa174NoFv0c1knUH_YfZ8Qk25ogd-S1TslSJbH9OG3F2_tv8mM6GREprAAKsZI4Fls0EP4GBhQ4UPCBQgAUWrCgsNNqicYonf5lnwUG8g3CJoV1vEts-nhBYak0QrgHu7YbhBBm4nWDUxQStdcEChKtWG8yTIru7vR6K_Q_oBDtRGxC0vAYEbEkjCj7BzVQmGIsUYeky-66HBYHCiqxn0RjxQohZAdavVVvtdK4ElZpr3VcKpqPal1WBwqPk_l49jKd_Ipq6XHUe84uzvH5Wf4nNomVlqhRHjEXB3dD1jxXMZqPXgbjWa3LPxr65xv6Rw1Z9bmxKnPzWMPjV5hcSa-Cl_ZNJsere-GVvPCG51_BS0mvgpf7m3jxq3vxK3nxG15wBS8lvQpeOjfxElT3ElTyEjS81hW8lPQqeHm4-Qb8gj9Fs1OxwZNN-PWbm-mGRLnCfJ0aleglPmm1zDD5cZLlsgcSjc1vWX4YxPlVWrAYZs4wPwqz0zB3k0vQvjMduMPBJb1bznDbTW5fQr53hjtucucS8oN7Vs2Sz8T9kZ2yF4dv_wMAAP__anEPwA== query T -SELECT url FROM [EXPLAIN (DISTSQL) SELECT sum((a-1)*1000) + sum((b-1)*100) + sum((c::INT-1)*10) + sum(d-1) FROM data] +EXPLAIN (DISTSQL) SELECT sum((a-1)*1000) + sum((b-1)*100) + sum((c::INT-1)*10) + sum(d-1) FROM data ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJzMVdFqo0AUfd-vGO6TNiM6atrUJ0ubBSFNu0kWFooP08wlG0g0O6OwS8i_L2pJNDSjbMiSt5l7PJ57zly4W1C_VhDAdDgaPs5ILlfk6-TlmbwNf7yOHqIxMZ6i6Wz6bWSSj08MQ-Vrw-DEIswkN4Q5jmOSHimr77Wqua_OgyAazwYHbA-JqlZKCp7xGCgkqcAxX6OC4A0YUHCBggcUfKDQh5jCRqZzVCqVxSfbkhCJ3xA4FJbJJs-KckxhnkqEYAvZMlshBDDj7yucIBcobQcoCMz4clXKFNrhRi7XXP4BCtMNT1RALJsRngjCSJr9RAkUJpgIlAExQmaxoLJl3hQRfFwoMUK3CdUQrzo28D0c-mX9afgYPT-MIN5RSPPsYEdlfIEQsB3tbvlhsZC44Fkq7X7T8fT7sxEyszBbnNz9yduffPNkE-7JJg7aeZJKgRJFQzje6dtkzr_0eXiZ0O8ZodczQtYLXfO0A6_hgHWfHNZlcmxm2e61z06L6dqj3F5udtzuybudknct27v25FtM15K_u1zyXvfkvU7Je5btX3vyLaZryQ8ul7zfPXm_U_K-ZfevPfkW07Xk7__PpvqkiQmqTZooPNpYn__ZKTYZigVWa0-luZzjq0znpUx1fSl5ZUGgyiqUVZcoqaCiwTqZaclug8yOya5euUXa07J9Pdk_p---lnyrV749R_lOSx7olQfnKN_r38ppGRP9kB1rx7svfwMAAP__dHSRHQ== +distribution: full +vectorized: true +· +• render +│ +└── • group (scalar) + │ + └── • render + │ + └── • scan + missing stats + table: data@primary + spans: FULL SCAN +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJzMVdGK2kAUfe9XDPcpWSckk8RdN09Zdi0E1N2qhULxYda5WEEzdiZCi_jvJUnRRNZJqFh8m7knJ-eeMxfuDvTPFUTQ__Y2eEpGxHpJJtPJl4FNJv1B_3lKLEtv15bFiUOYTe4I8zzPJh1SVN8rVftQnUdRMpr2jtgBEmXt8_h1SATPOFBIpcARX6OG6DswoOADhQAohEChCzMKGyXnqLVU-Se7gpCIXxB5FJbpZpvl5RmFuVQI0Q6yZbZCiGDK31c4Ri5QuR5QEJjx5aqQyaXjjVquufoNFCYbnuqIOC4jPBWEEZn9QAUUxpgKVBGxYuawqHRl3-UJ_L1QYsV-HaogQXms4Qc4Dov6S_85GT4NYLanILfZ0Y7O-AIhYnva3vLTYqFwwTOp3G7d8eTr0IqZnZvNT_7hFBxOoX22Cf9sE0ftbSqVQIWiJjzbm9tk3r_0eXyZOOxYcdCxYtaJffu8g6DmgLWfHNZmclzmuP6tz06D6cqj3F9vdvz2yfutkvcdN7j15BtMV5J_uF7yQfvkg1bJB44b3nryDaYryfeul3zYPvmwVfKh43ZvPfkG05XkH__PpvqgiTHqjUw1nmysj__s5ZsMxQLLtaflVs3xTcl5IVNeXwteURCosxJl5SVJSyhvsEpmRrJfI7NTsm9WbpAOjOzQTA4v6btrJN-ble8vUX4wkntm5d4lyo_mt_IaxsQ8ZKfas_2nPwEAAP__pG2Lvg== query T -SELECT url FROM [EXPLAIN (DISTSQL) SELECT sum(a), min(b), max(c), count(d) FROM data] +EXPLAIN (DISTSQL) SELECT sum(a), min(b), max(c), count(d) FROM data ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJy8lF2L4jAUhu_3V4Rz1UKkJq0zTq8qsy4U_Ji1yg4MZcg0wRW0cZMUZhH_-9J2YVTGtIu6V_br9X14Tjg70L_WEEIyHA0f56hQa_RtNh2jl-Hz02gQT5DzNU7myfeRi_5-oouNw1yMNqvceSt_2buTuRhlssiNw906z5lhKWDIJRcTthEawhcggIECBh8wBIChBymGrZKZ0Fqq8pNdFYj5O4RdDKt8W5jycYohk0pAuAOzMmsBIczZ21rMBONCeV3AwIVhq3VVU3ZHW7XaMPUbMCRblusQdTyCWM4RQdL8FAowTAsToojgiOLIh3SPQRbmo1EbthQQkj1uTzVYLpVYMiOV1zuGShZjJyIuYBjHEyei1dXg2Yn88upxupjMX2fTH4njniWhZ0k-AIpcKi6U4Eft6d7OSrr_Apssxq_xZO5EwXlW_4iVtJ8laTNLj3Q8eoVpNnAdGLq78TRpe0O0lSHa8fwrGGrgOjB0f2NDfntDfitDfscLrmCogevAUP_GhoL2hoJWhoKO17uCoQauA0MP_3FnfkIyE3orcy1Odufn_9wtd6rgS1EvYC0LlYknJbOqpr6dVrnqARfa1G9JfRPn9asS8DBMrGF6FCanYWpvbqj2renAHg4u4e5Zw3f25rtLmu-t4b69uX9J84N9Vt2GY2I_ZKfd6f7LnwAAAP__aw4e7g== +distribution: full +vectorized: true +· +• group (scalar) +│ +└── • scan + missing stats + table: data@primary + spans: FULL SCAN +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJy8lF2L2kAUhu_7K4ZzlcBInCS6bq4iWwsBP7ZG6UKRZTZzsIJm7MwEtoj_vSRerMo6SVF7ZT588z48Zzg70L_XEMHg5XnYT8bE-Zqks_T70CXpYDh4mhFdbBzuUrJZ5c5b-cvfncylJJNFbhzhkm_TyYgIbjhQyKXAMd-ghugnMKDgA4UAKIRAoQMLClslM9RaqvIvuyqQiHeI2hRW-bYw5eMFhUwqhGgHZmXWCBHM-Nsap8gFKq8NFAQavlpXNWV1vFWrDVd_gEK65bmOSMtjhOeCMCLNL1RAYVKYiMSMxj6NA1jsKcjCfDRqw5cIEdvT5lT95VLhkhupvM4pVDofOTFzgcIoGTuxX131X5w4KK-eJvPx7HU6-ZE67kUS_yLJB0CRSyVQoThpX-ztrKz9L7DpfPSajGdOHF5mDU5YWfNZsiaz9FjL828wzRquI0PdO0_Tb27Ib2TIb3nBDQzVcB0ZerizoaC5oaCRoaDlhTcwVMN1ZKh3Z0Nhc0NhI0Nhy-vcwFAN15Ghx_-4Mz8hmaLeylzj2e78_MvtcqeiWOJhAWtZqAyflcyqmsPtpMpVDwRqc3jLDjdJfnhVAh6HmTXsn4TZedi3N9dUB9Z0aA-H13B3rOGuvbl7TfODNdyzN_euaX60z6pdc0zsh-y8e7H_8jcAAP__VMIZjw== # AVG is more tricky: we do two aggregations (for the sum and for the count) # and calculate the average at the end. query T -SELECT url FROM [EXPLAIN (DISTSQL) SELECT avg(a+b+c::INT+d) FROM data] +EXPLAIN (DISTSQL) SELECT avg(a+b+c::INT+d) FROM data ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJy0lF2L2kAUhu_7K4ZzleBInEncdXOVZWsh4MfWKBSWUGadQyq4GTuJpUX87yXJwkZZJwHNXb5en9fnDOcA2e8t-BCNJ-OnJdnrLfm2mE_Jy_jH8-QxnBHraxgto-8Tm7x_Iv4klmUJ0iOvNumRte-Hs-WouJR2lZUiFzFQSJXEmXjDDPwXYECBAwUXKHhAYQgxhZ1Wa8wypYtPDmUglH_BH1DYpLt9XjyOKayVRvAPkG_yLYIPS_G6xQUKidoZAAWJudhsS0zBDnZ68yb0P6AQ7USa-aTvMCJSSRhR-S_UQGGBqUTtk8DrWVbAegG3e4H7_l8gPlJQ-_yjQZaLBMFnR9q-5WOSaExErrQzPC0ZraZWwGyg8DRfzZbl9SUkv4j8IO1TpSVqlCeY-GguxQaXWkWr6c-w6MXtuirmBPxiT_ekJ2s_QNZmgA7rO7yDETb0rNm6u9UIeXs1vJUa3nfcDtQ09Kypub-VGre9GreVGrfveB2oaehZUzO6lRqvvRqvlRqv7ww7UNPQs6bmoYud-AlygdlOpRme7cbPf3lQ7EyUCVYLNlN7vcZnrdYlprqdl7nygcQsr96y6iZMq1dFwXqYGcP8JMzOw9xMbkC7xrRnDnvX9B4aw3dm8t015HtjeGQmj64hP5hnNWg4JuZDds6Oj1_-BwAA__-nohS0 +distribution: full +vectorized: true +· +• group (scalar) +│ +└── • render + │ + └── • scan + missing stats + table: data@primary + spans: FULL SCAN +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJy0lF2L2kAUhu_7K4ZzleBInEl03Vxl2VoI-LE1CoUiZdY5pIKbsZOxtIj_vSQWNso6CWju8uHr8-Y5wzlA_msLIYy-vYyf4ilxPsfJIvk6dkkyGo-eF0T8Th3HEaRDXl3SIeswjKeLYXEpXfJlPpsQKYwACpmSOBVvmEP4HRhQ4EDBBwoBUOjDisJOqzXmudLFTw5lIJZ_IOxR2GS7vSkeryislUYID2A2ZosQwkK8bnGOQqL2ekBBohGbbYkp0NFOb96E_gsUkp3I8pB0PUZEJgkjyvxEDRTmmEnUIYmCjuNErBNxtxP5_z8FVkcKam_eG-RGpAghO9LmLZ_SVGMqjNJe_7xkspw4EXOBwvNsOV2U19eQ_CrynbTPlJaoUZ5hVkd7Kda71ipZTn7ERS_uVlUxL-JXe_pnPVnzAbImA_RY1-MtjLCmZ8XW4F4j5M3V8EZqeNfzW1BT07Oi5uFeavzmavxGavyuF7SgpqZnRc3wXmqC5mqCRmqCrtdvQU1Nz4qaxzZ24gfIOeY7leV4sRs__udesTNRpnhasLna6zW-aLUuMafbWZkrH0jMzektO93E2elVUbAaZtYwPwuzyzC3k2vQvjUd2MPBLb371vDATh7cQn6whod28vAW8qN9Vr2aY2I_ZJfs1fHTvwAAAP__eg0PVQ== # VARIANCE/STDDEV have three local (sqrdiff, sum, and count) and one final stage aggregations. # We calculate and render the variance/stddev at the end. query T -SELECT url FROM [EXPLAIN (DISTSQL) SELECT sum(a), round(stddev(b), 1) FROM data] +EXPLAIN (DISTSQL) SELECT sum(a), round(stddev(b), 1) FROM data ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJy8lF9r4kwUxu_fTzGcqwgjcSaxtblKqQoBq61JXxZKWKbOwRVsxp2ZLLuI331JUqhKTQLBvcv8efI88zuHswfzcwsBxJPZ5CEhud6S6XLxSF4n355m99GcOOMoTuLnWY98XDH5uyN6lGiVZ9IxVkr85bz1KGG9SiqFFSlQyJTEuXhHA8ErMKDAgYIHFHygMISUwk6rFRqjdHFlXwoi-RuCAYVNtsttsZ1SWCmNEOzBbuwWIYBEvG1xiUKidgdAQaIVm21pU3iHO715F_oPUIh3IjMB6buMiEwSRpT9gRooLHIbkJDRkEN6oKBy-2lnrFgjBOxA20e6X681roVV2h2eJopfHp2Q9Yowz8txNJ06IS9XxX759bB4mSfl96Uo_GKUzwR5prREjfLEPj3Uh2WDS2mn0fx-9j1OxuPJ_07IaejR0C8OlphJ1CW9jx4IOWVBEETzZHT5Dd7JG1j7CrM2FXZZ3-Vda9wQ6gjbzbVrzNvz4a348L7rdeXTEOqIz-21-Xjt-Xit-Hh91-_KpyHUEZ_Rtfn47fn4rfj4fXfYlU9DqCM-d_9yhn4RZYlmpzKDZ7P06z8PihmLco3VQDYq1yt80mpV2lTLRakrNyQaW52yahFl1VER8FjMasX8RMzOxbzeucHaq1X79WK_S-5hrfim3vmmi_NtrXhU7zzq4nxXX6tBQ5vUN9m5d3r4728AAAD__-nHIgQ= +distribution: full +vectorized: true +· +• render +│ +└── • group (scalar) + │ + └── • scan + missing stats + table: data@primary + spans: FULL SCAN +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJy8lF-L4jwUxu_fTxHOVYVITVpnnF51GBUKjs7YzsvCIkvGHFxBGzdJl13E7760LozKmBaKe5c_ffo8-Z3D2YP5sYEIRl9eJo_JlHjDJM3S10mHpKPJ6Ckjpth6okOJVkUuPWOlxJ_ee4cS1iHj-eyZSGEFUMiVxKnYooHoKzCgwIFCABRCoNCHBYWdVks0Runyk30lSOQviHoU1vmusOXxgsJSaYRoD3ZtNwgRZOJ9g3MUErXfAwoSrVhvKpvSOt7p9Vbo30Ah3YncRKTrMyJySRhR9jtqoDArbERiRmMOiwMFVdgPO2PFCiFiB9o80uNqpXElrNJ-_zxR-vbsxaxThnmdD5Px2It5tSvPq9XT7G2aVetrUfjVKB8JilxpiRrlmf3i4A7LetfSjpPp4-Rbmg2Ho_-9mNM4oHFYXswxl6gren9bIOaURVGUTLPB9TcEZ29gzSvMmlTYZ12ft61xTagTbHe3rjFvzoc34sO7ftCWT02oEz73t-YTNOcTNOITdP2wLZ-aUCd8BrfmEzbnEzbiE3b9fls-NaFO-Dz8yxn6SZQ5mp3KDV7M0s__3CtnLMoVHgeyUYVe4otWy8rmuJ1VuupAorHHW3bcJPnxqgx4KmZOMT8Ts0sxdzvXWAdOdegWh21y953iO7fzXRvne6d44HYetHF-cNeqV9Mm7ia79F4c_vsTAAD__6KHHKU= query T -SELECT url FROM [EXPLAIN (DISTSQL) SELECT sum(a), round(variance(b), 1) FROM data] +EXPLAIN (DISTSQL) SELECT sum(a), round(variance(b), 1) FROM data ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJy8lF9r4kAUxd_3Uwz3KcJInEm0Nk8RqxCwsY12WShhmToXV9CMO0mWXcTvviQpVKVOAsG-Zf6cnDO_e7kHSH9vwYPFZDYZL0mut2QazR_J6-TH02wUhMR6CBbLxfOsQ96vpPnOEh1KtMoTaf0ReiOSFVpvHUpYpxJLkYkYKCRKYih2mIL3CgwocKDgAAUXKPQhprDXaoVpqnRx5VAKAvkXvB6FTbLPs2I7prBSGsE7QLbJtggeLMXbFiMUErXdAwoSM7HZljaFt7_Xm53Q_4DCYi-S1CNdmxGRSMKIyn6hBgrzPPOIz6jPIT5SUHn2YZdmYo3gsSNtHmm0Xmtci0xpu3-eaPHyaPmsU4R5jh6C6dTyebkq9suv8fwlXJbf16Lwq1E-EuSJ0hI1yjP7-GgOy3rX0k6DcDT7-X0UBaNwPLF8Tn2H-m5xFGEiUZf83vvA55R5nheEy-H1Vzhnr2DNa8ya1NhmXZu3rXJNqBNwg1tXmTfnwxvx4V3bacunJtQJn7tb83Ga83Ea8XG6ttuWT02oEz7DW_Nxm_NxG_Fxu3a_LZ-aUCd87r9yin4SJcJ0r5IUL6bp53_uFVMW5RqrkZyqXK_wSatVaVMt56Wu3JCYZtUpqxZBUh0VAU_FzCjmZ2J2KeZm5xprx6h2zWK3Te6-UTwwOw_aON8ZxUOz87CN8725Vr2aNjE32aV3fPz2PwAA__9--SNC +distribution: full +vectorized: true +· +• render +│ +└── • group (scalar) + │ + └── • scan + missing stats + table: data@primary + spans: FULL SCAN +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJy8lF-L4jwUxu_fTxHOVYVITVpnnF5VZhQKTp2pzsvCIkvGHFxBGzdJl13E7760LozKmBaKe5c_ffo8-Z3D2YP5sYEIRl9eJsMkJd5TMpvPXicdMhtNRo9zYoqtJzqUaFXk0vsp9FrkS_TeO5SwDhln02cihRVAIVcSU7FFA9FXYECBA4UAKIRAoQ8LCjutlmiM0uUn-0qQyF8Q9Sis811hy-MFhaXSCNEe7NpuECKYi_cNZigkar8HFCRasd5UNqV1vNPrrdC_gcJsJ3ITka7PiMglYUTZ76iBwrSwEYkZjTksDhRUYT_sjBUrhIgdaPNIw9VK40pYpf3-eaLZ27MXs04Z5jV7SsZjL-bVrjyvVo_Tt3Rera9F4VejfCQocqUlapRn9ouDOyzrXUs7TtLh5Nv_wywZpo8jL-Y0DmgcllcZ5hJ1xe9vG8ScsiiKknQ-uP6K4OwVrHmNWZMa-6zr87ZVrgl1Au7u1lXmzfnwRnx41w_a8qkJdcLn_tZ8guZ8gkZ8gq4ftuVTE-qEz-DWfMLmfMJGfMKu32_LpybUCZ-HfzlFP4mSodmp3ODFNP38z71yyqJc4XEkG1XoJb5otaxsjttppasOJBp7vGXHTZIfr8qAp2LmFPMzMbsUc7dzjXXgVIducdgmd98pvnM737VxvneKB27nQRvnB3etejVt4m6yS-_F4b8_AQAA__8iOB3j query T -SELECT url FROM [EXPLAIN (DISTSQL) SELECT stddev(a+b+c::INT+d) FROM data] +EXPLAIN (DISTSQL) SELECT stddev(a+b+c::INT+d) FROM data ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJy0lF1r4kAUhu_3VwznKuJInCS2NlcpVSFgbWvSZaGEZeocXMFm3Jlx2UX870sSoSp1EpDcTT5e38fnhLMD_XsNISTj6fghJVu1JpP50yN5G_94nt7HM-KM4iRNXqYdcnhFGyHwj-M4nHTJe4d0ySIM41k6LI6iU8UFNzwDCrkUOOMfqCF8AwYUPKDgA4UAKAwgo7BRcoFaS1W8sisDsfgLYZ_CKt9sTXE7o7CQCiHcgVmZNUIIKX9f4xy5QOX2gYJAw1frsqbojjZq9cHVP6CQbHiuQ9JzGeG5IIxI8wsVUJhjLlCFJAq6jhOxbuR1upF_-C-Q7SnIrfkk0IYvEUK2p80p75dLhUtupHIHp5DJy3wUTyZOxDoF4-vj4fTw9DpLy_MlAO8iwGfvNpdKoEJxUprt7YjsTOQknt1PfybpaDT-7kSMRh6N_Mtg_gkYaz4_1mR-Luu5XgsTrOE80nPTzgS95qK8RqK8nuu3IKqG80jUbTui_Oai_Eai_J4btCCqhvNI1LAdUUFzUUEjUUHPHbQgqobzSNRd-8vzC4A56o3MNZ4t0a9_uV8sVxRLrDaxllu1wGclF2VNdflU5sobArWpnrLqIs6rRwXgcZhZw95JmJ2HPXtzTbVvTQf2cHAN98AavrE331zTfGsND-3Nw2ua7-yz6td8JvaP7Lw723_7HwAA__83FyJy +distribution: full +vectorized: true +· +• group (scalar) +│ +└── • render + │ + └── • scan + missing stats + table: data@primary + spans: FULL SCAN +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJy0lNFq4kAUhu_3KYZzFXEkThKtzVWkKgSstiZdFhZZps7BFWzGnRmXXcR3L4mFRqmTgORukvj7f_lOOAfQf7YQwvjH03QYz4gzipM0eZ62SDKejh9Soo0Q-NdxHE7a5LVF2mQVhvEsHeRH0SKTxfyRCG44UMikwBl_Qw3hT2BAwQMKPlAIgEIPlhR2Sq5Qa6nynxyKQCz-QdilsMl2e5PfXlJYSYUQHsBszBYhhJS_bnGBXKByu0BBoOGbbVGTV0c7tXnj6j9QSHY80yHpuIzwTBBGpPmNCigsMBOoQhIFbceJWDvyWu3I_3gVWB4pyL35JNCGrxFCdqT1KYfrtcI1N1K5vXPI5HkxiicTJ2KtnPHl8eP0MH-ZpcX5GoB3FeCzd59JJVChOCtdHu2I7ELkJJ4Np7-SdDQaf3ciRiOPRv51MP8MjNWfH6szP5d1XK-BCVZwlvT0m5mgV1-UV0uU13H9BkRVcJZE3TUjyq8vyq8lyu-4QQOiKjhLogbNiArqiwpqiQo6bq8BURWcJVH3zS_PLwAWqHcy03ixRL_-526-XFGs8bSJtdyrFT4puSpqTpfzIlfcEKjN6Sk7XcTZ6VEOWA4za9g7C7PLsGdvrqj2renAHg5u4e5Zw317c_-W5jtreGBvHtzSfG-fVbfiM7F_ZJfdy-O39wAAAP__0akdEw== query T -SELECT url FROM [EXPLAIN (DISTSQL) SELECT variance(a+b+c::INT+d) FROM data] +EXPLAIN (DISTSQL) SELECT variance(a+b+c::INT+d) FROM data ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJy0lF1r4kAUhu_3VwznKuJInCS2NlcRqxCwsY12WShhmWYOrmAz7mRcdhH_-5JEqEqdBCR3k48375PnDLOH_PcGfFhMZpPxkuzUhkzj-RN5m_x4no3CiFiP4WK5eJl1yPGVP1yteZaiZVmcdMl7h3RJ6vthtBwWS9GpPiC45glQyKTAiH9gDv4bMKDgAAUXKHhAYQAJha2SKea5VMUr-zIQir_g9ymss-1OF7cTCqlUCP4e9FpvEHxY8vcNxsgFKrsPFARqvt6UNUV3sFXrD67-AYXFlme5T3o2IzwThBGpf6ECCjFmApVPAq9rWQHrBk6nG7jHf4HkQEHu9CdBrvkKwWcH2pxytFopXHEtlT04h1y8xI_hdGoFrFMwvj4dV-P5a7Qs19cAnKsAn727TCqBCsVZaXIwI7ILkdMwGs1-fh_F4SgaT6yA0cChgXsdzT1DY80nyJpM0GY922lhhjWcJ4Lu2pmh01yU00iU07PdFkTVcJ6Ium9HlNtclNtIlNuzvRZE1XCeiBq2I8prLsprJMrr2YMWRNVwnoh6aP_4_AIgxnwrsxwvjtGvv9wvjlcUK6zO4lzuVIrPSqZlTXU5L3PlDYG5rp6y6iLMqkcF4GmYGcPOWZhdhh1zc021a0x75rB3C_fAGL4zN9_d0nxvDA_NzcNbmh_Ms-rXbBPzJrvsTg7f_gcAAP__0qcjsA== +distribution: full +vectorized: true +· +• group (scalar) +│ +└── • render + │ + └── • scan + missing stats + table: data@primary + spans: FULL SCAN +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJy0lNFq4kAUhu_3KYZzFXEkThKtzVXEKgRsbKNdFhZZppmDK9iMOzMuu4jvXhILVamTgORukvj7f_lOOHvQfzYQwvjH03QYJ8R5iOeL-fO0Rebj6Xi0IH-5WvM8Q8dxOGmT1xZpkywM42QxKI6iRSbp7JEIbjhQyKXAhL-hhvAnMKDgAQUfKARAoQdLClslM9RaquIn-zIQi38Qdims8-3OFLeXFDKpEMI9mLXZIISw4K8bTJELVG4XKAg0fL0pa4rqaKvWb1z9BwrzLc91SDouIzwXhBFpfqMCCinmAlVIoqDtOBFrR16rHfkfrwLLAwW5M58E2vAVQsgOtD7lcLVSuOJGKrd3Djl_Th_iycSJWKtgfHn8OI1mL8miPF8D8K4CfPbucqkEKhRnpcuDHZFdiJzEyXD66_swjYfJaOxEjEYejfzraP4ZGqs_QVZngi7ruF4DM6zgPBHUb2aGXn1RXi1RXsf1GxBVwXki6q4ZUX59UX4tUX7HDRoQVcF5ImrQjKigvqiglqig4_YaEFXBeSLqvvn1-QVAinorc40Xa_Trf-4W6xXFCo-7WMudyvBJyaysOV7Oylx5Q6A2x6fseBHnx0cF4GmYWcPeWZhdhj17c0W1b00H9nBwC3fPGu7bm_u3NN9ZwwN78-CW5nv7rLoVn4n9I7vsXh6-vQcAAP__V8ceUQ== # Test various combinations of aggregation functions and verify that the # aggregation processors are set up correctly. query T -SELECT url FROM [EXPLAIN (DISTSQL) SELECT sum(a), avg(b), sum(c), avg(d), stddev(a), variance(b), sum(a+b+c::INT+d) FROM data] +EXPLAIN (DISTSQL) SELECT sum(a), avg(b), sum(c), avg(d), stddev(a), variance(b), sum(a+b+c::INT+d) FROM data ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJzUVt9r4kAQfr-_YpmnBEfibuKvPK1UhYC1rbHloEjZZhdPsIm3ieWO4v9-JPE0ljYJCIJvM5n59vtmv4HNB8S_1-CCP5qMbuZkq9dkPLu7Jc-jn_eTgTclxtDz5_7DxCT7lnj7ZggTiXhfGq8mZnmwz2WaJ1Kq96zlXeiVCAN16DMMQRrk1SQNEriuN5330lCaOacUiVgAQhhJNRVvKgb3GSggMECwAcEBhDYsEDY6ClQcRzpt-cgAnvwDbgthFW62Sfp5gRBEWoH7AckqWStwYS5e12qmhFTaagGCVIlYrTOalJtv9OpN6L-A4G9EGLukaVEiQkkoiZJfSgPCTIVSaZdwp2EYnDY4Mxvc3s-ChFMknCHhNhLuwGKHEG2To6I4EUsFLt1hfdWD5VKrpUgibbVPRfuPtwZnZqo3jew0url7nM73cfbVOUTtQj2L_YfZ0BuP92fsK-ykcjyHmt-Ow74d5zjFNoy0VFrJkxEWu_KBaeuLielB0__ZX7zSmQ8dnTQbe9PB5MWfD4ejJ4N3kVPkvWPhaTDzBtObkcH7yBkWb6BlFjcgs9rKnUbC2xbvIOFdJLyHhPe_vS375LZo_ZWldVbWok2LXWBpK3QXPOxcw9Ky-jawWjawpmVfwIYK3QUbutdgg13fBruWDXbTci5gQ4Xugg29a7DBqW-DU8sGp2m1L2BDhe6CDf1rsKHix2Cm4k0UxurTi_r1ya30pVVyqfJnOY62OlD3Ogoymjy9y3DZB6niJK_SPPHCvJQKLIJpKZidgOlnMCtnrqC2S9FOOdg5R3e7FNwpZ-6cw9wtBffKmXvnMPfLvWpVrEn5kn3mXux-_AsAAP__P0G5-g== +distribution: full +vectorized: true +· +• group (scalar) +│ +└── • render + │ + └── • scan + missing stats + table: data@primary + spans: FULL SCAN +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJzUVl9r6k4Qff99imWeEhyJu4n_8rRSFQLWtsaWH1ykbLOLV7CJdxPLvRS_-yXRq7G0m0BB8G0mM2fPmT0Dm3dIf63Bh9H_95NBMCXWMAjn4cPEJuFoMrqZk3T7agkbiXhbWi82Fnl0yGWeZ1Kqt6LlTeiViCN17LMsQRrkxSYNEvl-MJ338lDaZDy7uyVSZAIQ4kSqqXhVKfg_gAICAwQXEDxAaMMCYaOTSKVpovOW9wIQyN_gtxBW8Wab5Z8XCFGiFfjvkK2ytQIf5uJlrWZKSKWdFiBIlYnVuqDJqflGr16F_gMI4UbEqU-aDiUiloSSJPupNCDMVCyV9gn3GpbFaYMzu8HdwyhIOEXCGRLuIuEeLHYIyTY7KUozsVTg0x3WVz1YLrVaiizRTvtcdPh4a3Fm53rzyM2jm7vH6fwQF1-9Y9Qu1Ys4fJgNg_H4cMahws4qp3Oo_eU47MtxTlNs40RLpZU8G2GxMw9MW59MTI-a_s3-HBhnPnZ08mwcTAeT53A-HI6eLN5FTpH3ToWnwSwYTG9GFu8jZ1i-gZZd3oDCamfvNBLedngHCe8i4T0kvP_lbblnt0Xrryyts7IObTrsAktbobvkYecalpbVt4HVsoE1HfcCNlToLtnQvQYb3Po2uLVscJuOdwEbKnSXbOhdgw1efRu8WjZ4Tad9ARsqdJds6F-DDRU_BjOVbpI4VR9e1M9PbuUvrZJLtX-W02SrI3Wvk6ig2ad3Ba74IFWa7at0nwTxvpQLLIOpEczOwPQjmJmZK6hdI9ozg73v6G4bwR0zc-c7zF0juGdm7n2HuW_2qlWxJuYl-8i92P33NwAA___DI7Sb query T -SELECT url FROM [EXPLAIN (DISTSQL) SELECT sum(a), min(b), max(c), count(d), avg(a+b+c::INT+d), stddev(a+b), variance(c::INT+d) FROM data] +EXPLAIN (DISTSQL) SELECT sum(a), min(b), max(c), count(d), avg(a+b+c::INT+d), stddev(a+b), variance(c::INT+d) FROM data ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJzUVl9r-koQfb-fYpmnDY7ETeKf5mmlKgSstsb2FoqUbXbxCpp4N7H0R_G7_9hoUy1tDPRBfHJ3Zo5nzpyB7Duk_y_Bh7A_7F9PyUYvyWAyviFP_cfbYTcYEdoLwml4N7TIviTdrKiwkKwWMX0xv-KNRhaSKNnEGZUWEvE6p5QKUiMvFqmRyPeD0bRjjiabZlKq130ayavQCxFHiu7L8qpdD1JkYgYIcSLVSKxUCv4TMEBwAMEFBA8QmjBDWOskUmmaaFPyngMC-QZ-A2ERrzeZCc8QokQr8N8hW2RLBT5MxctSTZSQStsNQJAqE4tlTmO4-VovVkL_AYRwLeLUJ3WbERFLwkiS_ac0IExULJX2CfdqlHJW445V4-5eMZI8gib7ETQxJHnQhdkWIdlknx2mmZgr8NkWq6vozudazUWWaLt5LCK8v6HcswDhJhhR3sxP3UfKW-Z0Pb4fTZ8n439Daq55MSsS-3N4N-kFgwHlTlHjHNQ4RzVuUeMe1LjWjzqdH3V-ytvEiZZKK3mkbbYtnwRrfDMKVozCKUbx0fNzYHr1CgXNo3g-sEEw6g6fw2mv13-gvI28g_zqM_HQnQTd0XWfctZAzhhyltMUK1L4bhYCCW_avIWEt5Hwzo8jco9GxKovNKuy0Dar284ZVvqEjgMjWxe90k51v5xKfjl12z2DXyd0HPjVvmi_3Op-uZX8cuu2dwa_Tug48Ktz0X551f3yKvnl1e3mGfw6oePAr6uL9uvEU2ai0nUSp-rLp_77f26YJ4CSc7V7L6TJRkfqVidRTrO7jnNcHpAqzXZZtrsE8S5lGjwEs1KwcwRmX8FOOfMJarcU7ZWDvd_03SwFt8qZW79hbpeCO-XMnd8wX5V71TixJuVL9pV7tv3nbwAAAP___t7rIQ== +distribution: full +vectorized: true +· +• group (scalar) +│ +└── • render + │ + └── • scan + missing stats + table: data@primary + spans: FULL SCAN +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJzUVl9r6k4Qff99imWeNjgSN4l_mqeVqhCw2hrbX-EiZZtdvIIm3k0svRS_-2WjTbW0MdAH8cndmTmeOXMGsm-Q_lmCD_3H22E3GBHaC8JpeDe0SNgf9q-nJN2sqLCQrBYxfTa_4pVGFpIo2cQZlRYS8TKnlApSI88WqZHI94PRtGOOJptmUqqXfRrJi9ALEUeK7svyKjKYjG-IFJkAhDiRaiRWKgX_FzBAcADBBQQPEJowQ1jrJFJpmmhT8pYDAvkKfgNhEa83mQnPEKJEK_DfIFtkSwU-TMXzUk2UkErbDUCQKhOLZU5jqPlaL1ZC_wWEcC3i1Cd1mxERS8JIkv1WGhAmKpZK-4R7NUo5q3HHqnF3LxhJHkGTfQ-aGJI86MJsi5Bsso8O00zMFfhsi9VVdOdzreYiS7TdPBYR3t9Q7lmAcBOMKG_mp-4j5S1zuh7fj6ZPk_H_ITXXvJgVif05vJv0gsGAcqeocQ5qnKMat6hxD2pc61udzrc6P-Rt4kRLpZU80jbblk-CNb4YBStG4RSjeO_5KTC9eoWC5lE8H9ggGHWHT-G01-s_UN5G3kF-9ZF46E6C7ui6TzlrIGcMOctpihUpfDcLgYQ3bd5CwttIeOfbEblHI2LVF5pVWWib1W3nDCt9QseBka2LXmmnul9OJb-cuu2ewa8TOg78al-0X251v9xKfrl12zuDXyd0HPjVuWi_vOp-eZX88up28wx-ndBx4NfVRft14ikzUek6iVP16VP_9T83zBNAybnavRfSZKMjdauTKKfZXcc5Lg9IlWa7LNtdgniXMg0eglkp2DkCs89gp5z5BLVbivbKwd5P-m6WglvlzK2fMLdLwZ1y5s5PmK_KvWqcWJPyJfvMPdv-9y8AAP__HHblwg== # Verify that local and final aggregation is correctly shared and de-duplicated. query T -SELECT url FROM [EXPLAIN (DISTSQL) SELECT sum(a), stddev(a), avg(a) FILTER (WHERE a > 5), count(b), avg(b), variance(b) FILTER (WHERE b < 8), sum(b) FILTER (WHERE b < 8), stddev(b) FILTER (WHERE b > 2) FROM data] +EXPLAIN (DISTSQL) SELECT sum(a), stddev(a), avg(a) FILTER (WHERE a > 5), count(b), avg(b), variance(b) FILTER (WHERE b < 8), sum(b) FILTER (WHERE b < 8), stddev(b) FILTER (WHERE b > 2) FROM data ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJzslk1v4jAQhu_7K6w5BckocT74yMmoBG0kCm2g7UpdVBlisUiQsE5S7ariv69MWpJQSKLtgQsn8HjeeT2Tx5LfIPq9BhsmztC5maJErNHAG9-iZ-fH3bDnjpDSdyfTyf2wgd5TomSjsAZGUez7_HX_l70uFdZAA3c4dTykPH13PAcx9DPRNIMjq4HRIkyCWJm_58rfVyZWLFhwZX4snKfCBepIl2RTlZGe41wSR3ojbclnMZsBhiD0-YhteAT2MxDAoAMGAzCYgMGCGYatCBc8ikIhU972Atf_A7aGYRVsk1iGZxgWoeBgv0G8itccbJiy-Zp7nPlcqBpg8HnMVuu9jfSmW7HaMPEXMEy2LIhs1FQJYoGPCArjX1wABo8HPhc2oiQ9vGXbtjuadjCietpz5zjC9SxCZBRmOwxhEmcHjWK25GCTHa7fTG-5FHzJ4lCoVrGXycOtQs2GbOPe67uDwfvqZvwwmn7spDkfn4SS_P7n6Is3fpooB6GVK2cVjKxMrGfZhdhBV8w8UcE4UcE4WcE4O1P97EyzUSZBKHwuuF-Y42xXPnWinRg7kdMYuKPe8GUy7fedR4XqmBJMjdzU038vbja-j1XrkNUuxDtZ2cee5_ZGN45Cu5gSDVNCDiKifbYn0t_AlOx9M34liRhRQ6UmRtTCiLZU2saISk67klXt7FCNwlBJ_VtH6tw6lTRV_XL3rqKdHAGt672ree_0-ojotRDRm6pxOUQq2skh0r4iUhMRoz4iRi1EjKZqXg6RinZyiHSuiNRExKyPiFkLEbOpWpdDpKKdHCLdKyL_8cA7MVOPR9swiPjRQ-90ZU0-ALm_5OlrMQoTseB3IlzsbdLleK_bB3wexekuSRdukG7JA-bFpFSsF8TkWKyXO1dYG6Vqs1xsfuXcVqm4Ve7c-opzu1TcKXfufMW5W_6ttApMyiE79p7tvv0LAAD___LepH8= +distribution: full +vectorized: true +· +• group (scalar) +│ +└── • render + │ + └── • scan + missing stats + table: data@primary + spans: FULL SCAN +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJzsls9v6jgQx-_7V1hzCpJR4jjhR05GJWgjUWgDbVfaRZUhFosECc9JqvdU8b8_mbQkoRCi1wMXTuDxfOfrmXws-R3iH2twwP3nYdjzRkjre5Pp5HHYQBN36N5NUZxuNN7AKE6CQLzt__K3pcYbaOANp66PtJe_Xd9FHP2XGgYVyG5gtIjSMNHmH7nq943LFQ8XQpsfC-eZcIE6yiXdXMrIznEuSSCzgQb--B4FPOGAIYwCMeIbEYPzLxDAYAIGChgswGDDDMNWRgsRx5FUKe97gRf8BMfAsAq3aaLCMwyLSApw3iFZJWsBDkz5fC18wQMhdQMwBCLhq_XeRlmzrVxtuPwFGCZbHsYOauoE8TBABEXJ_0ICBl-EgZAOYiQ7u-04jjeadjBiZtZy5zgizDxCVBRmOwxRmuQHjRO-FOCQHa7fTG-5lGLJk0jqdrmXydO9xqyGauPR73uDwcfqbvw0mn7uZDmfX4SR4v7X6Ks_fploB6FdKGeXjOxcbObZpdhBV848UYGeqEBPVqBnZ2qenWk-yjSMZCCkCEpznO2qp06ME2MnahoDb9Qbvk6m_b77rDETM4IZLUw9-_fq5eP7XLUOWe1SvJOXfe75Xm9052qsixkxMCPkICLGV3ui_ClmZO-b86tIxIhRnVkYMRsj1tJZGyOmOO0qVo2zQ6WloZL6t47UuXU6aerm9e7dhXYKBLRu967mvTPrI2LWQsRs6vR6iFxop4BI-4ZITURofURoLURoU7euh8iFdgqIdG6I1ETEqo-IVQsRq6nb10PkQjsFRLo3RP7ggXdipr6It1EYi6OH3unKhnoAimApstdiHKVyIR5ktNjbZMvxXrcPBCJOsl2SLbww21IHLIpJpdgsicmx2Kx2vmBNK9VWtdj6zrntSnGr2rn1Hed2pbhT7dz5jnO3-lsZFzCphuzYe7b763cAAAD__1EKnyA= query T -SELECT url FROM [EXPLAIN (DISTSQL) SELECT sum(a), avg(DISTINCT a), variance(a) FILTER (WHERE a > 0) FROM data] +EXPLAIN (DISTSQL) SELECT sum(a), avg(DISTINCT a), variance(a) FILTER (WHERE a > 0) FROM data ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJy0k8GOmzwQgO__U1hzSiRHYCC_Kp8SpWyLlGW3QLeVthxcPKJIBFPbrFpFefcKaJVmla6okh49M5_n81izB_O1Bg5puA03Gel0TW6Su1vyGH68366jmMxeR2mWvtvOyc8S0-1mYk6JeCqHXBRvMtIHnoSuRFPgTMzJTbTNwoTMPrwNk5AI8qlzXR-JOx9vl8KKHCg0SmIsdmiAPwIDCh5Q8IFCABSWkFNotSrQGKX7kv0ARPIbcJdC1bSd7cM5hUJpBL4HW9kagUMmPteYoJCoHRcoSLSiqoc2fe9Vq6ud0N-BQtqKxnCycBgRjSSMKPsFNVBIsJGoOVmxUd7lnEdx9oqSFYP8QEF19ihgrCgRODvQP0ge3bpGaYka5YlXfjjzjHVZaiyFVdpZnr4ifX87W3lzoLB-eHP8hzH0sE6idbwJ-4pfX_GCtHcizaZPlk2ZrMMWjnf92XrTNb1Jmt7C8a-v6U_X9Cdp-gsnuL5mMF0zmKQZLJzlv12oM5oJmlY1Bp8t1vmb3X7hUJY4bqdRnS7wXqtiaDMe7wZuCEg0dsyy8RA1Q2oQ_B1mL8L_n8Duc9i7pLN_CRxcAi__Cs4P__0IAAD__9RoCg8= +distribution: full +vectorized: true +· +• group (scalar) +│ +└── • render + │ + └── • scan + missing stats + table: data@primary + spans: FULL SCAN +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJy0k1GLm0AQgN_7K5Z5SmCDrppS9imSeq2Q865qr4XWh607WCFx7e56tIT896JS0hzpYUnucWf22_l2htmD-bEFDtHn-00YJ2T2Ns7y7MNmTrJoE61zYrrdTMwpEY_VkIuTdU76wKPQtWhKnIk5uYk3eZSS2af3URoRQb52rusjcefkJr27JVJYARQaJTEROzTAvwADCh5Q8IFCABSWUFBotSrRGKX7K_sBiOVP4C6Fumk724cLCqXSCHwPtrZbBA65-LbFFIVE7bhAQaIV9XYo05detbreCf0LKGStaAwnC4cR0UjCiLLfUQOFFBuJmpMVG91dznmc5G8oWTEoDhRUZ48CxooKgbMD_Yfk0a1rlJaoUZ54FYcz3wirSmMlrNLO8vQX2cfb2cqbA4Xw4d1xDGPoIUzjMFlH_Y0_k3hG2juRZtM7y6Z01mELx7t-b73pmt4kTW_h-NfX9Kdr-pM0_YUTXF8zmK4ZTNIMFs7yZRfqjGaKplWNwSeLdf5lt184lBWO22lUp0u816ocyozHu4EbAhKNHbNsPMTNkBoE_4bZs_DrE9h9CnuXVPYvgYNL4OV_wcXh1e8AAAD__05NBLA= query T -SELECT url FROM [EXPLAIN (DISTSQL) SELECT sum(a), avg(a), count(a), stddev(a), variance(a) FROM data] +EXPLAIN (DISTSQL) SELECT sum(a), avg(a), count(a), stddev(a), variance(a) FROM data ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJy8lF9ro0AUxd_3Uwz3KYEJZtT0j0-GJgEhTVpNuwsllFnn4gZSJzszll1KvvuiLlRDo4KQp8z1zvEcf7ncD9C_9-BBNF_O7zYkU3uyCNf35GX-42E5DVZkMAuiTfS4HJL_V3T2NuBDSvh7UvzGMktNcdJGCHwvju9c7Xga44APy_cJbvgWKKRS4Iq_oQbvBRhQsIGCAxRcoDCBLYWDkjFqLVV-5aMQBOIPeGMKu_SQmfzxlkIsFYL3AWZn9ggebPjPPYbIBSprDBQEGr7bFza5t39Quzeu_gKF6MBT7ZGRxQhPBWFEml-ogMI6Mx7xGWyPFGRmPr204QmCx460e55pkihMuJHKmtTjRE_3A58NgcLd-mm1qZ5fw_X3aJCX0WM4CxaLonkuj302z2eMLJVKoEJRy7A9Nidm43ORo6f71yAPbdcqJ68WwWq6fI02s9n8eeC71Ge0vFY2nqdhMF3dzWutEFOBKsdOic8s36bEdyjxXUr8ydkvd2pfzrpPBusyGRYbWXav2WhJVCF9dZHZsLsTsjsRskeW04tQS6IKoeuLEHK6E3I6EXJGltuLUEuiCqGbixByuxNyOxFyR9akF6GWRBVCtxffwF_kCVEfZKrxZBN__eZxvqFRJFiucy0zFeODknFhU5brQlc8EKhN2WVlEaRlKw9YFbNGsV0Ts1Ox3ezcYu00qt1msdsn96RRfNXsfNXH-bpRfNPsfNPH-bb5vxq3jEnzkJ16b4_f_gUAAP__cGQ6MQ== +distribution: full +vectorized: true +· +• group (scalar) +│ +└── • scan + missing stats + table: data@primary + spans: FULL SCAN +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJy8lF9ro0AUxd_3Uwz3ycAEM2r6xydDk4CQJq2m3YUllFnn4gZSJzszll1KvvuiPlRLo4KQp8z1enLO_Lzcd9B_DuDD4sfDahauiTUP4238uBqReLFa3G2Jzl8tPqKEv6XlbyLzzJQnbYTAt_L4xtWeZwlafESW0eaeCG44UMikwDV_RQ3-T2BAwQEKLlDwgMIUdhSOSiaotVTFK--lIBR_wZ9Q2GfH3BSPdxQSqRD8dzB7c0DwYct_HTBCLlDZE6Ag0PD9obQprIOj2r9y9Q8oxEeeaZ-MbUZ4Jggj0vxGBRQ2ufFJwGB3oiBz8-GlDU8RfHai_fPM0lRhyo1U9rQZJ366twI2Agp3m6f1tn5-iTbfY6so48doHi6XZfNcHudsno8YeSaVQIWikWF3ak_MJucix0_3L2ER2mlUblEtw_Vs9RJv5_PFsxV4NGC0eq1qPM-icLa-WzRaEWYCVYGdkoDZgUNJ4FISeJQE07M3dxs3Z_0ng_WZDJuNbWfQbHQkqpG-ushsOP0JOb0IOWPbHUSoI1GN0PVFCLn9Cbm9CLlj2xtEqCNRjdDNRQh5_Ql5vQh5Y3s6iFBHohqh24tv4C_yRKiPMtP4aRN__c-TYkOjSLFa51rmKsEHJZPSpio3pa58IFCbqsuqIsyqVhGwLmatYqchZp_FTrtzh7Xbqvbaxd6Q3NNW8VW789UQ5-tW8U27880Q59v2bzXpGJP2IfvsvTt9-x8AAP__YWk00g== query T -SELECT url FROM [EXPLAIN (DISTSQL) SELECT sum(a), avg(b), sum(a), sum(a), avg(b) FROM data] +EXPLAIN (DISTSQL) SELECT sum(a), avg(b), sum(a), sum(a), avg(b) FROM data ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJy0lF-L2kAUxd_7KYb7pDASZxJ33Txl2VoQ_LM1CoUllFnnkgqasTOT0iJ-95Kk7aqsk0Ds272TnJyT3x3uAcz3LYQQjyajpyXJ9ZZ8Wsyn5GX05XnyOJ6RzsdxvIw_T7rkzysm33VElxLxI-28dum__vy8-ooUViRAIVMSZ2KHBsIXYECBAwUfKARAYQAJhb1WazRG6eKVQykYy58Q9ilssn1ui-OEwlpphPAAdmO3CCEsxesWFygkaq8PFCRasdmWNoV3tNebndC_gEK8F5kJSc9jRGSSMKLsN9RAYZ7bkESMRhySIwWV2zc7Y0WKELIjbR7pMU01psIq7Q3OE8WraSdi3SJMUfGiepqvZsuyvmbOr5q_eeaZ0hI1yjPD5OiOx_r1-eLV9Ou4SOgX3QIzibrERSLuRT6tyr_t1Z_wz36CNR8qazJUj_U83nasNaFOuN3dfqy8ORHeiAjveX5bIjWhTojc356I35yI34iI3_OCtkRqQp0QGd6eSNCcSNCISNDzBm2J1IQ6IfLwf5fhO-YLNHuVGbxYiu9_uV8sS5QpVpvVqFyv8VmrdWlTtfNSVx5INLZ6yqpmnFWPioCnYuYU8zMxuxRzt3ONte9UB25x0Cb3wCm-czvftXG-d4qHbudhG-cH96z6NdfEfckuvZPjh98BAAD__4gfEsY= +distribution: full +vectorized: true +· +• group (scalar) +│ +└── • scan + missing stats + table: data@primary + spans: FULL SCAN +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJy0lF-L2kAUxd_7KYb7pDASZxJdN09ZthYE_2yNQqFImXUuqaAZOzMpLeJ3L0lo18g6CcS-3TvxeM787nBPYH7sIYTxl5fp02ROOh8n8Sr-PO2SeDwdP6-IyQ4d0aVE_Ew6r136r6-ek0_LxYxIYQVQSJXEuTiggfArMKDAgYIPFAKgMIANhaNWWzRG6fwnp0Iwkb8g7FPYpcfM5scbClulEcIT2J3dI4SwEq97XKKQqL0-UJBoxW5f2OTW0VHvDkL_BgrxUaQmJD2PEZFKwoiy31EDhUVmQxIxGnHYnCmozL7ZGSsShJCdafNIT0miMRFWaW9QTRSvZ52IdfMwecXz6nmxnq-K-pY5v2n-5pmlSkvUKCuGm7M7HuvX54vXs2-TPKGfd0tMJeoCF4m4F_m0LP-2Ny_hVy7Bmg-VNRmqx3oebzvWmlAX3Ib3HytvToQ3IsJ7nt-WSE2oCyIP9yfiNyfiNyLi97ygLZGaUBdERvcnEjQnEjQiEvS8QVsiNaEuiDz-32X4jvkSzVGlBq-W4vv_3M-XJcoEy81qVKa3-KLVtrAp20WhKw4kGlt-ZWUzSctPecBLMXOKeUXMrsXc7Vxj7TvVgVsctMk9cIqHbudhG-cHp3jkdh61cX50z6pf80zcj-zae3P-8CcAAP__edINZw== query T -SELECT url FROM [EXPLAIN (DISTSQL) SELECT avg(c), sum(c), avg(d), sum(d) FROM data] +EXPLAIN (DISTSQL) SELECT avg(c), sum(c), avg(d), sum(d) FROM data ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJy8lF-L2kAUxd_7KYb7ZGAkThJdN08R64Lgn61RKCyhTJ1LKmhiZyalRfzuJYmwUdZJILhP8d7M8Zz87nBPoH7vwYdwMpuM1ySTe_KyWs7J2-T762w0XZDO12m4Dr_NLHI5wv_Ena1FicoOxTOvxaUWVqkWXPMIKCSpwAU_oAL_DRhQcICCCxQ8oNCHiMJRpltUKpX5kVMhmIq_4Pco7JJjpvN2RGGbSgT_BHqn9wg-rPnPPa6QC5R2DygI1Hy3L2xy7-Aodwcu_wGF8MgT5ZOuzQhPBGEk1b9QAoVlpn0SuDTwIDpTSDP9bqc0jxF8dqbNI43iWGLMdSrt_nWicDPvBMwCCuPlZrG-_C66TqXrWHeDOHeDvPtnSSoFShRX5tHZHJX17mUNN_Mf00uuS1r3qu_l1QoTgdInAbPHozA_PQpfZsvRemhREjBKAtcOvPxx9-Pcq49jzQfPmgzeZl3baTv6mlAVnoPHjt5pTsdpRMfp2m5bOjWhKnSeHkvHbU7HbUTH7dpeWzo1oSp0ho-l4zWn4zWi43Xtfls6NaEqdJ4_b6l-EGSF6pgmCm-W68f_3MuXLooYyw2t0kxu8VWm28KmLJeFrmgIVLp8y8pimpSv8oBVMTOKnSsxuxU7Zucaa9eo9sxir03uvlE8MDsP2jg_GcVDs_OwjfOzeVa9mmtivmS33tH5y_8AAAD__4dvJK0= +distribution: full +vectorized: true +· +• group (scalar) +│ +└── • scan + missing stats + table: data@primary + spans: FULL SCAN +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJy8lF-L2kAUxd_7KYb7tIGROEl03TxFrAuCf7ZGoVCkTJ1LKmjGzkxKi_jdS6KwiayTQLBP8d7keM787nBPoH_tIYTx17fpcDInT58n8Sr-MnVIPJ6ORyvCfydPW4cSnR2KZ16Lay0c8rpczIjghgOFVAqc8wNqCL8BAwoeUPCBQgAUerChcFRyi1pLlX9yKgQT8QfCLoVdesxM3t5Q2EqFEJ7A7MweIYQV_7HHJXKByu0CBYGG7_aFTW4dHdXuwNVfoBAfeapD0nEZ4akgjEjzExVQWGQmJJFPowA2ZwoyM-922vAEIWRn2jzSMEkUJtxI5faqieL17CliDlAYLdbz1fV30fVKXc-5G8S7G-TdP0ulEqhQVMw3Z3tU1r2XNV7Pvk-uua5p_Uo_yKslpgJVSCLmjoZx_vUwfp0uhquBQ0nEKIl8Nwryx93D-ZXDseaDZ00G77KO67UdfU2oEs_-Y0fvNafjNaLjdVy_LZ2aUCU6z4-l4zen4zei43fcoC2dmlAlOoPH0gma0wka0Qk6bq8tnZpQJTov_2-pfhBkifooU403y_Xjf-7mSxdFgpcNrWWmtvim5LawuZSLQlc0BGpzecsuxSS9vMoDlsXMKvYqYnYr9uzONda-VR3YxUGb3D2ruG937rdxfraKB3bnQRvnF_usujXXxH7Jbr0350__AgAA___gMx9O query T -SELECT url FROM [EXPLAIN (DISTSQL) SELECT max(a), min(b) FROM data HAVING min(b) > 2] +EXPLAIN (DISTSQL) SELECT max(a), min(b) FROM data HAVING min(b) > 2 ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJyslF1v2jAUhu_3K6xzBZJRYie04KugjW6R-OgATZW6XLjkiEUKMXMcqRPiv0-QbSVVcdKFy9h-eV4eHZ095D9TELAcT8YfV6TQKblbzKfkcfxwPxmFM9L5FC5Xy6-TLvnzZCufO7JLyTbJOk_d8nUsjSRfRt_C2ee_598L1_WQ8AgoZCrGmdxiDuIRGFDgQMEDCj5Q6ENEYafVGvNc6eOT_SkQxs8gXApJtivM8TiisFYaQezBJCZFELCSTykuUMaoHRcoxGhkkp4wx0rBTidbqX8BheVOZrkgPYcRmcWEEWV-oAYK88IIEjAacIgOFFRhXnC5kRsEwQ60eaXRZqNxI43STr_aaDp66ASsCxSm4awT8O5FIL8IfOEUmdIxaowrkOhgr8Tc_-3kvUfCXZIa1Kgdxqq88kKQgP8bECFEOFsNLoL9Cpg1HwjWZCAc1nN425GoKXXm_-Y6I8GbW-CNLPCe47W1UFPqzMLtdSx4zS14jSx4Pcdva6Gm1JmFwXUs-M0t-I0s-D2n39ZCTakzC8PrL8k3gAvMdyrL8dWyfPuX3eMSxXiD5cbNVaHXeK_V-oQpP-en3OkgxtyUt6z8CLPy6ljwPMysYV4Js9dhbg17drJnr83tad-a7tvD_TZ_-sYavrWTb9uQB9bw0E4etiGzmhmrG7L3TVl0-PA7AAD__0wdMxs= +distribution: full +vectorized: true +· +• filter +│ filter: min > 2 +│ +└── • group (scalar) + │ + └── • scan + missing stats + table: data@primary + spans: FULL SCAN +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJyslF1v2jAUhu_3K6xzBZJRYicU8FXQRrdIfHSApkobFy45YpEgZrYjdUL89ylEW6EqTrpwaZuX582jo3MA82sLAkaPD-NhPCWtT_Fiufg6bpPFaDz6uCQ7-dySbUp2adZ6apP7-WxCEmkl-TL8Fk8__73_kft-gIQDhUwlOJU7NCC-AwMKxWUAFEKg0IUVhb1WazRG6eInh1MgTp5B-BTSbJ_b4npFYa00gjiATe0WQcBSPm1xjjJB7flAIUEr0-0JUzSK9jrdSf0bKCz2MjOCdDxGZJYQRpT9iRoozHIrSMRoxGF1pKBy-4IzVm4QBDvS-pWGm43GjbRKe93LRpPhYytibaAwiaetiLevAvlV4Asnz5ROUGNyAVkd3ZWY_7-dgvdIuE-3FjVqj7FLXvkgSMT_zYcQIp4u-1fB4QWY1R8IVmcgPNbxeNORqCh15v_uNiPB61vgtSzwjhc0tVBR6sxC7zYWgvoWgloWgo4XNrVQUerMQv82FsL6FsJaFsKO121qoaLUmYXB7ZfkG8A5mr3KDL5alm__s18sUUw2WG5co3K9xget1idMeZydcqeLBI0tX1l5iLPyqSh4HmbOML8Is9dh7gwHbnLgrs3d6dCZ7rrD3SYffecM99zkXhNy3xkeuMmDJmRWMWNVQ_a-KVsdP_wJAAD__7X7Lbw= query T -SELECT url FROM [EXPLAIN (DISTSQL) SELECT DISTINCT (a) FROM data] +EXPLAIN (DISTSQL) SELECT DISTINCT (a) FROM data ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJy8lU1r4zwQx-_PpxBzanlkHPklbX3q0nYhkE26SQ4LxQc1Fo0htbySDFtCvvvieEmal2ocZHKUrZ_mb_2G8Qr07yUkMH0aPj3MSKWW5Ptk_IO8PP16Hn4bjMjV42A6m_4cXpN_W-r1YPQwI1f8utmbccNToFDITIz4u9CQvAADCgFQCIFCBBRiSCmUSs6F1lLVW1YbYJD9gaRHIS_KytSPUwpzqQQkKzC5WQpIYMZfl2IieCaU3wMKmTA8X27K1LXvS5W_c_UBFKYlL3RCPJ8RXmSEEWkWQgGFcWUScs8gXVOQldnV0oa_CUjYmrbP85hrkxdz48f7Ye7rjx6rTCiRnai2O-D1gyy4XhzR6XqXKPgy0e4c2dQ6POf_5qAvY7PeWbl3mcIWmariVKqTgUbSk6XP4oOdp2tHe7VZ-45hbTrGZ54fOPUMkmh7-f2L9QzrtGdYJz0TtPcWtPIWeH7o5A1JtL2Am4t5Czr1FnTiLWzvLWzlLfT8yMkbkmh7AbcX8xZ26i3sxFvU3lvUylvk-bGTNyTR9gLuLuYt6tRb1Pm_9US5idClLLRo9efs1YFF9iaaD9SyUnPxrOR8U6ZZjjfc5kEmtGnesmYxKJpXdcDPMDuE2Wc42IPZeXDfBb5zgZlTbhbb6cB636EdDu2y-nZbkZWO7XDsotoOI6rtMKLaDmOqERpR3XdRfWOFb-2ybl1k2WFElh1GZNlhTBZCI7LuXGQxZIpiY9RtjroNUrdJ6jhK3WYpcxqmDJmmESLtaJyeJc1OY9LsNCbNTqPSEByTdjRUrdLS9X9_AwAA__9Q4BZ6 +distribution: full +vectorized: true +· +• distinct +│ distinct on: a +│ order key: a +│ +└── • scan + missing stats + table: data@primary + spans: FULL SCAN +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJy8lVuL4jAYhu_3V4TvaoZNqenB0V65zLgguDqrXiwsXmRsGAtO020i7CD-96EWdDxMvkiKlz08-d7mCW83oP6tIIH-n-fhj8GI3D0NprPp7-E9mfaH_ccZqa4Ho8cZueP35Odk_IukXHOgkMtUjPibUJD8BQYUAqAQAoUIKMQwp1CUciGUkmX1ymYHDNL_kLQoZHmx1tXtOYWFLAUkG9CZXglIYMZfVmIieCpKvwUUUqF5ttqNqUb3ijJ74-U7UJgWPFcJ8XxGeJ4SRqReihIojNc6IT0G8y0FudaHWUrzVwEJ21L7PE-Z0lm-0H58HKZXffS4TEUp0gvTDgu8vJMlV8szer49JAq-THRYR9azTtf5Xi_0ZWzWuir3IVNokWmdX0p1MdBIerLwWXzy5uXZ0dFsZn9imM2J8ZnnB05nBkm03_z2zc4Ma_TMsEbOTGDvLbDyFnh-6OQNSbTfgIebeQsa9RY04i209xZaeQs9P3LyhiTab0DnZt7CRr2FjXiL7L1FVt4iz4-dvCGJ9hvQvZm3qFFvUeP_1gvjJkIVMlfC6s_ZqgKL9FXUH6jkulyI51IudmPqy_GO291IhdL1U1ZfDPL6URXwM8xOYfYZDo5gdh3cdoG7LjBzys1iMx0Y9zs0w6FZVttsKzLSsRmOXVSbYUS1GUZUm2FMNUIjqtsuqh-McMcsq-MiywwjsswwIssMY7IQGpHVdZHFkBbFatStR92K1K1JHavUrUuZU5kypE0jRNpZnV4lzUxj0sw0Js1Mo9IQHJN2VqpGafPtt48AAAD__2gsERs= query T -SELECT url FROM [EXPLAIN (DISTSQL) SELECT SUM (DISTINCT A) FROM data] +EXPLAIN (DISTSQL) SELECT SUM (DISTINCT A) FROM data ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJy8ll9r4kAUxd_3U4T71LKReCfxX54sbReEtnarCwvFh6kZrGATd2YCW4rffdEsGv_dm5DgozFn7p1zfhzyBebPAkIY3T_c346dVC-cHy_DR-f1_vfzw83gybm6G4zGo58P187_V0z6sXk2eLodO_I6ez2SVk7AhTiJ1JP8UAbCV0BwQYALPrgQgAstmLiw1MlUGZPo9StfG8Eg-gth04V5vEzt-vHEhWmiFYRfYOd2oSCEsXxbqBclI6W9JrgQKSvni82Y9ez-Us8_pP4EF0ZLGZvQaXjoyDhy0Ensu9LgwjC1odNHmKxcSFK7m2WsnCkIceUW3-dubuw8nlqvtb9Mf33poY6UVtGJabsD3j6dd2nej9ST1W4jcXaj3TlJNuvwnO_ZQWfXxmapvXc7-WVcupnNtJpJm2gPD4wa_Xq86uP12TlBgbun8anbn7x4bhPRLLdJa28TLM4pFuHUw4YnKpHKbLSNvH0xUrFWUrEWUhmX8qS2q5AqivMhCvEhGp5fiQ9mo63RnYvxIWrlQ9TCB-NSno9OFT784nz4hfjwG15QiQ9mo63R3Yvx4dfKh18LH4xLeT66VfgIivMRFOIjaHitSnwwG22N7l2Mj6BWPoJa-GBcyvPRq-tL6MScF2WWSWzUwRfR6ZOba2NUNFOZkSZJ9VQ962S6GZP9HG50mweRMjb7F7Mfgzj7a71gXoyHYsyLxZ4Yy4k7VcSIldStSuoerRak4T5tuE-KA3pyQIoFk3WLVLdpcbsKKLSYAYUWc6AwagYURs2A0iEN79KGd6uA0qM7ocmUwlGllGoFWs3VAq1me4GRc8XAyJnA8ahY9n0XjO90szCZI10tGDDDj8qlVOi0mgudVrOhM3IudEbOhU73KjLFikcdUyp0umOQKRk8aplSodNqLnRazYbOyLnQGTkXOt2wgmlYQX-0HYY-WX37FwAA__89ryzV +distribution: full +vectorized: true +· +• group (scalar) +│ +└── • distinct + │ distinct on: a + │ order key: a + │ + └── • scan + missing stats + table: data@primary + spans: FULL SCAN +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJy8ll9r4kAUxd_3U4T71LIj8U7ivzxZ2i4Ibe1WFxYWH6ZmsIJN3JkRthS_-6IBjX96b0KCjyaeuXfO-XHIJ9i_C4jg_vfzw83gybu6G4zGo58P197o_uH-duzZ1fv22eDpduypa-_Hy_DRi5VTICBJY_2k3rWF6A8gCJAgIAABIQhowUTA0qRTbW1qNn_53AoG8T-ImgLmyXLlNo8nAqap0RB9gpu7hYYIxup1oV-0irXxmyAg1k7NF9sxm9H9pZm_K_MBAkZLldjIa_joqST20EvdmzYgYLhykddHmKwFpCu3n2WdmmmIcC2K73M3t26eTJ3fOlymv7n00MTa6PjMtP0Brx_em7JvJ-rJer-R_HKj_TlpNuv4nO_ZQV-ujc1Se-93Csq4dDObGT1TLjU-Hhk1-vV41cfrL-eEBe6-Ss7d_uzFc5vIZrlNWgebYHFOsQinPjZ8WYlUZqNd5O2LkYq1koq1kMq4lCe1XYVUWZwPWYgP2fCDSnwwG-2M7lyMD1krH7IWPhiX8nx0qvARFOcjKMRH0PDDSnwwG-2M7l6Mj6BWPoJa-GBcyvPRrcJHWJyPsBAfYcNvVeKD2WhndO9ifIS18hHWwgfjUp6PXl1fQmfmvGi7TBOrj76Izp_c3Bij45nOjLTpykz1s0mn2zHZz-FWt30Qa-uyt5j9GCTZq82CeTEeizEvlgdiLCfuVBEjVlK3Kql7tFqShge04QEpDunJISmWTNYtUt2mxe0qoNBiBhRazIHCqBlQGDUDSoc0vEsb3q0CSo_uhCZTCieVUqoVaDVXC7Sa7QVGzhUDI2cCx5NiOfRdMr7TzcJkjnS1YMgMPymXUqHTai50Ws2Gzsi50Bk5Fzrdq8gUK550TKnQ6Y5BpmTwpGVKhU6rudBpNRs6I-dCZ-Rc6HTDSqZhJf3Rdhz6ZP3tfwAAAP__SIsndg== query T -SELECT url FROM [EXPLAIN (DISTSQL) SELECT SUM (DISTINCT A), SUM (DISTINCT B) FROM data] +EXPLAIN (DISTSQL) SELECT SUM (DISTINCT A), SUM (DISTINCT B) FROM data ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJyslFFr2zAUhd_3K8R9WkDBkey0qZ9S2gwCadIlGQyKH9To4hkcy5Nk2Aj578P2SOaQyibeo650dM6nK-4BzM8UQtjMFrOnLSl0Sr6sVy_kbfb9dfE4X5LPz_PNdvN1MSB_j5hiX9Xmy6ctEQPaLLwPar0UVkRAIVMSl2KPBsI3YECBAwUfKARAYQwRhVyrHRqjdHnkUAnm8heEIwpJlhe2LEcUdkojhAewiU0RQtiK9xTXKCRqbwQUJFqRpJVN6T3NdbIX-jdQ2OQiMyEZeoyITBJGlP2BGiisChuSKaNTDtGRgirs2c5YESOE7Ei7R3pOjE2ynfXGzTxuC_6hxfnmIlNaokbZuDg6XgnxGMcaY2GV9tjFu2y-vZwbNWWD8m0aJT74MKXfSMm694Z16Y3Hhh7v252WUKfu3N3eHd6dm3fi5kPP78vdEurEfX87t9-d2-_E7Q-9oC93S6gT9-R27qA7d9CJOxh6477cLaFO3A__ZwpdsVijyVVm8GIaXb95VE4plDHWI82oQu_wVatdZVMvV5WuKkg0tt5l9WKe1VtlwH_FzCnmDTG7FHO3c4u171QHbnHQJ_fYKb5zO9_1cb53iidu50kf5wd3r0Yt38T9yS69o-OnPwEAAP__IcvrKg== +distribution: full +vectorized: true +· +• group (scalar) +│ +└── • scan + missing stats + table: data@primary + spans: FULL SCAN +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJyslFGL2kAUhd_7K4b7VGEkziS6bp5cdi0Irm7VQqHkYTZzSQOaSWcm0CL-95IEtBF3Ekwfc5Mz53w5wz2C-bWHEObf35ZPixX5_LLY7rZflwOynS_nzztiikM1W6yed0QMaHPwPiBfNutXIoUVQCFTElfigAbCH8CAAgcKPlAIgMIYIgq5VjEao3T5ybESLORvCEcU0iwvbDmOKMRKI4RHsKndI4SwE-973KCQqL0RUJBoRbqvbErrWa7Tg9B_gMI2F5kJydBjRGSSMKLsT9RAYV3YkMwYnXGIThRUYS92xooEIWQn2j3SS2psmsXWGzfzuC34hxaXk4tMaYkaZePg6HQjxFOSaEyEVdpjV_9l--310tOMDcp_0xjxwYcp_UZK1r0b1qUbjw093redllDndib3t8O7c_NO3Hzo-X25W0KduR_u5_a7c_uduP2hF_Tlbgl15p7ezx105w46cQdDb9yXuyXUmfvx_2yhGxYbNLnKDF5to9snj8othTLBeqUZVegY37SKK5v6cV3pqoFEY-u3rH5YZPWrMuC_YuYU84aYXYu527nF2neqA7c46JN77BRP3M6TPs4PTvHU7Tzt4_zo7mrUck3cl-zaOzp9-hsAAP__lD7lyw== query T -SELECT url FROM [EXPLAIN (DISTSQL) SELECT DISTINCT a, b FROM data WHERE (a + b + c::INT) = 27 ORDER BY a,b] +EXPLAIN (DISTSQL) SELECT DISTINCT a, b FROM data WHERE (a + b + c::INT) = 27 ORDER BY a,b ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJy8ll9r4kwUxu_fT3E4VxZH4kziv8AL2W0tK3S1q8LuUryIZmgDNnEnI2wpfvclZjFV65y4prmcmN_Mk3l-HHzF5NcSXZz07_rXU1irJdyOR1_hof_j_u7TYAi1m8FkOvl2dwV_X0nXg-H1FHwG8-zlwNc-fP_SH_ehVvOhDvMrqMPCdQfDafcK_gfRgdH4pj-Gzz-32AwZRnEgh_6zTNB9QI4MBTK0kaGDDFs4Y7hS8UImSazSV163wCD4jW6TYRit1jp9PGO4iJVE9xV1qJcSXZz686UcSz-Qymoiw0BqP1xuj0mDeisVPvvqBRlOVn6UuNCwOPhRABxi_SQVMhyttQseZ55gno2zDcN4rfMTE-0_SnT5hhVPdRsutVRSWa39SNlzF2o1j0MdPJFenWe_vTs3W-zlOhlKnBPqJkx0GC20xQ8uKjuD4UgFUsng_UPzfeYv8OQnT-_tMdvk2eyT2fKt4uzEw63qzBP1bLPTH9H6h4_I0zkfkm4YN-KVJfbv91SE1l4EXtxzXsRzizcsUYLpRK6d6e0qTSdC5ZLw6k3npZveLtF0UVwzUUgz0bDsEjQjcu0061SpGREqb0hUr5koXbNOiZrZxTWzC2lmNyynBM2IXDvNulVqRoTKG7Kr18wuXbNuiZo5xTVzCmnmNKxWCZoRuXaa9arUjAiVN-RUr5lTuma9D_p7-M6hY5ms4iiRhf71NdPYMniU2acm8Vot5L2KF9tjsuVoy20fBDLR2a88Wwyi7Kc04FuYG2FhhsUhzN_C9h7Mz4O7l8BcXES3L6FF00zbxgt3zLBjbovoumWk22a4bYQ7ZrhziShmmBDFDFOiEDQhipmmROleIkrPPBOaxFAgRgo1U46Gyjl1EzTRN0FThVM40TiBU5Xzo9FyTufcPFq4Q7RmHi68ReBH0-Ws0s00VbqZJksncKp0M06Wbp6sVOlHQ2a_tS7RmnnK8B6BH82Zs0o301TpZposncCp0s04VbowT9jD0meb__4EAAD__-XngIo= +distribution: full +vectorized: true +· +• distinct +│ distinct on: a, b +│ order key: a, b +│ +└── • filter + │ filter: ((a + b) + c::INT8) = 27 + │ + └── • scan + missing stats + table: data@primary + spans: FULL SCAN +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJy8lt9r4koUx9_vX3E4TxZH4kwSfwQu5N7WcoVe7aqwuyw-RDO0AZu4kxG2FP_3JQZM1TonrmkeJ_qZ-Wa-Hw55w_TnCj0cfHt8-Gc4gsbdcDqbfnm4gengYXA7g2w9HN3OIGCwgPvJ-H8IAx3A1_8GkwE0GgE0YXEDTVh63nA0693A3yC6MJ7cDSbw7_cdhgzjJJSj4EWm6P1AjgwFMrSRoYMMXZwzXKtkKdM0Udlf3nbAMPyFXpthFK83Ons8Z7hMlETvDXWkVxI9nAWLlZzIIJTKaiPDUOogWu2OyXL6axW9BOoVGU7XQZx60LI4BHEIHBL9LBUyHG-0Bz5nvmC-jfMtw2SjixNTHTxJ9PiWlU91H620VFJZ7mGk_LkHjYbPoQm-yG7Ot99fnZcvDnKdDSUuCXUXpTqKl9riRxeVn8FwrEKpZPjxocU-i1d4DtLnj_aYb4ts9tlsxVZJfuLxVk3mi2a-2fmXcP_gJYp0zqekGyWtZG2Jw_s9F8E9iMDLe87LeG7xliUqMJ3ItTe9U6fpRKhCEl6_6bxy0zsVmi7KayZKaSZall2BZkSuvWbdOjUjQhUNifo1E5Vr1q1QM7u8ZnYpzeyW5VSgGZFrr1mvTs2IUEVDdv2a2ZVr1qtQM6e8Zk4pzZyW5VagGZFrr1m_Ts2IUEVDTv2aOZVr1v-kz8MPDp3IdJ3EqSz11dfOYsvwSeavmiYbtZSPKlnujsmX4x23exDKVOe_8nwxjPOfsoDvYW6EhRkWxzB_D9sHML8M7l0Dc3EV3bmGFm0zbRsv3DHDjrktomvXSHfMcMcId81w9xpRzDAhihmmRCFoQhQzTYnSu0aUvnkmtImhQIwUaqacDJVL6iZoom-CpgqncKJxAqcq5yej5ZLOuXm0cIdozTxcuEvgJ9PlotLNNFW6mSZLJ3CqdDNOlm6erFTpJ0PmsLUe0Zp5yvA-gZ_MmYtKN9NU6WaaLJ3AqdLNOFW6ME_Y49Ln279-BwAA___CbXsr query T -SELECT url FROM [EXPLAIN (DISTSQL) SELECT DISTINCT a, b FROM data WHERE (a + b + c::INT) = 27 ORDER BY b,a] +EXPLAIN (DISTSQL) SELECT DISTINCT a, b FROM data WHERE (a + b + c::INT) = 27 ORDER BY b,a ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJy8ll9vokAUxd_3U9zcJxvH4AzgH5JN2G1t1qSrXTXZ3TQ-oExaEyvugMk2jd99o6xSqc6FQnhEOXMPh9894RXDP0t0cNy7611PYKOWcDsafoeH3q_7uy_9AdRu-uPJ-MfdFfy_ZXfdH1xPwGMwi2_2vciDn996ox7Uah7UYXYFdZg7Tn8w6VzBZxBtGI5ueiP4-htmDLwpMlwFvhx4zzJE5wE5MhTI0ESGFjK0ccpwrYK5DMNA7W553Qv6_l90mgwXq_Um2v08ZTgPlETnFaNFtJTo4MSbLeVIer5URhMZ-jLyFsv9mJ1Rd60Wz556QYbjtbcKHWgYHLyVDxyC6EkqZDjcRA64nLmCuSZOtwyDTZRMDCPvUaLDtyy7q9vFMpJKKsM-tRT_7kCt5nKogyt20bnm2-yc-OLE10VTIo-pm0UYLVbzyOCpoOIZDIfKl0r654cm58xe4MkLn86dMd0m3syL3pKjgnhi-qg6c0U9PuzyQ9gfeIjEnZUnuXGgIqkMkc5N1JnL6xdn2B9O4HjwGTODoBGsDXH6-JcstE4s8Oy7xLPsksEbhihhmwhfx21qVblNhKkERF79NvHSt6lV4jYRyR22KZ1brm0S2VEWmVAWDcMsAWXC1xHldpUoE6YSCkT1KIvSUW6XiDKR3AHldG65UDazo2xmQtlsGFYJKBO-jih3qkSZMJVQYFaPslk6yp0SUSaSO6Cczi0XylZ2lK1MKFsNwy4BZcLXEeVulSgTphIKrOpRtkpHuVsiykRyB5TTuX34c_3MjJEM18EqlJm-wpu7aKT_KOM4w2Cj5vJeBfP9mPhyuNftf_BlGMX_8viiv4r_2hl8K-ZasdCLRVrM34rNEzHPJ-4WEXOrkLrQbEHMNrWBW_rALa3Y1k-29a-6pR_d0qrbenFbK-7oxZ0ilOnFxJvWiynKCHWh2RRlXX0nNIlS0FcKwRnXdwonSoW_269TuUnI3y1YHlwINfHOCDUFDCUvNp1ChuvLhdtE7vp6oZjR1wsn-oXrC4YTDcMLVQyhpt5asZKh5MWmk8zoe0YQPSMK9Ywgvl2ojxd9zwiiZ0ShniHU1BdIsZ6h5MWmU8wIfc8IomdEvp6Zbj_9CwAA___d-4ag +distribution: full +vectorized: true +· +• sort +│ order: +b,+a +│ +└── • distinct + │ distinct on: a, b + │ order key: a, b + │ + └── • filter + │ filter: ((a + b) + c::INT8) = 27 + │ + └── • scan + missing stats + table: data@primary + spans: FULL SCAN +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJy8ll9voloUxd_vp9jZTzYeg-cA_iG5Cfe2NmPS0Y6azEwmPqCctCZWnAMm0zR-9wkSpVI9GwrhEXSdvVj89gpvGP5eo4ODH48P_w1H0LgbTmfTbw83MB08DG5nEF8PR7cz8Bgs4H4y_gq-F3nw_ctgMoBGw4MmLG6gCUvHGY5mvRv4F0QXxpO7wQT-_wkLBh4y3AS-HHkvMkTnF3JkKJChiQwtZGjjnOFWBUsZhoGK__J2EAz9P-i0Ga42210U354zXAZKovOG0SpaS3Rw5i3WciI9XyqjjQx9GXmr9WFM7NPdqtWLp16R4XTrbUIHWgYHb-MDhyB6lgoZjneRAy5nrmCuifM9w2AXpRPDyHuS6PA9y-_qfrWOpJLKsM8tJfcdaDRcDk1wRZyca76PzkkuznxdNSWKmLpbhdFqs4wMngkqmcFwrHyppH95aHrO4hWevfD50hnzferNvOotPSpIJmaPajJXNJPDrj-E_YmHSN1ZRZKbBiqSyhDZ3ESTubx5dYb96QROB18wMwpawdYQ549_zULnzALPv0s8zy4ZvGWICraJ8HXapk6d20SYSkHk9W8Tr3ybOhVuE5HccZuyuRXaJpEfZZELZdEyzApQJnydUO7WiTJhKqVA1I-yqBzlboUoE8kdUc7mVghlMz_KZi6UzZZhVYAy4euEcq9OlAlTKQVm_SiblaPcqxBlIrkjytncCqFs5UfZyoWy1TLsClAmfJ1Q7teJMmEqpcCqH2WrcpT7FaJMJHdEOZvbpz_XL8yYyHAbbEKZ6yu8HUcj_SeZxBkGO7WUjypYHsYkl-OD7nDDl2GU_MqTi-Em-Sk2-F7MtWKhF4usmL8Xm2diXkzcLyPmVil1qdmCmG1qA7f0gVtasa2fbOtfdUc_uqNVd_Xirlbc04t7ZSjTi4k3rRdTlBHqUrMpyvr6TmgTpaCvFIIzru8UTpQK_7Bf53KTkH9YsCK4EGrinRFqChhKXm46hQzXlwu3idz19UIxo68XTvQL1xcMJxqGl6oYQk29tXIlQ8nLTSeZ0feMIHpGlOoZQXy7UB8v-p4RRM-IUj1DqKkvkHI9Q8nLTaeYEfqeEUTPiGI9M9__8zcAAP__pXCBQQ== query T -SELECT url FROM [EXPLAIN (DISTSQL) SELECT c, d, sum(a+c::INT) + avg(b+d) FROM data GROUP BY c, d] +EXPLAIN (DISTSQL) SELECT c, d, sum(a+c::INT) + avg(b+d) FROM data GROUP BY c, d ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJzUll1vukgUxu_3U0zOlcYxODPgC1d0u92NicWuL8k2jWmoTKyJBXfAzTaN3_0fwNYX2jkYMdE7RH6cM-d5zhM-IPp3ATYM73p3tyOyUgvy56B_T57u_nno3XRdUvmjOxwN_-5VyeaRKSU-JdHqreKRGpnadtcdtaukRrz_ZpUXUiN-NXuF78Ue-WvQHz-Q3x9TbAIUgtCXrvcmI7CfgAEFDhQEUDCBggUTCksVTmUUhSp55CMFuv7_YDcozIPlKk5uTyhMQyXB_oB4Hi8k2DDyXhZyID1fKqMBFHwZe_NFWibpxFmq-Zun3oHCcOkFkU3qBiNe4BNGwvhVKqAwkIEvlU0cVnNEdjBKHF5zTEocQYljwmRNIVzF2zai2JtJsNmaFm_1ZjZTcubFoTKs_U4dQZ1kEDfu47PbHz27416v4ohq7paZ3BqO7ysO-7riydVtf-yO0uv9VrfVX97Jqxe9HhRm1OEwWW9PxH880fZVqyBUvlTS33tZ-hbNmVnju9qHJ2T5Q_Ovo4qvq89BPHeTY1vVPRkT9T6lMxzrR_XEMeq5YT1cGuxAuXzRmsYuZrnDzVrijYMnv69t7dVmxbeKFdkqg9UNfq69Qprd8VjzSvaKlblX7LL3ClFvs1fN8vaKF_c2L-RtXjfEubyNNLujc-tKvM3L9Da_bG8j6m283SrP26K4t0Uhb4u6YZ7L20izOzq3r8Tbokxvi8v2NqLextvt8rxtFve2WcjbZt2wzuVtpNkdnTtX4m2zTG-bl-1tRL2Ntzvn-db_puBARsswiGShL_lGMnzpz2SmVBSu1FQ-qHCalsl-9lMuveHLKM7-ZdmPbpD9lTS4C7NDmO3CfA9mx8GtU2DGTqKtk-iOnubagQv9wIUWNvWVTS3MEa0tLd3Uw81TjKKHEaPoYcwoCI0YBaERo7S0A2_rB94-xSgdfSY0kFDIRcpRqaCnsVjQ02guIDgWDAiOCM5ywbI_d47MXZ8siOZMHy3MRIrnwuUo0fU0JrqeRkVHcEx0BMdE1-cqQ4KV5TLmKNH1GcOQkGG5lDlKdD2Nia6nUdERHBMdwTHR9QnLkYTl-o-2Q9En699-BQAA__-fNQ5q +distribution: full +vectorized: true +· +• render +│ +└── • group + │ group by: c, d + │ + └── • render + │ + └── • scan + missing stats + table: data@primary + spans: FULL SCAN +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJzUlltv2kAQhd_7K1bzBGKR2V2bi5-cpmmFREzKRWpUocjBK4JEbLo2VaOI_17ZkHBxsmOEkeDNGH-e2TlnjvwK0Z8Z2HDz665z1XZJ6Vu7P-j_7JRJ_6Zzcz0gY0p8SqLFc8kjFTK27bY7aJZJhXh_J6VHUiF-mXzvdW-J78Ue-dHrDu_I1_sUAwpB6EvXe5YR2L-BAQUOFARQMIGCBSMKcxWOZRSFKnnkNQXa_j-waxSmwXwRJ7dHFMahkmC_QjyNZxJsGHiPM9mTni-VUQMKvoy96SwtkzTizNX02VMvQKE_94LIJlWDES_wCSNh_CQVUOjJwJfKJg6rOGJ1LkocXnFMShxBiWPCaEkhXMSbNqLYm0iw2ZLmb_VqMlFy4sWhMqzdTh1BnWQQV-79g9sdPLjDTqfkiHLmlpnc6g9vSw57v-LJ1XV36A7S691WN9UfX8iTFz3tFWbU4TBabk7EPz3R5lWLIFS-VNLfeVn6Fs2ZWe2j2vsnZNlD8_ejivert0E8tJNjW-UdGRP13qQzHOtT9cQh6rlhNZwbbE-5bNGKxi5mscNdtcRre09-XNvaqc3ybxXLs1UGqxr8VHuFNLvlsfqF7BUrcq_Yee8Vot56r-rF7RXP722ey9u8aohTeRtpdkvnxoV4mxfpbX7e3kbUW3u7UZy3RX5vi1zeFlXDPJW3kWa3dG5eiLdFkd4W5-1tRL21t5vFedvM720zl7fNqmGdyttIs1s6ty7E22aR3jbP29uIemtvt07zrf9BwZ6M5mEQyVxf8rVk-NKfyJVSUbhQY3mnwnFaZvWzm3LpDV9G8epftvrRDlZ_JQ1uw2wfZtsw34HZYXDjGJixo2jrKLqlp7l24EI_cKGFTX1lUwtzRGtLS9f1cP0Yo-hhxCh6GDMKQiNGQWjEKA3twJv6gTePMUpLnwk1JBQykXJQKuhpLBb0NJoLCI4FA4IjgrNMsOzOnSNz1ycLojnTRwszkeKZcDlIdD2Nia6nUdERHBMdwTHR9bnKkGBlmYw5SHR9xjAkZFgmZQ4SXU9joutpVHQEx0RHcEx0fcJyJGG5_qNtX_TR8sv_AAAA__-I9wkL query T -SELECT url FROM [EXPLAIN (DISTSQL) SELECT c, d, sum(a+c::INT) + avg(b+d) FROM data GROUP BY c, d ORDER BY c, d] +EXPLAIN (DISTSQL) SELECT c, d, sum(a+c::INT) + avg(b+d) FROM data GROUP BY c, d ORDER BY c, d ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJzUl1tv4kgQhd_3V7TqCeRGpi_OxU_OzmRXSIzJApF2NEKRg1skEsFs26x2FOW_r3xJgs2ky6hjKXkzDcenXFXfkXmE9J81-DC7HF9-mZOdXpM_ppNv5Mfl31fji1FIel9Hs_nsr3GfVD9ZUhJTku4eehFxyNL3R-H8rE8cEv276t0Sh8T98hZxlEXkz-nk-or8_r2Qkcn06-X0-dMCKGySWIXRg0rB_wEMKHCgIICCBAoeLChsdbJUaZro_CePhWAU_wf-kML9ZrvL8uMFhWWiFfiPkN1nawU-zKPbtZqqKFbaHQKFWGXR_bqwyesKtvr-IdI_gcJsG21SnwxcRqJNTBhJsjulgcJUbWKlfRIwJxDlY1IScCeQlASCkkDC4olCsstey0izaKXAZ0-0famzRGdKu169ykA4NJDOmxb8GIuL1UqrVZQl2mXDpg8N8mZPdKy0in3yfHARfr8JJ_Ob8Ho87gWif3Ak86PZ9bdewF6ueH71ZXIdzovrevGv9dz-JHdReteohNGAw-Lp9RnFm8_4equkrLt5K4cG3ClvZmpGs-lFCfvNqA7qT84Om8FfWiBerp4bdDPK2-H1azuVr9LzHrmB9-ac5TFzDpNBsnV5Y8SHpo5hd71Oml5VVu_3WyWc1Epg7UlnbUh32cDlXbGOFFuxfmLDOmKxv97ss7LOOmC92fSPzjoy54oo9n6s8_ag8Vag8YErugINKbYC7dQGNMRif7f4ZwWNdwBas-kfHTRkzhVo_P1AE-1BE61AEwNXdgUaUmwF2pkNaIjF_m6Jzwqa6AC0ZtM_OmjInCvQxPuBJtuDJluBJgeu1xVoSLEVaOc2oCEW-7slPytosgPQmk3_6KAhc65Ak938TfyF4VSl22STqlb__ob5NFS8UuUE02Snl-pKJ8vCpvw4KXTFQazSrPyWlR9Gm_KrvMB9MTOKuVnMm2K2LxY1MTtOfG4jZtJKbeXNEW9hbLg0N1waxZ7Z2TOP-sRsfWJUn5rFp0bxmVl8ZrNlZjEyabMY2zJEbeWNbdm5OROGSCiYIwXZM2bOFIaECjvgqy4XiPwAsGPWBVEjM0PU2MJgcjt3bGWYOVyYh_TdHC_YzpjjhSH5wswBw5CEYVYRg6ixqdmFDCa3c0d3xpwzHMkZbpUzHHl3wV5ezDnDkZzhVjmDqLE3ELucweR27tjOcHPOcCRn-HE5s3j67f8AAAD__7vNSwY= +distribution: full +vectorized: true +· +• render +│ +└── • group + │ group by: c, d + │ ordered: +c,+d + │ + └── • sort + │ order: +c,+d + │ + └── • render + │ + └── • scan + missing stats + table: data@primary + spans: FULL SCAN +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJzUl9tr60YQxt_7VyzzZKM18l6Ui56UnpMWg4-c2g70UExQrMUJJJa7UkpDyP9edEliyc2OzEZgv0mbfPpGM_P7kF8g_fsBfLj882p8MQpJ7_toNp_9Me6T2eX48tucLCmJKUmfHnsRccjS90fh_KxPHBL9s-rdEofEffLbdPKDxFEWkd-nk-sr8uvPQkYm0--X07c7oLBOYhVGjyoF_y9gQIEDBQEUJFDwYEFho5OlStNE5__yUghG8b_gDyncrzdPWX68oLBMtAL_BbL77EGBD_Po9kFNVRQr7Q6BQqyy6P6hsMnLCjb6_jHSz0BhtonWqU8GLiPROiaMJNmd0kBhqtax0j4JmBOI8i0pCbgTSEoCQUkgYfFKIXnKPspIs2ilwGevtH2ps0RnSrtevcpAODSQzqcWfB-Li9VKq1WUJdplw6YPDfJmT3SstIp98nZwEf68CSfzm_B6PO4For9zJPOj2fWPXsDer3h-9W1yHc6L63rxH_XcPpO7KL1rVMJowGHx-vGO4tN3_HhUUtbdfJRDA-6UDzM1o9n0ooTtZlQH9Tdnu83g7y0Q71dvDboZ5e3w-rWdylfpbY_cwPt0znKfOYfJINm4vDHiXVPHsLteJ02vKqv3-7MSTmolsPakszaku2zg8q5YR4qtWD-xYR2x2F5vdqyssw5Ybzb90FlH5lwRxb6Odd4eNN4KND5wRVegIcVWoJ3agIZYbO8WP1bQeAegNZt-6KAhc65A418HmmgPmmgFmhi4sivQkGIr0M5sQEMstndLHCtoogPQmk0_dNCQOVegia8DTbYHTbYCTQ5cryvQkGIr0M5tQEMstndLHitosgPQmk0_dNCQOVegyW5-Jv6P4VSlm2Sdqla__ob5NFS8UuUE0-RJL9WVTpaFTXk7KXTFQazSrPwrK29G6_JPeYHbYmYUc7OYN8VsWyxqYraf-NxGzKSV2sqbI97C2HBpbrg0ij2zs2ce9YnZ-sSoPjWLT43iM7P4zGbLzGJk0mYxtmWI2sob27JzcyYMkVAwRwqyZ8ycKQwJFbbDV10uEPkOYPusC6JGZoaosYXB5Hbu2Mowc7gwD-m7OV6wnTHHC0PyhZkDhiEJw6wiBlFjU7MLGUxu547ujDlnOJIz3CpnOPLtgn28mHOGIznDrXIGUWNfIHY5g8nt3LGd4eac4UjO8P1yZvH6y38BAAD__9PhRac= # There should be no "by hash" routers if there is a single stream. query T -SELECT url FROM [EXPLAIN (DISTSQL) SELECT c, d, sum(a+c::INT) + avg(b+d) FROM data WHERE a > 9 GROUP BY c, d] +EXPLAIN (DISTSQL) SELECT c, d, sum(a+c::INT) + avg(b+d) FROM data WHERE a > 9 GROUP BY c, d ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJyUkm-Pk0AQxt_7KSbzioa9lD810X21VetJwtEKVL2c5LLHTkgTyuIuGE3T724AE68a0Xs5z8zz8BtmT2i_1Mgx28Sb1zn0poa36fYG7jafdvE6SsB5E2V59j5ewM-RkoFiYPujI8GFkvMoyV8swAX5tXIewAW1mCKU7CR8fLdJNyDhc-95IcFLuE63-x28uh1zCmTYaEWJPJJFfoc-MnyOBcPW6JKs1WaQT-NQpL4h9xgemrbvBrlgWGpDyE_YHbqakGOir3S7DJChok4e6nHszFD33S-T7WRFyMMzexTszwfn8qGmlKQis_Qu4nHYU7TmcJTmOzLMWtlYDkvfu0KGKTWKDAfhuyKc_hUDEbhixUCEDMQK_8bnP4VvXVWGKtlps_Qv8UTIxAoZrpPb-2Sb3yf7OHZEuPhDWg1Str9xhD82P1w7Ilhc7DCgD9zuDHZwgf2Pe6VkW91Y-q-DeeeCIamKpjdhdW9K2hldjp-Zyu3oGwVFtpu64VREzdQaAB-b_VlzMG8OZs3eb-bi_OxHAAAA___dMg9r +distribution: full +vectorized: true +· +• render +│ +└── • group + │ group by: c, d + │ + └── • render + │ + └── • scan + missing stats + table: data@primary + spans: [/10 - ] +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJyUkl-vk0AQxd_9FJN5grA35U9NdJ-2Kl5JuLQCVW-0udnLTkiTlsVdMJqm390AD7Ya0fs4Z-YcfsPsCe3XA3KMP23SVZKB8yYpyuJ96kIRp_HrEioGioHtj44EDyrOk6x84YIH8lvtPIIHyoW3-foOlOwkfHwX5zFI-NL7fkTwEm7z9XYDr-7HHGTYaEWZPJJF_hkDZPgcdwxboyuyVptBPo1DifqO3Ge4b9q-G-Qdw0obQn7Cbt8dCDlm-ka3ixAZKurk_jCOnRnqvvtlsp2sCXl0ZhfBwXxwKR8PlJNUZBb-VTwOa4rW7I_S_ECGRSsby2ER-DfIMKdGkeEgAk9E069iIEJPLBmIiIFY4t_4gqfwreraUC07bRbBNZ6ImFgiw1V2_5Cty4dsm6aOiNw_pOUgFds7RwRj88OtI0L3aocBfeD2ZrDDK-x_3Csn2-rG0n8dzD_vGJKqaXoTVvemoo3R1fiZqVyPvlFQZLupG01F0kytAfDSHMyaw3lzOGv2fzPvzs9-BgAA__-R_woM query T -SELECT url FROM [EXPLAIN (DISTSQL) SELECT sum(a), sum(b), sum(c) FROM data GROUP BY d HAVING sum(a+b) > 10] +EXPLAIN (DISTSQL) SELECT sum(a), sum(b), sum(c) FROM data GROUP BY d HAVING sum(a+b) > 10 ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJzMll9vskgUxu_3U0zOleYdAzOAf7jCfWu7Jla7ajfbdE2DMrEmFtwBkm0av_sGaIpi3zkYlXjF34dz5jy_ecIHhP-uwYZJb9D7OSWxXJPb8eiePPf-fhh0-0NSu-lPppM_B3Xy-UoYv9XcOk2P88_jop6pPDdyyd149PhAfn8iHvmj-1d_eJdJyA8yr5N_Yl03BGH6DCj4gSeG7psIwX4GBhQ4UDCAggkULJhR2MhgIcIwkMkrH6mg7_0Htk5h5W_iKLk9o7AIpAD7A6JVtBZgw9Sdr8VYuJ6Qmg4UPBG5q3VaJmnR2cjVmyvfgcJk4_qhTRoaI67vEUaC6FVIoDAWviekTRz2w-GUOIyS9GhQ4pgw21II4ijvIIzcpQCbbWn5LrvLpRRLNwqkZu036STX3eHTy3A0fRk-DgY1x6on3T7e1xz-dWZ8nZlfZ6xeaC6vN38nr274WijFYLbNF8B_uYD8O7EfSE9I4e19Kf2KYolMPyhcXCMruUaruMa8f-MYA25X60hIITVWmH_2wCaOlQNr2_ZN72f_vjsACqM4shMeHIMqaDDPO8xh0Ag2GtcLb35f29qrzcrvF1Zmv2isofEL7Bikzx2cmte5Y9g5dwyrfscgBuQ7plnBjuHlqeWlqOUNzbgAtUifO5a2rpNafk5qefXUIgbk1LYqoNYoT61RilqjoZkXoBbpc8fS9nVSa5yTWqN6ahEDcmrbFVBrlqfWLEWt2dCsC1CL9Lljaec6qTXPSa1ZPbWIATm1nYr_qb9pZizCTeCHotQfs54MW3hLkTkTBrFciAcZLNIy2eUo1aU3PBFG2VOWXfT97FHS4K6YFcVsV8z3xOw4cesUMWMnqa2T1B21misHbqgHbijFprqyqRRzxGtLqW6qxc1TQFGLEVDUYgwURI2AgqgRUFrKgbfVA2-fAkpHnQk6EgoHkXJUKqjVWCyo1WguIHIsGBA5Yjg7CJb9uXNk7upkQTxn6mhhJlL8IFyOMl2txkxXq1HTETlmOiLHTFfnKkOClR1kzFGmqzOGISHDDlLmKNPVasx0tRo1HZFjpiNyzHR1wnIkYbn6p61o-mz72_8BAAD__xhK5DQ= +distribution: full +vectorized: true +· +• filter +│ filter: sum > 10 +│ +└── • group + │ group by: d + │ + └── • render + │ + └── • scan + missing stats + table: data@primary + spans: FULL SCAN +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJzMll1vok4Uxu__n2JyrjQdAzOAL1zhv7VdE6tdtZttdk2DMrEmFtwBk20av_sG2BTF7hyMSrzi9eGcOc9vnvAO4a8l2ND5_tBrd_ukctMdjUdfe1Uy6vQ612MSrl8rbpUmx-nf46xKboeDe-K5kUvuhoPHB_L_E_HIl_a3bv8ulZArMq2Sn2tdNwRhOlDwA0_03VcRgv0DGFDgQMEACiZQsGBCYSWDmQjDQMavvCeCrvcbbJ3Cwl-to_j2hMIskALsd4gW0VKADWN3uhRD4XpCanEhT0TuYpmUiTt0VnLx6so3oDBauX5ok5rGiOt7hJEgehESKAyF7wlpE4ddOZwSh1GSHA1KHBMmGwrBOso6CCN3LsBmG1q8y_Z8LsXcjQKpWbtNOvF1u__03B-Mn_uPvV7Fsapxt4_3FYd_nBkfZ-bHGavmmsvqTd_Iixu-5EoxmGyyBfB_LiD7ztoPpCek8Ha-lHxFsUSm7xXOr5EVXKOVX2PWv3GIAbeLZSSkkBrLzT99YBPHyni1bfumc929b_eAwmAd2TEPjkEVNJinHWY_qAUrjeu5Nz-vbe3UZsX3CyuyXzRW0_gZdgzS5xZO9cvcMeyUO4aVv2MQA7IdUy9hx_Di1PJC1PKaZpyBWqTPLUsbl0ktPyW1vHxqEQMyahslUGsUp9YoRK1R08wzUIv0uWVp8zKpNU5JrVE-tYgBGbXNEqg1i1NrFqLWrGnWGahF-tyytHWZ1JqnpNYsn1rEgIzaVsn_1J80MxThKvBDUeiPWY-HLby5SJ0Jg7WciQcZzJIy6eUg0SU3PBFG6VOWXnT99FHc4LaY5cVsW8x3xOwwceMYMWNHqa2j1C21misHbqgHbijFprqyqRRzxGtLqa6rxfVjQFGLEVDUYgwURI2AgqgRUBrKgTfVA28eA0pLnQk6Egp7kXJQKqjVWCyo1WguIHIsGBA5YjjbC5bduXNk7upkQTxn6mhhJlJ8L1wOMl2txkxXq1HTETlmOiLHTFfnKkOCle1lzEGmqzOGISHD9lLmINPVasx0tRo1HZFjpiNyzHR1wnIkYbn6py1v-mTz358AAAD__75d3tU= query T -SELECT url FROM [EXPLAIN (DISTSQL) SELECT avg(a+b), c FROM data GROUP BY c, d HAVING c = d] +EXPLAIN (DISTSQL) SELECT avg(a+b), c FROM data GROUP BY c, d HAVING c = d ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJzMl9tr2zAUxt_3V4jzlFAFR5JzMxScdW0XSJ0ul7FSQlFjkQZSO5OdsVLyvw8nJddVx7mB3xxZP-s7-r5zaN8h-j0GBzrXzeurLpnqMblpt-7I4_Wv-2a94ZHct0an2_nRzJOPLfLPMCfJBXnOUzJYbPZlLMltu9W7J18fyIASn3yv_2x4t2RALonfBwpB6CtPvqoInEdgQIEDBQEUbKBQgj6FiQ4HKopCnWx5nwMN_y84RQqjYDKNk-U-hUGoFTjvEI_isQIHuvJ5rNpK-kpbRaDgq1iOxvNjElnuRI9epX4DCp2JDCKHFCxGZOATRsL4RWnozyiE03h1QhTLoQKHzWh6FTejcay00lZpU8Ji3SGuIJfETWptq8Cfr7ALl1PiCpqsfyaC7yOiPhxqNZRxqC22dRVuctV17-HJa3WfvF6zmXNFPrmT3l3OZcnTVavndT-eNzfy_Ja81YnPb-RFRi9bZzHoz1YliE9LWH1nGoTaV1r5G1-af8VUZGnn4G3tbFkk_3h6aiRlit0y7fy6O9xCnLFPW5YXFsKJxYtbO_9_dmnjbJa-QViaBrFYweIHtAiiY9ki5XO2CCJiPT0soy3CTtki5cy0CE8fU54qprxgiQNiiuhYxrRyzpgiItYd5BmNKT9lTCuZialIH1ORKqaiYNkHxBTRsYxp9ZwxRUSsOygyGlNxyphWMxNTO31M7VQxtQtW6YCYIjqWMa2dM6aIiHUH7YzG1D5lTGuZiSnyH0tbRZMwiFSqv3qLSdnKH6rFHUXhVA_UvQ4H82MWP1tzbr7gqyhevGWLH41g8SoRuA4zI8zNMN-G2TosNmC2H1w9Bmb8KLp8DM2LZloYL9w2w7bZLcTrkpEum-GyEa6Y4coxQTHDSFDMMBYUhEaCYqaxoFSPCUrNPBOKyFBARgo2U3aGyj52IzTiN0JjhmM44jiCY5azndGyj-fMPFqYjbhmHi6shOA702Uv0800ZrqZRk1HcMx0M46abp6smOk7Q2bTtSrimnnKsBqC78yZvUw305jpZho1HcEx0804Zjo3T9ht0_uzL_8CAAD__4qO2HI= +distribution: full +vectorized: true +· +• group +│ group by: d +│ +└── • render + │ + └── • filter + │ filter: c = d + │ + └── • scan + missing stats + table: data@primary + spans: FULL SCAN +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJzMl9tr4zgUxt_3rxDnKaEKjiTnZig42227gdTp5rJMGUJRY5EGUjsjO8OUkv99cFJy81THuYHfbNk_6zv6vnNIPiD6MQUHbr89tpstjxT-afX6vf_aRdK7bd_e9In8OS5IckVeipSMyF2380B8GUty3-0MHsnfT2REiU_-bf7f8u7JiFwTHygEoa88-aYicL4DAwocKAigYAOFCgwpzHQ4UlEU6uSVjyXQ8n-BU6YwCWbzOFkeUhiFWoHzAfEknipwoC9fpqqrpK-0VQYKvorlZLrcJlHlzvTkTep3oNCbySBySMliRAY-YSSMX5WG4YJCOI83O0SxHCtw2IJmV3E3mcZKK21VdiWs1h3iCnJN3KTWrgr85Qq7cjklrqDJ-lci-CEimuOxVmMZh9pie0fhJkfd9J6evU7_2Ru02wVXFJMzGTwUXJZc3XQGXv_zevdFXtyTt9nx5Z28yuh1by8Gw8WmBPFlCZvvzINQ-0orf-dLy6-YiqykNt7XztZF8s-r51ZSpkiXaRe33eEW4ox93rK8sBTOLF7ee_PPe1d29mbZG4RlaRCLlSx-RIsgOtYtUr1kiyAittPDctoi7JwtUs1Ni_DsMeWZYspLljgipoiOdUxrl4wpImLbQZ7TmPJzxrSWm5iK7DEVmWIqSpZ9REwRHeuY1i8ZU0TEtoMipzEV54xpPTcxtbPH1M4UU7tkVY6IKaJjHdPGJWOKiNh20M5pTO1zxrSRm5gi_1i6KpqFQaQy_eotJ2Urf6xWZxSFcz1SjzocLbdZ3XaW3HLBV1G8espWN61g9SgRuA0zI8zNMN-H2TYsdmB2GFw_BWb8JLp6Cs3LZloYD9w2w7bZLcTripGumuGqEa6Z4dopQTHDSFDMMBYUhEaCYqaxoNRPCUrDPBPKyFBARgo2U1JD5RC7ERrxG6ExwzEccRzBMctZarQc4jkzjxZmI66ZhwurIHhquhxkupnGTDfTqOkIjpluxlHTzZMVMz01ZHZdqyOumacMayB4as4cZLqZxkw306jpCI6ZbsYx07l5wu6bPlz89TsAAP__M1zTEw== query T -SELECT url FROM [EXPLAIN (DISTSQL) SELECT sum(a+b), sum(a+b) FILTER (WHERE a < d), sum(a+b) FILTER (WHERE a = c) FROM data GROUP BY d] +EXPLAIN (DISTSQL) SELECT sum(a+b), sum(a+b) FILTER (WHERE a < d), sum(a+b) FILTER (WHERE a = c) FROM data GROUP BY d ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJzMltFv2joUxt_vX2GdJ1CNgu2EtpEqpfdeuiFR6ALVVnWocolFkWjMnERaVfG_T0m2EmhnpzKovJngX853zvfpKM-Q_FiAD6Nuv_vfGGVqgS7C4SW67X676p_3Bqjxf280Hn3pN9HvK0n22ODoCN03ceWMLnr9cTdEja-fu2EXcfQ9a7fZFEX6W2do2iwLRjzl6FM4vL5C_96gaAIYYhmJAX8UCfi3QAADBQwMMLiAwYMJhqWSU5EkUuVXngugF_0Ev41hHi-zNH88wTCVSoD_DOk8XQjwYczvFyIUPBLKaQOGSKR8vijK5DKCpZo_cvUEGEZLHic-ajkE8ThCBMn0QSjAEIo4EspHATkKKEYBKfsN3Px8FjCMAhcmKwwyS9dCkpTPBPhkheuLPZ_NlJjxVCrH29Qa5HM4H9zcDYbju8F1v98I3GYu-vqyEZDK6c_YA_rGM7Ylc135_gk98ORhqyiByWrdCv1rK-v3ZLFUkVAi2nhT8RZNs6T9qvB2t-se6cuJvZyKWQyz1EcBxQHDGkPYbrsYyJZcOsTbuvl2bXejNqmfXFInuQ5pOXR_2TXIrdjZOfTskl1ml3xUdmn9_NBa-aEth-0vPwa5lZEeH3p-6C7zQz8qP6x-flit_LCW4-4vPwa5lZGeHHp-2C7zwz4qP279_Li18uO2HG9_-THIrYz09NDz4-4yP-4hfHu9oTEUyVLGiaj1ZdXOuxTRTJQjSWSmpuJKyWlRpvw5LLjiQSSStPyXlD96cflXLrAKk22YVGG6AZP3wR0b-NQGJla6iaenqXbeTA8zvVkdvVuulvb0sGdjtR42WK2HDVbrYZPVBtpgdcfG6mMtfKI368TGLD1sMEsPG8zSwyazDLTBrFMbs4hhi5rWqN0etVukdpvUcpXa7VJitUyJYZu6BtNerdN3maanTabpaZNpetpomgE3mfZqqWpNm6z--RUAAP__UpvLjA== +distribution: full +vectorized: true +· +• group +│ group by: d +│ +└── • render + │ + └── • scan + missing stats + table: data@primary + spans: FULL SCAN +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJzMll9v2jAUxd_3Kaz7BKpRsB1oG6lSuo1uSBS6QLVVG6pcbFEkGjMnkVZVfPcpQSuBdnYqg8qb8-eXe-49R1d5guT3HALo_LjqnXf7qPa5OxwNv_XqaNjpdT6NUJI91Dg6Qnd1XDqji25v1IlQ7fvXTtRBHP3Kmk02QcL81hma1NFFNLhEgqccfYkG11fo4w0SgCFWQvb5g0wg-AkEMFDAwACDDxhaMMaw0Goik0Tp_JWnAuiKPxA0McziRZbmt8cYJkpLCJ4gnaVzCQGM-N1cRpILqb0mYBAy5bN5USZXES707IHrR8AwXPA4CVDDI4jHAhGk0nupAUMkYyF1gEJyFFKMQrJqN_Tz81nIMAp9GC8xqCxdC0lSPpUQkCWuLvZ8OtVyylOlvdam1jCfw3n_5rY_GN32r3u9WujXc9HXl7WQlE7_ph7SV-6xLZnryneP6J4n91tFCYyX61bof1tZfyeLlRZSS7HxpeIrhmZJ80Xh7W7XPdLnE3s-FbMYZGmAQopDhg2GsN120VcNtfBIa-vN12v7G7VJ9eSSKsn1SMOj-8uuRW7JzvahZ5fsMrvkvbJLq-eHVsoPbXhsf_mxyC2N9PjQ80N3mR_6Xvlh1fPDKuWHNTx_f_mxyC2N9OTQ88N2mR_2Xvnxq-fHr5Qfv-G19pcfi9zSSE8PPT_-LvPjH8K_1ysaI5ksVJzISn9WzbxLKaZyNZJEZXoir7SaFGVWl4OCK24ImaSrp2R10Y1Xj3KBZZhsw6QM0w2YvA1uu8CnLjBx0k1aZpoa583MMDOb1Ta75RvplhluuVhthi1Wm2GL1WbYZrWFtljddrH62AifmM06cTHLDFvMMsMWs8ywzSwLbTHr1MUsYtmitjXqtkfdFqnbJnVcpW67lDgtU2LZpr7FtBfr9E2mmWmbaWbaZpqZtppmwW2mvViqRtPGyw9_AwAA__9_QsYt # Same query but restricted to a single range; no local aggregation stage. query T -SELECT url FROM [EXPLAIN (DISTSQL) SELECT sum(a+b), sum(a+b) FILTER (WHERE a < d), sum(a+b) FILTER (WHERE a = c) FROM data WHERE a = 1 GROUP BY d] +EXPLAIN (DISTSQL) SELECT sum(a+b), sum(a+b) FILTER (WHERE a < d), sum(a+b) FILTER (WHERE a = c) FROM data WHERE a = 1 GROUP BY d ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJyUktGLm0AQxt_7VwzzlHB7xNU8CQd7bb1W8DQ1hva4yrHnDhIwrt1doSXkfy9qyyWlte3b7LffN_PT2SPaLw2GuI2S6E0BvWngLs_u4TH6tElu4xQWb-Ntsf2QLOGHxfaHhYQreF6ysxru4qSIclh8fB_lEUj43HteUIGad91AtZwGKukkvMgc3uXZbgOvH0CVyLDVilJ5IIvhI3Jk6GPJsDO6Imu1GeTjaIrVVww9hvu2690glwwrbQjDI7q9awhDTPW17lY-MlTk5L4ZbSeGuncvIetkTRgGJ3bWmM83LuRzQzlJRWblXbTH4ftEZ_YHab4hw20nWxvCil-PHDm1ikwIgl8Jn4Hg0-8T66G-EQEDscY_IfL_Qbyta0O1dNqs-CWhWCPD2_ThKc2Kp3SXJAuxXg6ou_uF4GfVzy0K_zdagAyz3oUgfCYCNoPtX2D_ZWU52U63lv5pZ96pZEiqpulZWN2bijZGV-OY6ZiNuVFQZN10G0yHuJ2uBsDzMJ8N-_Nhfzbs_RIuT6--BwAA__8QIBmb +distribution: full +vectorized: true +· +• group +│ group by: d +│ +└── • render + │ + └── • scan + missing stats + table: data@primary + spans: [/1 - /1] +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJyUklFr2zAQx9_3KY57SqhKLDtPgoKyzd0Mrp05DlvZQlGtwwQSy5Nk2Aj57sM2o8nYvO3t7n_3P_2k0wnd1wMKjD-t01WSwextsik3H9I5bOI0flOC644zBTfwPGcXMdwnaRkXMPv4Pi5iUPClC4KoAj3ddQfVHO6L_AG08gpeZA7viny7htePoJFhYzRl6kgOxWfkyDDEHcPWmoqcM7aXT0NTor-hCBjum7bzvbxjWBlLKE7o9_5AKDAzt6ZdhMhQk1f7w9B2Zmg6_2JyXtWEIjqzi8F8enCpng9UkNJkF8HVeOyvJ1u7Pyr7HRluWtU4AQt-O3AU1GiyAiS_kSEDycfXk8s-vpMRA7nEPyHy_0Fc1bWlWnljF_yaUC6R4Sp7fMry8inbpulMLuc96vZhJvlF9HOJMvyNFiHDvPMCZMhkxCawwyvsv6ysINeaxtE_7Sw47xiSrmn8Fs50tqK1NdVwzJjmg28QNDk_VqMxSZqx1ANemvmkOZw2h5Pm4Bfz7vzqRwAAAP__7JoUPA== # Verify the XOR execution plan query T -SELECT url FROM [EXPLAIN (DISTSQL) SELECT xor_agg(to_hex(a)::bytes) FROM data] +EXPLAIN (DISTSQL) SELECT xor_agg(to_hex(a)::bytes) FROM data ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJyslF1v2jAUhu_3K6xzVSSj4CRQ6quyjVVIrHTARacqQh4-SpFonNmOxIT471OSTg2odTIll_l487x5jnWOYH7vgcNqOp9-WZNM78m35eI7eZo-Pswns3ty9XW2Wq9-zHvk9ZWD0hsRx1dWbZ7xcCV6nH_-uZ6uemVQCisioJAoiffiBQ3wJ2BAwQcKAVAIgcIQIgqpVls0Run8lWMRmMkD8AGFXZJmNr8dUdgqjcCPYHd2j8BhLX7tcYlCovYGQEGiFbt9gcnZt6nevQj9ByisUpEYTvoeIyKRhBFln1EDhSUmEjUnr79wy_79A0QnCiqzb3RjRYzA2Yk2bziJY42xsEp7w_OCj4vlZnJ3lxM_RPkfot4IWaK0RI3y7PPRyV2GDf6_TXDWhjUfDWsyGo_1Pb_j4dR0rPgYtR2O31yH30iH3_eCjnXUdKzouG6rI2iuI2ikI-h7Ycc6ajpWdIzb6gib6wgb6Qj73rBjHTUdKzpuutxk76CWaFKVGLzYaO9_eZBvOpQxlmvRqExv8UGrbYEpLxdFrrgh0djyKSsvZkn5KC9YDTNn2D8Ls8uw7ybXoANnOnSHwza9h87wyE0etSFfO8NjN3nchnzjntWg5pi4D9klOzp9-hsAAP__3OgMJA== +distribution: full +vectorized: true +· +• group (scalar) +│ +└── • render + │ + └── • scan + missing stats + table: data@primary + spans: FULL SCAN +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJyslF1v2jAUhu_3K6xzBZJRcBIo9VXZxiokVjrCRacpQh4-SpFonNlGYkL89ynJpgbUOpmSy3y8ed48xzonML_2wGH29LiYzh9I7_M8WkffFn0SzRazT2tyVHojkqRn1eYZjz3R5_zj9_Us6pMvq-VXIoUVQCFVEh_ECxrgP4ABBR8oBEAhBAojiClkWm3RGKXzV05FYC6PwIcUdml2sPntmMJWaQR-AruzewQOa_FzjysUErU3BAoSrdjtC0yOvsv07kXo30AhykRqOBl4jIhUEkaUfUYNFFaYStSc_P2DO_bvFyA-U1AH-0o3ViQInJ1p84bTJNGYCKu0N7os-LRcbab39znxXZT_LuqVcEiVlqhRXnw-PrvLsOH_twku2rDmo2FNRuOxged3PJyajhUf47bD8Zvr8Bvp8Ade0LGOmo4VHTdtdQTNdQSNdAQDL-xYR03Hio5JWx1hcx1hIx3hwBt1rKOmY0XHbZeb7A3UCk2mUoNXG-3tLw_zTYcywXItGnXQW3zUaltgystlkStuSDS2fMrKi3laPsoLVsPMGfYvwuw67LvJNejAmQ7d4bBN75EzPHaTx23IN87wxE2etCHfumc1rDkm7kN2zY7PH_4EAAD__4qIBsU= # Verify the XOR execution plan query T -SELECT url FROM [EXPLAIN (DISTSQL) SELECT xor_agg(a) FROM data] +EXPLAIN (DISTSQL) SELECT xor_agg(a) FROM data ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJyslNFq2zAUhu_3FOJcJSBjy3bS1FcJW1YCWdMluSgUU7To4AVcy5Nk6Ah592F7UCe0sod2aVu_v__jiHMC_SuHBHbL9fLznlQqJ1-3m2_kafn4sF6s7snoy2q3331fj8nfI69SPfMsG_Fxe1Jww1OgUEiB9_wFNSRPwIBCCBQioBADhQmkFEolD6i1VPWRUxNYiVdIAgrHoqxM_TqlcJAKITmBOZocIYE9_5HjFrlA5QdAQaDhx7zB1Ox5qY4vXP0GCruSFzohns8ILwRhRJqfqIDCpjIJmTNIzxRkZd5Y2vAMIWFnOrzPIssUZtxI5U8u6zxuts-Lu7vRnI0_RIUfot4IVSGVQIXi4vfp2V6GBf_eJrpow4YPgg0ZhM88P3QaRU-jjv3UdRThcPlwkHzo-ZGTfE-jjvyNq3w0XD4aJB95fuwk39OoIz9zlY-Hy8eD5GPPnzjJ9zTqyN_-zw30DmqLupSFxqtN9P6fg3pDociwXWdaVuqAD0oeGkz7uGlyzQuB2rRfWfuwKtpPdcFumFnD4UWYXYdDO7kHHVnTsT0cu_SeWMNTO3nqQr6xhmd28syFfGufVdBzTeyX7Jqdnj_9CQAA__-PNOlb +distribution: full +vectorized: true +· +• group (scalar) +│ +└── • scan + missing stats + table: data@primary + spans: FULL SCAN +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJyslF1r2zAUhu_3K8S5akDGlu2kqa8StqwEsqZLclEYpmjRwQuklifJ0BHy34ftizqhlTW0S3-8et6HI84J9O8jZLB4elzNlw_k5styu9t-X43IdrFafN6RV6meeVHc8BH5ull_I4IbDhRKKfCBv6CG7AcwoBADhQQopEBhDDmFSsk9ai1V88upDSzFK2QRhUNZ1aZ5nVPYS4WQncAczBEhgx3_ecQNcoEqjICCQMMPxxbToGeVOrxw9QcobCte6owEISO8FIQRaX6hAgrr2mRkxiA_U5C1eWNpwwuEjJ2pe595USgsuJEqHF_WeVpvnuf39zczNvoQFX-IeiPUpVQCFYqL4_OzvQyL_r1NctGGuQ-CuQwiZEEYe41ioFHPfuI7ithdPnaSj4Mw8ZIfaNSTv_WVT9zlEyf5JAhTL_mBRj35qa986i6fOsmnQTj2kh9o1JO_-58b6B3UBnUlS41Xm-j9k6NmQ6EosFtnWtZqj49K7ltM97huc-0Lgdp0X1n3sCy7T03BfphZw_FFmF2HYzt5AJ1Y06k9nPr0HlvDEzt54kO-tYandvLUh3xnn1U0cE3sl-yanZ8__Q0AAP__cEnj_A== query T -SELECT url FROM [EXPLAIN (DISTSQL) SELECT max(t.a), min(t.b), avg(t.c) FROM (VALUES (1, 2, 3), (4, 5, 6), (7, 8, 0)) AS t(a, b, c) WHERE b > 3] +EXPLAIN (DISTSQL) SELECT max(t.a), min(t.b), avg(t.c) FROM (VALUES (1, 2, 3), (4, 5, 6), (7, 8, 0)) AS t(a, b, c) WHERE b > 3 ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJyUkU1r20AQhu_9FcOcdmGw9dGPsCeLVmkFtpNabhpIdVhLgxDIWnd3FQLG_71ICm0TiEluM-_Mo0e7e0T3u0WFebpMP2-hty1cbq5WcJfeXi-TbA3iS5Zv8-9LCY8re_0g_ExLgn3TCT_bSQJ9Xws_K-XEiptk-SPNQYQEEUEsCcR7gg8EH4fyE8EFQSAlJDl4EJpgR1BK-Pkt3aSwg199EMQMcYGEnal4rffsUN1hiAXhwZqSnTN2iI7jQlY9oAoIm-7Q-yEuCEtjGdURfeNbRoWtKXUL97rt2UEwD5CwYq-bdtw_EZre_6Od1zWjCk_0esNl03q2bOfhk28_5goW0d-TKaWy9fYCX_JGb_EmdW251t7YefTUvEpuxSKUSLjK1mIRDVVy81UsYvmiOn6LesPuYDrHr7rM4FQQclXz9HDO9Lbka2vKUTO1VyM3BhU7P03Dqcm6aTT84P9weBaOzsPRWTh-Bhend38CAAD__31K_PM= +distribution: full +vectorized: true +· +• group (scalar) +│ +└── • filter + │ filter: column2 > 3 + │ + └── • values + size: 3 columns, 3 rows +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJyUkV-r00wQh-_fTzHM1S4Mbf68atmrRs3RQNtzbGo9oLnYJkMMptm6u5EDpd9d0oBaocVzN_ObPPNkkiO67y0qTB8fFkm2AvE2yzf5h4WEPF2kbzaw10_CT7Qk2Ded8JOdJNA_auEnpYS79f0SxDZZfExzECFBRBBLAvE_wQuCl0P5imBGEEgJSQ4ehCbYEZQSPr1P1yns4EsfBDFDjISdqXil9-xQfcYQC8KDNSU7Z-wQHc8PZNUTqoCw6Q69H-KCsDSWUR3RN75lVLjVbc9uGiBhxV437bhxBq9BxFB-7btvTmJxIjS9_73GeV0zquBE_666a1rPlu00vJSNuYJ59OtCpVS22syuesPneJO6tlxrb-w0ujQvk0cxDyUSLrOVmEdDlWzfiXl8_eToOeo1u4PpHF9or3_MgpCrmsc_6ExvS36wpjxrxvb-zJ2Dip0fp-HYZN04Gl7wTzi8CUe34egmHP8FF6f_fgYAAP__w4r5VQ== query T -SELECT url FROM [EXPLAIN (DISTSQL) SELECT * FROM (VALUES (1, '222'), (2, '444')) t1(a,b) JOIN (VALUES (1, 100.0), (3, 32.0)) t2(a,b) ON t1.a = t2.a] +EXPLAIN (DISTSQL) SELECT * FROM (VALUES (1, '222'), (2, '444')) t1(a,b) JOIN (VALUES (1, 100.0), (3, 32.0)) t2(a,b) ON t1.a = t2.a ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJyckU9r20AQxe_9FMNcLJXB3l35JAjItC51cK00Sksh-LCVpo5gq3V3V6Vg_N2LVin5Q9PGuWlm3m-e5u0B_Q-DOVbL9fLNFfTOwLvL8gNcL79crBerDSRvV9VV9XGdwq3k9ShIPi_Wn5YVJJJgopSapASJIpjM5_NJmsKigiAh0QRfUzgvh033CCnEVAxERpCpqbgF1B-g3ECQUw1nENRUb5Gwsw1v9Hf2mF-jxC3h3tmavbduaB2iYNX8wlwQtt2-D0N7S1hbx5gfMLTBMOZobK0N_NSmZw9iJpCw4aBbE_VHQtuHO9oHvWPM5ZFe6CBn8lkO6kmHu8V9Z13DjpvHG_8v-ctvvtf-5ty2HbuZeqBGw99CUsj0zLW7m_iFhGUfcigkFYqKjIo5PnVJdkpWl-z3tvP8rIzEcAY3Ox5j8bZ3NV84W0ebsSwjFxsN-zBO1VisujiKj3kflifA6jGs_glnD2Bx3B5f_Q4AAP__go0S1Q== +distribution: full +vectorized: true +· +• hash join +│ equality: (column1) = (column1) +│ +├── • values +│ size: 2 columns, 2 rows +│ +└── • values + size: 2 columns, 2 rows +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJykkFGL00AQgN_9FcO8NJGht7sNPgQOUrVij9icl_MQJA9rMrbBmK27GxBK_rskUe5arFJ8252Zb76ZOaD73mCMq4-36XK9geD1Or_P36ch5Kt09eoensObu-wdBA_L9MMqh0ASzJRSs5AgUASzKIpmYQjLHLyEQBN8DuEmGzo9IaQQczEQC4KFmotfgPoNZBvwcq7hGryaayRsTcUb_Y0dxp9QYkG4t6Zk54wdQoexYF39wFgQ1u2-80O4ICyNZYwP6GvfMMb4oJuO3ZVAwoq9rpupYwQvIVBQ7rr2qwux6AlN5x_bOK-3jLHo6WKVPFG9-F_Vo6Frja3YcnWkKAbyXyV_mPetdrsbU7dsr9TxzA1_8UEiw2tbb3fjCwmzzseQSEoUJQtKorObyEuOdsdub1rHpxuduVFByNWWp7M409mSb60pR830zUZuDFTs_JRV02fdjqlxwKewvABWp7D6K7w4gkVf9M9-BgAA___I6BDw statement ok CREATE TABLE nullables (a INT, b INT, c INT, PRIMARY KEY (a)) query T -SELECT url FROM [EXPLAIN (DISTSQL) SELECT array_agg(a) FROM (SELECT a FROM data WHERE b = 1 AND c = 1.0 AND d = 1.0 ORDER BY a)] +EXPLAIN (DISTSQL) SELECT array_agg(a) FROM (SELECT a FROM data WHERE b = 1 AND c = 1.0 AND d = 1.0 ORDER BY a) ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJzMlVFvokAUhd_3V0zuE2THxQG0dpJNYCt2Sax20WS3aUgzlRvWhII7jMk2xv--QaxdTQWiL75x587hHL47GVaQ_0mAw8QbejdTspQJGQTjO_Lo_bofuv6IaH1_Mp38GOpku0VIKV6fRBxrQi_3am-dsoyEEuTndy_wiKY9k6-E6cQd9Yk2K56_tPVtGW1LMg76XkC-PRChh0AhzSIciRfMgT8CAwomULCAgg0UOhBSWMhshnmeyWLLaiPwo7_A2xTm6WKpiuWQwiyTCHwFaq4SBA5T8ZxggCJCabSBQoRKzJONTZHZWcj5i5CvQGGyEGnOSctgRKQRYSRTv1FCuKaQLdW7Q65EjMDZmjZPMZgnCiVKo7MfoVznRNMcsyDDOfdH094WlmOVtDjng-HYnfbeKDr2rtH3bvw7d6gDhfFSceKwo4nNo4nfg2YyQonRfkqHfYZw_cFnuXEsMRYqkwY7gOsGgfvw5N7eag7Tj0ay9iKx5qNkTUZpsJZhnjDMmhy7YXYvZphmc3JmI3Jmy7BOIFeTY0fu6mLIWc3JWY3IWS3DPoFcTY4dud7FkLObk7MbkbNbRucEcjU5duSuL4Zczc8iwHyRpTnu5T325nZxL2MUY3mP59lSzvBeZrONTVmON7rNQoS5KrusLPy0bBUB_xezSrG5J2aHYrPaucbaqlTb1WL7nNydSnG32rl7jvNVpbhX7dw7x_m6elbtmmNSfcgOvcP1p38BAAD__z91PZk= +distribution: full +vectorized: true +· +• group (scalar) +│ +└── • filter + │ filter: ((b = 1) AND (c = 1.0)) AND (d = 1.0) + │ + └── • scan + missing stats + table: data@primary + spans: FULL SCAN +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJzMlWFr2kAYx9_vUxzPq4Sdi5fE1h4MktW0C1jtorCVIeXqPWSCzbnLCSvF7z5irJ0yk6BvfNfnrn__P39PiK-Q_54Dh-jHfT-MB8TqxaPx6FvfJqOoH12PidBavDyKNLWETW6S4R2x3m7KUQojyPevURIRy3oinwmzSTjoEWta_P2pbW9GuRnJMOlFCfnyQIQNFDIlcSCeMQf-ExhQcIGCBxR8oNCBCYWFVlPMc6WLf3ldB2L5B3ibwixbLE1xPKEwVRqBv4KZmTkCh7F4mmOCQqJ22kBBohGz-bqmQA4WevYs9AtQGC1ElnPSchgRmSSMKPMLNUxWFNTSvDfkRqQInK1oc4qb2dygRu10dhHKc04sK3ALMZzzeDDublwFXimLc37TH4bj7pvEwN9e9KLr-C7sFw6HS8NJwA4SuweJ30GVlqhR7lIG7CNMVv_5WmGaakyFUdphe3LDJAkfHsPbWytg9kEkbweJNV8la7JKh7Uc94hl1nBsl3lxNst0m5tzG5lzW453hLkajq25y7Mx5zU35zUy57Uc_whzNRxbc92zMec3N-c3Mue3nM4R5mo4tuauzsZczY9FgvlCZTnu8B765HbxXkaZYvkez9VST_Feq-m6phyH69z6QGJuyltWDnFWXhWA_4ZZZdjdCbP9sFvdXFPtVab96rB_CnenMnxR3XxxSvNlZbhb3dw9pfmqelftmsek-iHb756sPvwNAAD__yC-ODo= query T -SELECT url FROM [EXPLAIN (DISTSQL) SELECT json_agg(a) FROM (SELECT a FROM data WHERE b = 1 AND c = 1.0 AND d = 1.0 ORDER BY a)] +EXPLAIN (DISTSQL) SELECT json_agg(a) FROM (SELECT a FROM data WHERE b = 1 AND c = 1.0 AND d = 1.0 ORDER BY a) ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJzMlVFvmzAUhd_3K6z7BJozYiBtamkSrCEdUxo6EmmbKlS5wWKZKM5sR9oU5b9PhCxdogVQ8pI3rq8P5_Bdy6xA_cyBwiQYBbdTtJQ5GsbRPXoMvj6M_HCMjEE4mU4-j0y03fJDieKJZZnBzGqrsW2wqkyZZujLxyAOkGE8o_eImMgfD5AxK5_fdc1tmW5LFMWDIEYfviFmJoChECkfsxeugD4CAQw2YHAAgwsYepBgWEgx40oJWW5ZbQRh-gtoF8O8WCx1uZxgmAnJga5Az3XOgcKUPec85izl0uoChpRrNs83NmVmbyHnL0z-BgyTBSsURR2LIFakiCChv3MJyRqDWOpXB6VZxoGSNW6fYjjPNZdcWr39CNU6RYbh2SUZSmk4nva3sDynokUpHY4if9r_S9Fzd41BcBve-yMTMERLTZFHjia2jyZ-DSpkyiVP91N65C0k6_98lp9lkmdMC2mRA7ifJtH4yb-7MzxiHk3k7CUi7SdJ2kzSIh3LPmGWDTl2s7y6mFna7cnZrcjZHcs5gVxDjh2564sh57Qn57Qi53Qs9wRyDTl25PoXQ85tT85tRc7tWL0TyDXk2JG7uRhyDf-KmKuFKBTfy3vszd3yWuZpxqtrXImlnPEHKWYbm6qMNrrNQsqVrrqkKsKiapUB_xWTWrG9JyaHYrveucHaqVW79WL3nNy9WvFVvfPVOc7XteJ-vXP_HOeb-ll1G45J_SE79E7Wb_4EAAD__0AWPO8= +distribution: full +vectorized: true +· +• group (scalar) +│ +└── • filter + │ filter: ((b = 1) AND (c = 1.0)) AND (d = 1.0) + │ + └── • scan + missing stats + table: data@primary + spans: FULL SCAN +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJzMlVGPmkwUhu-_XzE5V5BvLA6g607SBLrilsaVLZq0TWM2s3JCbVzGDmPSxvjfG8S61VQgeuPdnpl9fR-fQ3AN-Y8FcAg-Pw79cESMfjiejD8OTTIOhsHdhHzPZfYk0tQQJhnE0QMxdheiHBOhBfn0PogDYhjP5C1hJvFHfWLMir_ftM3dmOxGEsX9ICbvvhBhAoVMJjgSL5gD_woMKNhAwQEKLlDowJTCUskZ5rlUxb-st4Ew-Qm8TWGeLVe6OJ5SmEmFwNeg53qBwGEinhcYo0hQWW2gkKAW88W2pkD2lmr-ItQvoDBeiiznpGUxIrKEMCL1N1Qw3VCQK_3akGuRInC2oc0pBvOFRoXK6hwilOecGIZnF2I45-Fo0tu58pxSFud8MIz8Se-PRM_dX_SDu_DBHxYOo5XmxGMnie2TxK-gUiWoMDmk9Nj_MN3842v5aaowFVoqix3J_TCORk_-_b3hMfMkkXNAxJpvkjXZpMValn3GLms49rvsXs0u7ebm7Ebm7JblnGGuhmNv7uZqzDnNzTmNzDktyz3DXA3H3lzvasy5zc25jcy5Latzhrkajr2526sxV_NbEWO-lFmOB7ynPrldvJYxSbF8jedypWb4qORsW1OO0Ta3PUgw1-UtK4cwK68KwL_DrDJsH4TZcdiubq6pdirTbnXYvYS7UxnuVjd3L2m-qQz3qpt7lzTfVu-qXfOYVD9kx93TzX-_AwAA__8sJTeQ # Test that orderings on GROUP BY columns are propagated through aggregations. statement ok @@ -257,45 +723,167 @@ NULL /1 {1} 1 /9 NULL {5} 5 query T -SELECT url FROM [EXPLAIN (DISTSQL) SELECT a, max(b) FROM sorted_data GROUP BY a] +EXPLAIN (DISTSQL) SELECT a, max(b) FROM sorted_data GROUP BY a ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJyUkVGrm0AQhd_7K5Z5UtgQNfRln7RtWgSjqRpICBI27lQCxrW7KwSC_72ohSaFeO99nJnzzTk7ewf9uwYG2Tpaf81Jp2ryPU025Ljeb6MgjIn1Lczy7Gdkk78STsmV36yzPQm1VAbFSXDDyY802W3JlwPhBVBopMCYX1EDO4ILFD5DQaFVskStpRra91EUihswh8KlaTsztAsKpVQI7A7mYmoEBrFcyHbpAQWBhl_qUdZTkJ35B2nDKwS26unDYnd-cc7PNabIBaql87QeHp7m_5ISKGQtbzQjC6CQdIYR36W-B69yuB_JEVSVwoobqZbucwx_qIP4cIqT_BTvosjyXRsobIK95Xv2S3vvyf6N-6aoW9lofNeBnb6ggKLC6Q-17FSJWyXL0WYqk5EbGwK1maarqQibaTQEfITdWdibh71Z2PkPLvpPfwIAAP__vNH0cA== +distribution: full +vectorized: true +· +• group +│ group by: a +│ +└── • scan + missing stats + table: sorted_data@foo + spans: FULL SCAN +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJyUkV-LozAUxd_3U4T7pJBStexLnnR3u4tgtasWWhYpqbkrBWucJEKh-N0H9WHagTozj_fP75yTmxvolxoYrPfbKAhjYv0Kszz7G9kkW0frnznhlFz41TrZ5HeabIiWyqA4Cm44-ZMmuy35cSAcKDRSYMwvqIH9AxcofIeCQqtkiVpLNbRv41IorsAcCuem7czQLiiUUiGwG5izqREYxHIh26UHFAQafq7HtZ6C7MwbpA2vENiqp3fC7rxwzk81psgFqqXzIA93L_P_SwkUspY3mpEFUEg6w4jvUt-DZzncr-QIqkphxY1US_cxhj_UQXw4xkl-jHdRZPmuDRQ2wd7yPfupvfdg_8F9U9StbDR-6sBOX1BAUeH0h1p2qsStkuVoM5XJyI0NgdpM09VUhM00GgLew-4s7M3D3izsvIOL_ttrAAAA___rKu8R query T -SELECT url FROM [EXPLAIN (DISTSQL) SELECT a, max(b) FROM sorted_data GROUP BY a ORDER BY a] +EXPLAIN (DISTSQL) SELECT a, max(b) FROM sorted_data GROUP BY a ORDER BY a ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJzMlmFr4jAYx9_fpwjPK-UiNWl1W1_p3bxDcHanDjaGjMwGJzjTSyJsDL_70fbAut2SltTDd9rml-ef_B4e-gbq9xpCmA5Gg-8ztJVr9GMSXaH7we31qD8co8blcDqb_ho10d8lDKNn9tJ4bOYLlZCaxw8x0wz9nEQ31-jbHWIomlwOJtnPOWDYiJiP2TNXEN4DAQwUMPiAIQAMHZhjSKRYcKWETJe8ZcAwfoGwjWG1SbY6fTzHsBCSQ_gGeqXXHEKYscc1n3AWc-m1AUPMNVutszKFYL1Erp6ZfAUM04RtVIhaHkFsEyOChH7iEjBEWx2iHsE9CvMdBrHV-6pKsyWHkOxw-WT95VLyJdNCep3DYL30AiIZc8njtCRg6I_vHsbR7GF8Mxo1eqQJGK76t40ebb4Ls9__8RU9MfX0Yev5bh-Yfhp4v4_Ig7zf52u-keFUpF3fsfaR_dojj0VLJB45lPBZ-eCgPCnffKRC83mk5VHX9rNkK4jqnkb7kZrbjxy__Wh5_7SKf9ryfFf_lmyFmzo7Df-0Zv_0-P798v79Kv79lhe4-rdkK9zU-Wn492v27x_ff1Def1DFf9DyOq7-LdkKN3VxGv6Dmv0H__fz4x9pJlwlYqN4qS-LdnoeHi95fn4ltnLBr6VYZGXyv1HGZQ9irnT-luR_hpv8VRqwCJP3MCnC9AAm1eCuC3zhAhOn3KRjpqnxvn0z7Jtldc22AiPdMcMdF9Vm2KLaDFtUm2GbagttUd11UX1mhM_Nss5dZJlhiywzbJFlhm2yLLRF1oWLLGKZorYx6jZH3Qap2yR1HKVus5Q4DVNimaaBRdqHcVpJmpm2STPTNmlm2irNgtukfRiqRmnz3Zc_AQAA__9D8H8M +distribution: full +vectorized: true +· +• group +│ group by: a +│ ordered: +a +│ +└── • scan + missing stats + table: sorted_data@primary + spans: FULL SCAN +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJzMlkFv2jAUx-_7FNY7gWYU7ATa5gRb2YRESQdUajWhyiUWRaJxZhupVcV3n5IcCO1qJ3I6cSMJP7-__Xt68iuoP1sIYXR7PRmOp6h1OZ4v5r8mbTQfTUbfF4hh9MSeWw9t9GMWXSElpObxfcw0Qz9n0c01-naHGIpml6NZ_hMwJCLmU_bEFYS_gQAGChh8wBAAhh4sMaRSrLhSQmZ_ec2BcfwMYRfDJkl3Onu9xLASkkP4CnqjtxxCWLCHLZ9xFnPpdQFDzDXbbPMypVyDVG6emHwBDPOUJSpEHY8glsSIIKEfuQQM0U6HaEDwgMJyj0Hs9KGq0mzNISR7XD3ZcL2WfM20kF7vONggO4BIxlzyOCsJGIbTu_tptLif3kwmrQFpA4ar4W1rQNtvwhzWf3hBj0w9vlt6uT8Eph8GPqwjiiBv1_laLGTYFek2t61DZL_xyFPREalHjiV8VD44Kk-qNx-p0Xwe6XjUtf0s2Uqi-qfRfqTh9iOf3360un9axz_teL6rf0u20kmdnYZ_2rB_-vn-_er-_Tr-_Y4XuPq3ZCud1Plp-Pcb9u9_vv-guv-gjv-g4_Vc_VuylU7q4jT8Bw37D_7v9eMfaWZcpSJRvNLNopvth8drXuxfiZ1c8WspVnmZ4jHKufxFzJUuvpLiYZwUn7KAZZi8hUkZpkcwqQf3XeALF5g45SY9M02N5-2bYd8sq2-2FRjpnhnuuag2wxbVZtii2gzbVFtoi-q-i-ozI3xulnXuIssMW2SZYYssM2yTZaEtsi5cZBHLFLWNUbc56jZI3Sap4yh1m6XEaZgSyzQNLNLejdNa0sy0TZqZtkkz01ZpFtwm7d1QNUpb7r_8DQAA__8yuHmt query T -SELECT url FROM [EXPLAIN (DISTSQL) SELECT c, min(b), a FROM sorted_data GROUP BY a, c] +EXPLAIN (DISTSQL) SELECT c, min(b), a FROM sorted_data GROUP BY a, c ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJzMlt9v2jAQx9_3V1j3BJpRcH7QNk90Wzch0dABlVZVqHKJRZFozGwjrar43yeSSaTAfAHzkMcQf3J3_n504h307wXEMLrp33wdk5VakO_DwS15vPl117_uJaTxrTcaj372m-TfkSklr_Os8dykhBdntVRGpE8pN5z8GA7u78iXB8IpmU6AQiZTkfBXoSF-BAYUfKAQAIUQKEQwobBUciq0lmpz5D0HeukfiNsU5tlyZTY_TyhMpRIQv4OZm4WAGMb8eSGGgqdCeW2gkArD54u8TKmh7lLNX7l6AwqjJc90TFoeIzxLCSPSvAgFkzUFuTLbQtrwmYCYrWn1Zq5nMyVm3EjlRR976W5mHqhUKJHGJH-6Th6eksH4Kbnv9xtd1gQKt72k0fWbey-D5k5_25LPb-SF65e9apP1dgb_vzNsvyOL3na_87n4kGVQ1j7zpBQGKxOTbkC7Ps0nOZxMUGGqVXZoroMjJbIllx6Ldk4erh1-qM2qK8qOUNRjLc8_QVKknVJ2ndpKys4sKauFpH51UfxjRPFbXnCCKEg7pfu7qK0o_plF8WshSlBdlOAYUYKWF54gCtJO6f4uaytKcGZRglqIElYXJTxGlLDlRSeIgrRTur-r2ooSnlmUsBaiIP9ch0IvZaZFpX8_7c3IIp2J4oq0XKmpuFNympcpHgc5l_-QCm2Kt6x46GXFq02DZZjtwqwM-x9gdhzccYGvXGDm1DeL7LRvve_ADgf2sDr2tEIrHdnhyCVqO4xEbYeRqO0wFjVCI1F3XKK-sMKX9rAuXcKyw0hYdhgJyw5jYSE0EtaVS1gM2aLYGnXbo26L1G2TOq5St13KnJYpQ7ZpiIS2t06PCs1OY6HZaSw0O42GhuBYaHtL1RraZP3pbwAAAP__Cjuy1g== +distribution: full +vectorized: true +· +• group +│ group by: a +│ ordered: +a +│ +└── • scan + missing stats + table: sorted_data@primary + spans: FULL SCAN +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJzMlltv2jAUx9_3KazzBJpRcC60zRPd1k1INHRApVUTqlxiUSQaM9tIqyq--0TyQLjMJ2Ae8pjLL-cc_386ygfoPwuI4e7XQ_-2l5DGt95oPPrZb5LRXf_u65hMKXmbZ42XJiWcfB8O7omWyoj0OeWGkx_DweMD-fJEOCVToJDJVCT8TWiIfwMDCj5QCIBCCBQimFBYKjkVWku1eeUjB3rpX4jbFObZcmU2tycUplIJiD_AzM1CQAxj_rIQQ8FTobw2UEiF4fNFXqbUT3ep5m9cvQOF0ZJnOiYtjxGepYQRaV6FgsmaglyZbSFt-ExAzNa0ejO3s5kSM26k8qLdXrqbmQcqFUqkMcmvbpOn52Qwfk4e-_1GlzWBwn0vaXT95sHDoLnX37bkyzt55fr1oNpkvZ3B_-8M2-_Iorf973wuPmQZlLUvPCmFwcrEpBvQrk_zSY4nE1SYapUdm-voSIlsyaXHor03j9cOd2qz6oqyExT1WMvzz5AUaaeUXae2krILS8pqIalfXRT_FFH8lhecIQrSTun8rmorin9hUfxaiBJUFyU4RZSg5YVniIK0Uzq_69qKElxYlKAWooTVRQlPESVsedEZoiDtlM7vpraihBcWJayFKMif61Dopcy0qPT3096MLNKZKI5Iy5Waigclp3mZ4nKQc_mNVGhTPGXFRS8rHm0aLMNsH2Zl2N-B2WlwxwW-cYGZU98sstO-9bwDOxzYw-rY0wqtdGSHI5eo7TAStR1GorbDWNQIjUTdcYn6ygpf28O6dgnLDiNh2WEkLDuMhYXQSFg3LmExZItia9Rtj7otUrdN6rhK3XYpc1qmDNmmIRLawTo9KTQ7jYVmp7HQ7DQaGoJjoR0sVWtok_WnfwEAAP__1kitdw== query T -SELECT url FROM [EXPLAIN (DISTSQL) SELECT c, min(b), a FROM sorted_data GROUP BY a, c ORDER BY a] +EXPLAIN (DISTSQL) SELECT c, min(b), a FROM sorted_data GROUP BY a, c ORDER BY a ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJzMllFr4kwUhu-_XzGcK-UbiZOJts2V3a27CDbpqoUtRcrUDFawGXcywpbif19MFox1O8c4XuRyTJ6cc-Z5OfgO2a8lhDDuD_tfJ2Stl-TbKL4lj_2fd8PrQUQaN4PxZPxj2CR_X5lR8rpIG89NSkTxbqa0kclTIowg30fx_R358kAEJTMSj276o_w0BQqpSmQkXmUG4SMwoOADBQ4UAqDQgSmFlVYzmWVKb195z4FB8hvCNoVFulqb7c9TCjOlJYTvYBZmKSGEiXheypEUidReGygk0ojFMi9T6q230otXod-Awngl0iwkLY8RkSaEEWVepIbphoJam12hzIi5hJBt6PHNXM_nWs6FUdrr7PfS284c60RqmYQkP11HD09RPHmK7ofDRo81gcLtIGr0_ObBQ9780N-u5PMbeRHZy0G16WY3g__pDLvvqKK3j9_5v_iQZVDWPvOkFOK1CUmP055P80n-bYafPBX_ZKpItdTKY_vqPisf7JVnx6eUVUipx1qef0JOkXZK-rq1zSk7c05ZLXLqHx8Uv0pQ_JbHTwgK0k7p_i5qGxT_zEHxaxEUfnxQeJWg8JYXnBAUpJ3S_V3WNij8zEHhtQhKcHxQgipBCVpe54SgIO2U7u-qtkEJzhyUoBZBQf68jmS2Umkmj_r3096OLJO5LK4oU2s9k3dazfIyxTHOufyHRGameMqKwyAtHm0bLMPsI8zKsL8Hs2pw1wW-coGZU9-sY6d9631zO8ztsrp2W4GV7tjhjotqO4yotsOIajuMqUZoRHXXRfWFFb60y7p0kWWHEVl2GJFlhzFZCI3IunKRxZAtiq1Rtz3qtkjdNqnjKnXbpcxpmTJkmwaItIN1Wkmancak2WlMmp1GpSE4Ju1gqVqlTTf__QkAAP__XeS1rQ== +distribution: full +vectorized: true +· +• group +│ group by: a +│ ordered: +a +│ +└── • scan + missing stats + table: sorted_data@primary + spans: FULL SCAN +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJzMlkFv4jwQhu_fr7DmBPqMguNA25zobtkVEk26QKWtVqhyiUWRaMw6Rtqq4r-vSA6EsngI5pCjCU9mxs-rUT4g-72EEPo_H4a3g4g07gbjyfjHsEnG_WH_64TMKHlbpI2XJiWCfBvF9yRT2sjkORFGkO-j-PGBfHkigpIZiUd3_VF-AgqpSmQk3mQG4S9gQMEHChwoBEChA1MKK61mMsuU3v7lIwcGyR8I2xQW6Wpttj9PKcyUlhB-gFmYpYQQJuJlKUdSJFJ7baCQSCMWy7xMqbXeSi_ehH4HCuOVSLOQtDxGRJoQRpR5lRqmGwpqbXaFMiPmEkK2oac3czufazkXRmmvs99LbztzrBOpZRKS_HQbPT1H8eQ5ehwOGz3WBAr3g6jR85sHD3nzU3-7ki_v5FVkrwfVppvdDP7RGXbvUUVvn9_zf_Eiy6CsfeFJKcRrE5Iepz2f5pP82ww_eyp-ZKpItdTKY_vqjpUP9sqz01PKKqTUYy3PPyOnSDslfd3a5pRdOKesFjn1Tw-KXyUofsvjZwQFaad0f1e1DYp_4aD4tQgKPz0ovEpQeMsLzggK0k7p_q5rGxR-4aDwWgQlOD0oQZWgBC2vc0ZQkHZK93dT26AEFw5KUIugIB-vI5mtVJrJk75-2tuRZTKXxRVlaq1n8kGrWV6mOMY5l_-QyMwUT1lxGKTFo22DZZh9hlkZ9vdgVg3uusA3LjBz6pt17LRvvW9uh7ldVtduK7DSHTvccVFthxHVdhhRbYcx1QiNqO66qL6ywtd2WdcusuwwIssOI7LsMCYLoRFZNy6yGLJFsTXqtkfdFqnbJnVcpW67lDktU4Zs0wCRdrBOK0mz05g0O41Js9OoNATHpB0sVau06ea_vwEAAP__3-awTg== query T -SELECT url FROM [EXPLAIN (DISTSQL) SELECT b, max(c) FROM sorted_data@foo GROUP BY b] +EXPLAIN (DISTSQL) SELECT b, max(c) FROM sorted_data@foo GROUP BY b ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJyUktFq2zAUhu_3FOK_SkAlsd3d6MrZlo0M186SFFqKCYp1ZgyO5UkydIS8-7BdtqZgr7nU0fnO_4mjE-yvEgLbZbT8vGONKdnXTXLHnpYP62ixitnky2q72_6Ipuyl5cDZUT5PsmnfaLVxpPZKOhn-1Jp92yT3a_bpkR1ScFRaUSyPZCGe4IHjI1KO2uiMrNWmLZ-6ppV6hphzFFXduLaccmTaEMQJrnAlQSDWN7qeBeBQ5GRRdm1nDt24f5B1MieI2zN_NdgbH7yTh5I2JBWZ2fxiPN48DxzbWlZWsBtwJI0TLPQwJOFdI_FdF9WLgzfsUJviKM3vv-E-D4PBfP-a_EWeG8ql02bmX-aHrU9iFBlS3Xs5FvHjPk52-_g-iiahNwXH3eJhEvrTQZngQuY_q96QrXVl6V27np9TDlI59d_J6sZktDY662L6Y9JxXUGRdf3tbX9YVf1VK_ga9kZhfxz2R-FgHA5G4fkbOD1_-BMAAP__ogc4Fg== +distribution: full +vectorized: true +· +• group +│ group by: b +│ ordered: +b +│ +└── • index join + │ table: sorted_data@primary + │ + └── • scan + missing stats + table: sorted_data@foo + spans: FULL SCAN +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJyUktFq2zAUhu_3FOK_SkAlsd3d6MrZlo0M186SFFqGCYp1ZgyO5UkydAS_-7A9tqZgr73Ukb7zf4ejC-zPEgLrh2202sRs9mmzP-y_RXO2X0frjwd24uwsn2bZnH3eJXfMauNIHZV0MvyhNfuyS-637MMjO4Gj0opieSYL8R0eON4j5aiNzshabbrypX-0UU8QS46iqhvXlVOOTBuCuMAVriQIxPpG14sAHIqcLMr-WcuhG_cPsk7mBHHb8meNvenGB3kqaUdSkVksr9rjxXTg2NeysoLdgCNpnGChhzEJ7y0SX3VR_XHwxh1qU5yl-fU33OdhMJrvvyV_leeGcum0WfjX-WHnkxhFhlQ_L8cqfjzGyeEY30fRLPTm4LhbPcxCfz4qE1zJ_GfVO7K1riy9atfLNuUgldPwnaxuTEZbo7M-ZjgmPdcXFFk33N4Oh001XHWCz2FvEvanYX8SDqbhYBJevoDT9t3vAAAA__-IXTK3 query T -SELECT url FROM [EXPLAIN (DISTSQL) SELECT * FROM (SELECT a, max(c) FROM sorted_data GROUP BY a) JOIN (SELECT b, min(c) FROM sorted_data@foo GROUP BY b) ON a = b] +EXPLAIN (DISTSQL) SELECT * FROM (SELECT a, max(c) FROM sorted_data GROUP BY a) JOIN (SELECT b, min(c) FROM sorted_data@foo GROUP BY b) ON a = b ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJzMl1Fv4jgQx9_vU1jzBLdGwU6gFGml9O56J1YUem1X2tUKVYa4FInGnBOkXVX97qeQnggEPHFNb_O2BP_sGfL779TPkPyzhD7cXg4vf78ja70kf96Mr8i3yy_Xw4vBiDT-GNze3f49bJLXJb_mCxqvHwUlT-J7Y9bMHydKpzK6j0QqyF8348_X5LevRDTJp3G21yszpeRpER9iwgeltty0ScYjIshHMp0AhVhFciSeZAL9b8CAAgcKPlAIgEIHJhRWWs1kkiidLXneAIPoO_TbFBbxap1mjycUZkpL6D9DukiXEvpwJ6ZLeSNFJLXXBgqRTMViuTmmWNtKL56E_gEUblciTvqk5TEi4ogwotJHqYHCeJ32Scho6MPkhYJap9tTk1TMJfTZC61e2cV8ruVcpEp7nd3CwuwHGOtIahllRwKFi9HX-9H47n70eThshKwJFK4uvjRC3twrZrv_9Ad5FMljaevJy7ZgfrTg7T4qL2R_nw_5RoauWPtnteW7tUW3q9bxoXUHO7-Sei4_qUUstcd6u_su5UPaCNmH5ke9mD_m_ywqxWno0zA4KtZZhYYsSh2pllp53N9befjs3s7ZrHrcmEXcPNbyuGvgkNoKanbrETh24sCxegTOuq0TBO78PQPHq0vPbaTnLc93lR6praDHWT2k5yeWntdDeuu23KXn7feU3q8uvW8jvd_yAlfpkdoKevTqIb1_Yun9ekhv3dYJpGfvKX1QXfrARvqg5XVcpUdqK-hxXg_pgxNLH9RDegtHWOe4JA9KFa6bWyGO2hDYVJGl5b8iulVMzU_nJh07b9SRve0vj8HI-cV13Xw8wf9W_P-6CB4o5EYmKxUnstI1r521IqO5zH-dRK31TF5rNdsck38cb7jNg0gmaf4tyz8M4vyrrMAizPZhVoT5Dszs4DMXmDEnuuNEn5tpbqR9F7jnAjPkdSF014XmSNu-UdLADAdGmAdmxTtGumuGuy75MMNIPswwlg-ERvKB0Eg-zlzyYYaRfJhhLB8IjeTDTGP56Lnk49w8AdrICCgNEKsZYKaxIWCm0SmA4NgYQHDEc2YeI8gbR2jEdITGVMdwxHUEx2RnpVliYzszzxKGjANWmiZWuptpTHczjeqO4JjuCI7pXhqkVrqbaUx3M43qjuCY7mYc1b00Tq10Lw2WXd17iO6lyWKlu5nGdDfTqO4IjumO4JjupalqpbuZxnQ306juCI7pbsYx3bn5QsqRGykvzZZdnCO4ze2MW9I9J3rvtVnjXSecY63bXdEmL7_8GwAA__-kmUNE +distribution: full +vectorized: true +· +• merge join +│ equality: (a) = (b) +│ left cols are key +│ right cols are key +│ +├── • group +│ │ group by: a +│ │ ordered: +a +│ │ +│ └── • scan +│ missing stats +│ table: sorted_data@primary +│ spans: FULL SCAN +│ +└── • group + │ group by: b + │ ordered: +b + │ + └── • index join + │ table: sorted_data@primary + │ + └── • scan + missing stats + table: sorted_data@foo + spans: FULL SCAN +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJzMl_Fv4jYUx3_fX2G9n2BnFOwESpFOSrd1EydKurYn3WlClSEuRaIxc4J0p6r_-xRyE4FQv7imW35rQj72e-Tz7cPPkP69giFcfrkeX4wmpPXb6Pbu9s9xm9xeji9_vSM_k99voivS-nEpKHkS31rzdnE7VTqT8X0sMkH-uIk-X5NfvhLRJp-ifK0fzIySp2VyjAkflNpxszaJJkSQj2QGFBIVy4l4kikM_wIGFDhQ8IFCABR6MKWw1mou01Tp_JHnLTCKv8GwS2GZrDdZfntKYa60hOEzZMtsJWEId2K2kjdSxFJ7XaAQy0wsV9ttyqWt9fJJ6O9A4XYtknRIOh4jIokJIyp7lBooRJtsSEJGQx-mLxTUJtvtmmZiIWHIXmj9yi4WCy0XIlPa6-0XFuZfQKRjqWWcbwkULiZf7yfR3f3k83jcClkbKFxdfGmFvH1QzG792XfyKNLHytLTl13B_NWCd-uoopDDdT4UCxm6Yt3_qy3frS26e2qTHHvuaOdXUi_kJ7VMpPbYYH_dlXzIWiH70P6ol4vH4s-yUpyGPg2DV8U6q9GQRakT1VFrj_sHTx7fe7C3N6sfN2YRN491PO4aOKS2kpr9ZgSOnThwrBmBs27rBIE7f8_A8frScxvpecfzXaVHaivpcdYM6fmJpefNkN66LXfpefc9pffrS-_bSO93vMBVeqS2kh6DZkjvn1h6vxnSW7d1AunZe0of1Jc-sJE-6Hg9V-mR2kp6nDdD-uDE0gfNkN7CEdZ7XZIHpUrHzZ0Qr9oQ2FSRp-XfIvp1TC125yYde2_Ukb3tl8do4vzi-m4-nuC_Ff-vDoJHCrmR6Volqax1zOvmrch4IYtvJ1UbPZfXWs232xSX0Zbb3ohlmhWfsuJilBQf5QWWYXYIszLM92BmB5-5wIw50T0n-txMcyPtu8ADF5ghrwuh-y40R9r2jZIGZjgwwjwwK94z0n0z3HfJhxlG8mGGsXwgNJIPhEbyceaSDzOM5MMMY_lAaCQfZhrLx8AlH-fmCdBFRkBlgFjNADONDQEzjU4BBMfGAIIjnjPzGEHeOEIjpiM0pjqGI64jOCY7q8wSG9uZeZYwZBywyjSx0t1MY7qbaVR3BMd0R3BM98ogtdLdTGO6m2lUdwTHdDfjqO6VcWqle2Ww7Os-QHSvTBYr3c00pruZRnVHcEx3BMd0r0xVK93NNKa7mUZ1R3BMdzOO6c7NB1KOnEh5Zbbs4xzBbU5n3JIeONEHr80a7zvhHGvd7og2ffnpnwAAAP__IfA95Q== # Verify that the stages preserve the ordering as expected. query T -SELECT url FROM [EXPLAIN (DISTSQL) SELECT sum(x) FROM (SELECT a, b::float + c AS x FROM data) GROUP BY a ORDER BY a] +EXPLAIN (DISTSQL) SELECT sum(x) FROM (SELECT a, b::float + c AS x FROM data) GROUP BY a ORDER BY a ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJzMllFv4jgUhd_3V1j3CVSjYCdQmqewW7pCoqQbqLRVhSqXWBSJxowdpFZV__soSWcIMNjpOOrwRoK_63PvObrKG6hvK_BhMhgN_pmijVyhqyi8RveD_29G_eEYNS6Hk-nkv1ETfRxRm-fGS7M41fh4xzB69P2rUdif9tAZmqP-BL0UR2KWsib6Nwpvb9Dfd4ihMLocRPnPGWBIRMzH7Jkr8O-BAAYKGFzA4AGGDswwrKWYc6WEzI685cAwfgG_jWGZrDdp9nqGYS4kB_8N0mW64uDDlD2ueMRZzKXTBgwxT9lylV-TSQrWcvnM5CtgmKxZonzUcghiSYwoEukTlwowRDyJufRR4J4F9Ed_GAUEZu8YxCbdXq9StuDgk3dcXWJ_sZB8wVIhnc6uwiCbQihjLnnso_ypP757GIfTh_HtaNQIaDMTfnvdCEhzT8y2_uMremLqaa90Jn4rmB4VvK0jCiH7dc6KQpquSPvg7nJb5KAt8rOtvMFwk2bdY83A3d_WT4_oH4uWWDtkz5FCynEd3o4OUj2bpEo2HdJyaJ5OUqSzhnAaNJZs7J5GOEnN4SRfHE5aPRS0Uihoy3FrDoVBY2l856cRClpzKOgXh8KtHgq3UijcluPVHAqDxtL4eqcRCrfmULhfHAqveii8SqHwWvkXhm0QDLpKI7s4jSB4NQfB-4PfM7-QFnG1FoniO6qOVW5nzfF4wYthKLGRc34jxTy_pngMcy5_EXOVFv-S4mGYFH9lAssw2YdJGaY7MPkc3LWBL2xgYqWbdPQ01c7b1cOu3qyu3i1PS3f0cMfGaj1ssFoPG6zWwyarDbTB6q6N1edauKc3q2djlh42mKWHDWbpYZNZBtpg1oWNWcSwRU1r1G6P2i1Su01quUrtdimxWqbEsE09g2kH6_RTpulpk2l62mSanjaaZsBNph0sVa1ps_e_vgcAAP__2RWYxw== +distribution: full +vectorized: true +· +• group +│ group by: a +│ ordered: +a +│ +└── • render + │ + └── • scan + missing stats + table: data@primary + spans: FULL SCAN +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJzMllFv2j4Uxd__n8K6T6AaBTuB0jyF_0onJEq6QKVVE6pcYlEkGjM7SK2qfvcpyTYCDDudo443YvK7Pveeo6u8gvq-Ah8GX29G_eEYNS6Hk-nky6iJJoPR4NMUqc1T47mJrqLwGjV-njGMHnz_ahT2pz10huaoP0HPxSsxS1kTfY7C2xv0_x1iKIwuB1H-EzAkIuZj9sQV-N-AAAYKGFzA4AGGDswwrKWYc6WEzF55zYFh_Ax-G8MyWW_S7HiGYS4kB_8V0mW64uDDlD2seMRZzKXTBgwxT9lylV-TKQrWcvnE5AtgmKxZonzUcghiSYwoEukjlwowRDyJufRR4J4F9Fd7GAUEZm8YxCbdXq9StuDgkzdcXWJ_sZB8wVIhnc6uwiCbQihjLnnso_ypP767H4fT-_HtaNQIaDMTfnvdCEhzT8y2_sMLemTqca90Jn4rmB4VvK0jCiH7dc6KQpquSPvg7nJb5KAt8rutvMFwk2bdY83A3b_WT4_oH4uWWDtkz5FCynEd3o4OUj2bpEo2HdJyaJ5OUqSzhnAaNJZs7J5GOEnN4SQfHE5aPRS0Uihoy3FrDoVBY2l856cRClpzKOgHh8KtHgq3UijcluPVHAqDxtL4eqcRCrfmULgfHAqveii8SqHwWvkXhm0QDLpKI7s4jSB4NQfB-4ffM3-QFnG1FoniO6qOVW5nzfF4wYthKLGRc34jxTy_pngMcy4_iLlKi39J8TBMir8ygWWY7MOkDNMdmLwP7trAFzYwsdJNOnqaauft6mFXb1ZX75anpTt6uGNjtR42WK2HDVbrYZPVBtpgddfG6nMt3NOb1bMxSw8bzNLDBrP0sMksA20w68LGLGLYoqY1ardH7Rap3Sa1XKV2u5RYLVNi2KaewbSDdfou0_S0yTQ9bTJNTxtNM-Am0w6Wqta02dt_PwIAAP__FtqTaA== query T -SELECT url FROM [EXPLAIN (DISTSQL) SELECT sum(x) FROM (SELECT a, b::float + c AS x FROM data) WHERE a > x GROUP BY a ORDER BY a] +EXPLAIN (DISTSQL) SELECT sum(x) FROM (SELECT a, b::float + c AS x FROM data) WHERE a > x GROUP BY a ORDER BY a ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJzMll9v2koQxd_vp1jNEyiLzK7NPz-Ze0NukQhODVEbpSja4BVBIpiujUQU5btXthP-ueyYYqW8gfFv58yeMyNeIfw5AxsGnV7nvyFZqhm58txrct_5ftNrd_ukdNkdDAdfe2Xy_kq4fC6tyulbpfdngpJH277que1hk1yQMWkPyCp9xReRKJNvXzpehwjyY1mtmpKsyP-ee3tD_r0jgrjeZcdLPo6AwjzwZV88yxDse2BAgQMFEyhYQKEGIwoLFYxlGAYqfuU1Abr-Cuwqhel8sYzixyMK40BJsF8hmkYzCTYMxeNMelL4UhlVoODLSExnSZlYo7NQ02ehXoDCYCHmoU0qBiNi7hNOguhJqhAoeHLuS2UTx7xw-EfDlDgMRm8UgmW0KR9GYiLBZm80v8Sr6SySSiqjtqsvfW4Th39coKYiP6ZiezJRciKiQBls71Kc-OJd5Usl_bg0UGj37x767vChf9vrlRxeju_q9rrksPKemk2BxxfyJMKnvaNj9RvF5kHFm3OCVMj-ORfpQbq2apna222xTFts3VbSoLuM4u6p5satP9bPD-jvB5VgYfA9R1Iph3XUdnSw_OPA8oyDwSoGTwaCpQNRwDwgGtfzUC9sHpCK28Fh5zEPrOB5qH_yPPD8OeS5csgrhllwDhGN6xw2CsshUnHbMH4eOeQF57DxyTk08-fQzJVDs2JYBecQ0bjOYbOwHCIVtw0zzyOHZsE5bH5yDq38ObRy5dCqJP8XT80eomudvVZh2UMqbptknUf2rIKz1_qL_01_I82T4SKYh3JH1aGTq3Fz0p_I9DLCYKnG8kYF46RM-tVNuOSBL8Mo_ZWlX7rz9KdY4DbMtDDXw3wfZtuwuQOz4-DmKTDjJ9H1U2he1dOm9sItPWzp3UK8rmnpuh6ua-GGHm6cEhQ9jARFD2NBQWgkKHoaC0rzlKC09DuhiiwFZKVgOyWzVI6xG6ERvxEaMxzDEccRHLOcZVbLMZ4z_WphFuKafrmwGoJntstRputpzHQ9jZqO4Jjpehw1Xb9ZMdMzS2bXtSbimn7LsBaCZ_bMUabracx0PY2ajuCY6XocM53rN-y-6aO3f34FAAD__2DXviQ= +distribution: full +vectorized: true +· +• group +│ group by: a +│ ordered: +a +│ +└── • filter + │ filter: a > x + │ + └── • render + │ + └── • scan + missing stats + table: data@primary + spans: FULL SCAN +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJzMlt1u2kAQhe_7FKu5AmWR2bX585VpQ1okglND1EYtijZ4RZAIpmsjEUV598p2w5_LjilWyh0Yvp0ze86M_ALhrxnY0Pl-02t3-6R02R0MB197ZTLo9DqfhiRcPpVWZXLludek9OeZoOTBtq96bnvYJBdkTNoDskr_4otIlMm3Lx2vQwT5uaxWTUlW5LPn3t6Qj3dEENe77HjJR6AwD3zZF08yBPsHMKDAgYIJFCygUIMRhYUKxjIMAxX_5SUBuv4K7CqF6XyxjOLHIwrjQEmwXyCaRjMJNgzFw0x6UvhSGVWg4MtITGdJmViis1DTJ6GegcJgIeahTSoGI2LuE06C6FGqECh4cu5LZRPHvHD4W7-UOAxGrxSCZbQpH0ZiIsFmrzS_xKvpLJJKKqO2qy99bhOHv92fpiI_pmJ7MlFyIqJAGWzvUpz44l3lSyX9uDRQaPfv7vvu8L5_2-uVHF6O7-r2uuSw8p6aTYGHZ_Iowse9o2P1G8XmQcWbc4JUyP45F-lBurZqmdrbbbFMW2zdVtKgu4zi7qnmxq1_1s8P6O8HlWBh8D1HUimHddR2dLD848DyjIPBKgZPBoKlA1HAPCAa1_NQL2wekIrbwWHnMQ-s4Hmov_M88Pw55LlyyCuGWXAOEY3rHDYKyyFScdswfh455AXnsPHOOTTz59DMlUOzYlgF5xDRuM5hs7AcIhW3DTPPI4dmwTlsvnMOrfw5tHLl0Kok74unZg_Rtc5eq7DsIRW3TbLOI3tWwdlr_cd3079I82S4COah3FF16ORq3Jz0JzK9jDBYqrG8UcE4KZN-dRMueeDLMEp_ZemX7jz9KRa4DTMtzPUw34fZNmzuwOw4uHkKzPhJdP0Umlf1tKm9cEsPW3q3EK9rWrquh-tauKGHG6cERQ8jQdHDWFAQGgmKnsaC0jwlKC39TqgiSwFZKdhOySyVY-xGaMRvhMYMx3DEcQTHLGeZ1XKM50y_WpiFuKZfLqyG4JntcpTpehozXU-jpiM4ZroeR03Xb1bM9MyS2XWtibim3zKsheCZPXOU6XoaM11Po6YjOGa6HsdM5_oNu2_66PXD7wAAAP__bHO4xQ== # Ensure that an interesting input ordering that causes an ordered group by # forces an ordered synchronizer. We create an index on b even though it's @@ -372,9 +960,21 @@ vectorized: true spans: /1-/2 query T -SELECT url FROM [EXPLAIN (DISTSQL) SELECT b, count(*) FROM data2 WHERE a=1 GROUP BY b]; +EXPLAIN (DISTSQL) SELECT b, count(*) FROM data2 WHERE a=1 GROUP BY b; ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJzMlF-Lm0wUxu_fTzGcq-TtLGYmfwpCwXRrW8HVVA3bZZEw0cENuI6dGaHLku9e1EBMmnWTtpRejuf8znme84DPoL7lYEJou_Z1hCqZo4-Bf4Pu7a8Ld-54aPDBCaPwiztEu5Y1RomoCj34f9i2pkwzim4_24GNGHqHCPoU-MsFen-H1jFgKETKPfbIFZj3QAADBQxTiDGUUiRcKSHr0nPT6KTfwRxh2BRlpdvPeqNzDiZUhZAplzwFDCnXbJPX9XgbY0iE5GDuWz1xJUpjdtSIQVR6NzbGoDTLOJiTLe6sJp3VJwZHbJ3zgLOUS2N0MB6aM1il3Dwy-QQYwpIVykQGuTKIUdv2K20ii8JLQsglQuZZJnnGtJAGPdRhNbvaS5moec29u5XnRytv6boDiwwBw7W_9KJV4N-Gg-GRov2S9RN6YOrhp_nNzXeq6Yuq93NO5QYWeQMnw-tYm_yKtXB5s3K8aGDRY2d71eMD1fT80MmZodex04tDf0VI5zLjfyh0-mdDn_6d0Ef9tw64KkWh-Fn_kFFtiacZb0-gRCUTvpAiada0T7_hmg8pV7qtvm0fTtGWaoFdmPTCtB-mxzDpwuMDmFwGz_rhca_sUT886YWn_Z6nv-O5H37F8-wiz_H2vx8BAAD__zm6YjY= +distribution: full +vectorized: true +· +• group +│ group by: b +│ ordered: +b +│ +└── • scan + missing stats + table: data2@primary + spans: [/1 - /1] +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJzMlNGLm0AQxt_7VyzzZNo9dDeXFISC6dW2gqepGq5HkbDRxQvkXLu7Qo8j_3tRD2LSnJe0pfRxnfnNfN984COo7xuwwf0692degIwPXpzEX_wRil3fvUrQCqNM1KU2Xo_Qxyi8RjnTjKKbz27kIobeIYI-ReFijt7fohVgKEXOA3bPFdjfgAAGChgmkGKopMi4UkI2pce20ct_gG1hWJdVrbvPeq03HGyoSyFzLnkOGHKu2XrT1NNtiiETkoO9aw3EhajM6UEjBlHrp7EpBqVZwcG-3OLeatJbfWRwwlYbHnGWc2lae-OhvYJTyfU9kw-AIa5YqWxkkguTmI3tsNY2cig8J4ScI2RWFJIXTAtp0n0dTruru5SN2tcsuF0GYbIMFr5vOGQEGK7CRZAso_AmNkYHinZLVg_ojqm7X-a3N39STZ9VvZtzLDdwyBs4Gl7P2uXvWIsX10svSAyHHjrbqR7vqaanh05ODL2JnZ4d-gtCepcZ_0eh078b-uTfhG4N3zriqhKl4if9Q6zGEs8L3p1AiVpmfC5F1q7pnmHLtR9yrnRXfds9vLIrNQL7MBmE6TBMD2HSh8d7MDkPng7D40HZ1jB8OQhPhj1P_sTzMPyC5-lZntPtq58BAAD__0K5XNc= statement ok CREATE TABLE uv (u INT PRIMARY KEY, v INT); @@ -382,6 +982,23 @@ INSERT INTO uv SELECT x, x*10 FROM generate_series(2, 8) AS g(x); # Regression test for #37211 (incorrect ordering between aggregator stages). query T -SELECT url FROM [EXPLAIN (DISTSQL) SELECT sum(v) FROM data INNER LOOKUP JOIN uv ON (a=u) GROUP BY u ORDER BY u] +EXPLAIN (DISTSQL) SELECT sum(v) FROM data INNER LOOKUP JOIN uv ON (a=u) GROUP BY u ORDER BY u ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJzMlltv2koUhd_PrxjtJ9AZZGZsbpaORE5DK1JiUy5SowhFDh4RWuKhvkSNovz3ynYUDJTZdkEubxj8zayZtfYSLxD8WIEJ496g92FCIn9FPo7sa3Lb-zocXPQtUrnsjyfjL4MqeXsliB4rT9X0LdcJHdK3rN6IDGz783RIruy-RaInYluk4pD_SFQln0b2dEj-vyERsUeXvVHycQYUPOkKy3kUAZi3wIACBwo6UDCAQgNmFNa-nIsgkH78yksC9N2fYNYpLL11FMZfzyjMpS_AfIFwGa4EmDBx7ldiJBxX-FodKLgidJarZJtYcXftLx8d_xkojNeOF5ikpjHieC7hRIYPwg-Agh2FJukymL1SkFG42SwInYUAk73S_IKu5NJ709PY1hM9ZdQMpPwerck3ufSI9JLt34XQLqdd_aAcXkTOxWLhi4UTSl9jO_fTjT2wfVf4wjVJ8nRh3dxZ9uTOmg4GlS6vxtc2va509eqOms0G98_kwQkedpaOL3OjWD-oeLOOTIXsrvNvupDqWI29vbPHYnvHYu_HSg6YXjqnigAYf6yfH9BvyZpca3zHESyIjS0dLP9ksDyTobGaxpPZYOlsFB4NRFFmNJpljAYiJ5shdh6jwU48Gs2SR4PnjyTPFUle0_SjIokoykSyVUYkETlZ7_h5RJKfOJKtkiOp54-kniuSek0zjookoigTyXYZkUTkZL3TzyOS-okj2S45kkb-SBq5ImnUkv-axWKIqMjEsFNGDBE5Wb-M84ihceIYdv7i_9jfSBuJYC29QGypOrRyPT6ccBcivYxARv5cDH05T7ZJH-2ES75wRRCmv7L0oe-lP8UCszBTwlwN812YZWF9C2bF4PYxMONH0c1jaF5X07rywg01bKjdQrxuKOmmGm4q4ZYabh0TFDWMBEUNY0FBaCQoahoLSvuYoHTUnVBHSgGpFKxT9kqliN0IjfiN0JjhGI44juCY5WyvWop4ztTVwgzENXW5sAaC77VLIdPVNGa6mkZNR3DMdDWOmq5uVsz0vZLZdq2NuKZuGdZB8L2eKWS6msZMV9Oo6QiOma7GMdO5umF3TZ-9_vMrAAD__9au0MI= +distribution: full +vectorized: true +· +• group +│ group by: u +│ ordered: +u +│ +└── • lookup join + │ table: uv@primary + │ equality: (a) = (u) + │ equality cols are key + │ + └── • scan + missing stats + table: data@primary + spans: FULL SCAN +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJzMlttv2jAYxd_3V1jfE2hGwU64RZpEt7KJjiaMi7RqQlVKLMpGY5ZLtarq_z4lmUqA4S8ZKOOtIf3Zxz7nO8ozBD9XYELv63Bw0bdI5bI_noy_DKpk3Bv0PkxIED1UHqvk48i-Jq4TOqRvWb0RGdj25-mQXNl9i0SPxLZIxSHvSFQln0b2dEje35CI2KPL3ij5Eyh40hWW8yACML8BAwocKOhAwQAKDZhRWPtyLoJA-vG_PCdA3_0FZp3C0ltHYfzzjMJc-gLMZwiX4UqACRPnbiVGwnGFr9WBgitCZ7lKtokFd9f-8sHxn4DCeO14gUlqGiOO5xJOZHgv_AAo2FFoki6D2QsFGYWbzYLQWQgw2QvNL-hKLr0_ehrbeqLHjJqBlD-iNfkulx6RXrL9qxDa5bSrH5TDi8i5WCx8sXBC6Wts5366sQe27wpfuCZJni6sm1vLntxa08Gg0uXV-Nqm15WuXt1Rs9ng7oncO8H9ztLxZW4U6wcVb9aRqZDddd6mC6mO1djbO3sstncs9nqs5IDppXOqCIDxz_r5Af2WrMm1xnccwYLY2NLB8k8GyzMZGqtpPJkNls5G4dFAFGVGo1nGaCByshli5zEa7MSj0Sx5NHj-SPJckeQ1TT8qkoiiTCRbZUQSkZP1jp9HJPmJI9kqOZJ6_kjquSKp1zTjqEgiijKRbJcRSURO1jv9PCKpnziS7ZIjaeSPpJErkkYt-dYsFkNERSaGnTJiiMjJ-mWcRwyNE8ew8x-_Y_8ibSSCtfQCsaXq0Mr1-HDCXYj0MgIZ-XMx9OU82SZ9tBMu-cEVQZi-ZelD30tfxQKzMFPCXA3zXZhlYX0LZsXg9jEw40fRzWNoXlfTuvLCDTVsqN1CvG4o6aYabirhlhpuHRMUNYwERQ1jQUFoJChqGgtK-5igdNSdUEdKAakUrFP2SqWI3QiN-I3QmOEYjjiO4JjlbK9ainjO1NXCDMQ1dbmwBoLvtUsh09U0ZrqaRk1HcMx0NY6arm5WzPS9ktl2rY24pm4Z1kHwvZ4pZLqaxkxX06jpCI6ZrsYx07m6YXdNn728-R0AAP__KQDLYw== diff --git a/pkg/sql/opt/exec/execbuilder/testdata/distsql_auto_mode b/pkg/sql/opt/exec/execbuilder/testdata/distsql_auto_mode index d12a4be0821c..27378a11fcd3 100644 --- a/pkg/sql/opt/exec/execbuilder/testdata/distsql_auto_mode +++ b/pkg/sql/opt/exec/execbuilder/testdata/distsql_auto_mode @@ -13,112 +13,99 @@ SET distsql=auto statement ok CREATE TABLE kv (k INT PRIMARY KEY, v INT) -# Verify that EXPLAIN (DISTSQL) hides the JSON column by default (#21089) -query BT colnames -EXPLAIN (DISTSQL) SELECT 1 ----- -automatic url -false https://cockroachdb.github.io/distsqlplan/decode.html#eJyMj0FLxDAUhO_-ijAnhYDtNTfRHgplXe0eBOkhJI-lEPtqXipCyX-XTQ5ee5xvZt7wdsh3gEH3cR6e-pO6f-nHy_g2PKixG7rni2qhsbCnk_0igflEi0ljjexIhOMN7SXQ-1-YRmNe1i3d8KThOBLMjjSnQDAI7GxQPzZsJKp5bKDhKdk5lHzW4C39tyXZK8G0WR9feCdZeRE6dLnJkwb5K9UvhLfo6BzZlZkqX0uvAE-SqttW0S_VylO--wsAAP__NiFqpA== - -# Check the JSON column is still there, albeit hidden. -query T colnames -SELECT json FROM [EXPLAIN (DISTSQL) SELECT * FROM kv] WHERE false ----- -json - # Full table scan - distribute. -query B -SELECT automatic FROM [EXPLAIN (DISTSQL) SELECT * FROM kv] +query T +SELECT info FROM [EXPLAIN SELECT * FROM kv] WHERE info LIKE 'distribution%' ---- -true +distribution: full # Partial scan - don't distribute. -query B -SELECT automatic FROM [EXPLAIN (DISTSQL) SELECT * FROM kv WHERE k=1] +query T +SELECT info FROM [EXPLAIN SELECT * FROM kv WHERE k=1] WHERE info LIKE 'distribution%' ---- -false +distribution: local # Partial scan - don't distribute. -query B -SELECT automatic FROM [EXPLAIN (DISTSQL) SELECT * FROM kv WHERE k>1] +query T +SELECT info FROM [EXPLAIN SELECT * FROM kv WHERE k>1] WHERE info LIKE 'distribution%' ---- -false +distribution: local # Partial scan with filter - don't distribute. -query B -SELECT automatic FROM [EXPLAIN (DISTSQL) SELECT * FROM kv WHERE k>1 AND v=1] +query T +SELECT info FROM [EXPLAIN SELECT * FROM kv WHERE k>1 AND v=1] WHERE info LIKE 'distribution%' ---- -false +distribution: local # Sort - distribute. -query B -SELECT automatic FROM [EXPLAIN (DISTSQL) SELECT * FROM kv WHERE k>1 ORDER BY v] +query T +SELECT info FROM [EXPLAIN SELECT * FROM kv WHERE k>1 ORDER BY v] WHERE info LIKE 'distribution%' ---- -true +distribution: full # Aggregation - distribute. -query B -SELECT automatic FROM [EXPLAIN (DISTSQL) SELECT k, sum(v) FROM kv WHERE k>1 GROUP BY k] +query T +SELECT info FROM [EXPLAIN SELECT k, sum(v) FROM kv WHERE k>1 GROUP BY k] WHERE info LIKE 'distribution%' ---- -true +distribution: full # Hard limit in scan - distribute. -query B -SELECT automatic FROM [EXPLAIN (DISTSQL) SELECT * FROM kv LIMIT 1] +query T +SELECT info FROM [EXPLAIN SELECT * FROM kv LIMIT 1] WHERE info LIKE 'distribution%' ---- -true +distribution: full # Soft limit in scan - don't distribute. # TODO(yuzefovich): soft limits are currently ignored in scans. -query B -SELECT automatic FROM [EXPLAIN (DISTSQL) SELECT * FROM kv UNION SELECT * FROM kv LIMIT 1] +query T +SELECT info FROM [EXPLAIN SELECT * FROM kv UNION SELECT * FROM kv LIMIT 1] WHERE info LIKE 'distribution%' ---- -true +distribution: full # Limit after sort - distribute. -query B -SELECT automatic FROM [EXPLAIN (DISTSQL) SELECT * FROM kv WHERE k>1 ORDER BY v LIMIT 1] +query T +SELECT info FROM [EXPLAIN SELECT * FROM kv WHERE k>1 ORDER BY v LIMIT 1] WHERE info LIKE 'distribution%' ---- -true +distribution: full # Limit after aggregation - distribute. -query B -SELECT automatic FROM [EXPLAIN (DISTSQL) SELECT k, sum(v) FROM kv WHERE k>1 GROUP BY k LIMIT 1] +query T +SELECT info FROM [EXPLAIN SELECT k, sum(v) FROM kv WHERE k>1 GROUP BY k LIMIT 1] WHERE info LIKE 'distribution%' ---- -true +distribution: full statement ok CREATE TABLE kw (k INT PRIMARY KEY, w INT) # Join - distribute. -query B -SELECT automatic FROM [EXPLAIN (DISTSQL) SELECT * FROM kv NATURAL JOIN kw] +query T +SELECT info FROM [EXPLAIN SELECT * FROM kv NATURAL JOIN kw] WHERE info LIKE 'distribution%' ---- -true +distribution: full # Join with span - distribute. -query B -SELECT automatic FROM [EXPLAIN (DISTSQL) SELECT * FROM kv NATURAL JOIN kw WHERE k=1] +query T +SELECT info FROM [EXPLAIN SELECT * FROM kv NATURAL JOIN kw WHERE k=1] WHERE info LIKE 'distribution%' ---- -true +distribution: full statement ok CREATE TABLE abc (a INT PRIMARY KEY, b INT, c INT, INDEX b (b)) # Index join - don't distribute. -query B -SELECT automatic FROM [EXPLAIN (DISTSQL) SELECT * FROM abc WHERE b=1] +query T +SELECT info FROM [EXPLAIN SELECT * FROM abc WHERE b=1] WHERE info LIKE 'distribution%' ---- -false +distribution: local # Index join with filter on result - don't distribute. -query B -SELECT automatic FROM [EXPLAIN (DISTSQL) SELECT * FROM abc WHERE b=1 AND c%2=0] +query T +SELECT info FROM [EXPLAIN SELECT * FROM abc WHERE b=1 AND c%2=0] WHERE info LIKE 'distribution%' ---- -false +distribution: local # Index join with filter on index scan - don't distribute. -query B -SELECT automatic FROM [EXPLAIN (DISTSQL) SELECT * FROM abc WHERE b=1 AND a%2=0] +query T +SELECT info FROM [EXPLAIN SELECT * FROM abc WHERE b=1 AND a%2=0] WHERE info LIKE 'distribution%' ---- -false +distribution: local diff --git a/pkg/sql/opt/exec/execbuilder/testdata/distsql_distinct_on b/pkg/sql/opt/exec/execbuilder/testdata/distsql_distinct_on index 24cdc7547979..1d4e76d9f88e 100644 --- a/pkg/sql/opt/exec/execbuilder/testdata/distsql_distinct_on +++ b/pkg/sql/opt/exec/execbuilder/testdata/distsql_distinct_on @@ -82,9 +82,20 @@ vectorized: true spans: FULL SCAN query T -SELECT url FROM [EXPLAIN (DISTSQL) SELECT DISTINCT ON (x,y,z) x, y, z FROM xyz] +EXPLAIN (DISTSQL) SELECT DISTINCT ON (x,y,z) x, y, z FROM xyz ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJy8lU1v4jAQhu_7K6w5tZKj4HxQyIlVy0pILHSBw0oVh5RYbSSaZO1E4kP891WSCgotHhdH3Ajx43ntZzTZgvy3hACm_WH_fkYKsSS_JuPf5Kn_93H4czAiNw-D6Wz6Z3hL3peUz4PR_YyMR-RmRcmaks0tef9Rw6v1Zg4UkjTio_CNSwiegAEFByi4QMEDCj7MKWQiXXApU1Eu2VbAIFpB0KIQJ1mRl3_PKSxSwSHYQh7nSw4BzMLnJZ_wMOLCbgGFiOdhvKzKrNabXibit1CsgcI0CxMZEMsuK4-LPCA9h_Zc2vNgvqOQFvmhiMzDFw4B21H9IA-xzONkkdv-cYoeo1WhkyoH8HlNXkP5epY65HHO5jnsViSpiLjg0dF-1S5nE7OWVuRDELfZIKPUSjOb-Scrv67tHdVm-t3BNLrDdizbu7A_kCj7225fqT9Yc_3BjPrD0Xfk6DjyrOoOL3GERNmf-O5KjpzmHDlGjlx9R66Oo7ZV3eEljpAo-xN3ruTIbc6Ra-TI03fk6Ti6sy40hATZn7d7JUNec4a8xr6EX5SZcJmlieRa37lWGZRHL7w-lUwLseCPIl1UZerHccVVf0Rc5vVbVj8MkvpVGfAjzE5h9hF2jmD2PbhtAndNYGaUm_lq2lHet6uGXbWsttqWp6R9NeybqFbDiGo1jKhWw5hqhEZUt01U3ynhjlpWx0SWGkZkqWFElhrGZCE0IqtrIoshUxQbo2Zz1GyQmk1Sw1FqNkuZ0TBlyDT1EGmfxum3pKlpTJqaxqSpaVQagmPSPg1VpbT57sf_AAAA__-kuPbl +distribution: full +vectorized: true +· +• distinct +│ distinct on: x, y, z +│ +└── • scan + missing stats + table: xyz@primary + spans: FULL SCAN +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJy8lU1v4jAQhu_7K6w5tZKj4MThIydWLSshsdAFDiutOKTEaiPROBsHiQ_x31cJKyi0eFwcccMkj-e1n9FkC-rvAkLo_X4afO8Pyd1jfzKd_Brck0lv0HuYknLdHz5MyWhI7laUrCnZ3JP_P8iP8egnWa03QCGVsRhGb0JB-AcYUPCAgg8UOFAIYEYhy-VcKCXz8pVtBfTjFYQNCkmaLYvy7xmFucwFhFsokmIhIIRp9LwQYxHFIncbQCEWRZQsqjKr9aab5clblK-BwiSLUhUSxy0rj5ZFSLoe7fq0y2G2oyCXxbGIKqIXASHbUfMgj4kqknReuMFpii6jVaGzKkfweU1eI_V6kTrm8S7mOe62TGUei1zEJ_tVu1xMzBpGkY9B_HqDDKUjM5cFZ29-Xpuf1Gbm3cEMusP1HJdf2R9IlMNtN2_UH6y-_mBW_eGZO_JMHHGnusNrHCFRDidu3ciRV58jz8qRb-7IN3HUdKo7vMYREuVw4vaNHPn1OfKtHHFzR9zEUcu50hAS5HDezo0M8foM8dq-hJ-UGQuVyVQJo-9cowwq4hexP5WSy3wunnI5r8rsl6OKq_6IhSr2T9l-0U_3j8qA72F2DrP3sHcCs6_BTRu4YwMzq9ws0NOe9r59PezrZTX1triWDvRwYKNaDyOq9TCiWg9jqhEaUd20Ud3Swm29rLaNLD2MyNLDiCw9jMlCaERWx0YWQ6YoNkbt5qjdILWbpJaj1G6WMqthypBpyhFpH8bpl6TpaUyansak6WlUGoJj0j4MVa202e7bvwAAAP__i4nxhg== # Ensure that ordering propagates past local DISTINCT processors. query T @@ -113,9 +124,24 @@ vectorized: true spans: FULL SCAN query T -SELECT url FROM [EXPLAIN (DISTSQL) SELECT DISTINCT ON (x,y,z) x, y, z FROM xyz ORDER BY x] +EXPLAIN (DISTSQL) SELECT DISTINCT ON (x,y,z) x, y, z FROM xyz ORDER BY x ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJzElk9v4jwQh-_vp7Dm1Oo1CnbCn-bEbstKSF3oAoddVRxSYrVIFLN2kKCI775KgpRCykxIkLgR4PGM5_dolC3Yv3PwYdR97N6P2crM2Y_h4Cd77v5-evzW67Obh95oPPr1eMv2f4mfe_37MRv02c2asw1nH7ds_yGF15sPNhg-dIfs-x-2ngCHhQ5VP3hXFvxnEMBBAgcXOHjAoQETDkujp8pabeK_bBOgF67Br3OYLZarKP56wmGqjQJ_C9EsmivwYRy8zNVQBaEyTh04hCoKZvOkzHrz0Vma2XtgNsBhtAwW1mc1J648WEU-60jecXnHg8mOg15FWREbBa8KfLHjxRsZaRMp4zQOe-iI_08eL885_mFmo9liGjmiflyBJxeJb2VCZVTos444Kpqd87Jhb4F9O3HGZJe1555sLztNpxW_ujN6h9yUCtwh68y7eGd9XdNLRx6O9lT5xkF5UdxPUcBPR9Ycr6ShRCt7Q5tlDSWOz9IVVzFUXNTQ3JQqGCqLKyKLKOLVkhDLKEK0slekVVYR4vhsvPIqisiLKpKbUgVF3OKKuEUUadaSEMsoQrSyV6RdVhHi-Gy87lUUcS-qSG5KFRTxiiviFVGkVSspCNHIXpC7soIQx2fD9a4iiHdRQXJTutCL0BdFh8ou9cKqQu849bhtFb6q9JpWr8xUPRk9Tcqkj4OES74IlY3SX0X60FukP8UNfoYFCksclsew-Ay7B7A4D25XgYWsRDer0LKO0y46cA-HPTwtIusGSjdxuInCLRxuVREFhwlRcJgShaAJUXCaEqVdRZQ7fCfUiaVArBRqp-SWyjlxEzSRN0FTgVM4kTiBU5GL3Go5J3OBrxbhEanhy0U0CDy3Xc4KHaep0HGaDJ3AqdBxnAwd36xU6Lklc5ham0gN3zLijsBze-as0HGaCh2nydAJnAodx6nQJb5hj0Of7P77FwAA__8PIyWL +distribution: full +vectorized: true +· +• distinct +│ distinct on: x, y, z +│ order key: x +│ +└── • sort + │ order: +x + │ + └── • scan + missing stats + table: xyz@primary + spans: FULL SCAN +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJzEls9u2kAQh-99itWcEnWR2bX5E59oEyohpZACh1YVBwevEiTC0l0jQRDvXtkgOeAwY2xL3GKcb2d2fp9G3oL9Nwcfur-fHr_1-uzmoTcaj3493rJR97F7P2bxc69_P2aDPrtZc7bh7P2WHf5gP4aDn2y9eWeD4UN3yL7_YWvgsNCh6gdvyoL_FwRwkMDBBQ4ecGjAhMPS6KmyVpv4X7YJ0AvX4Nc5zBbLVRT_POEw1UaBv4VoFs0V-DAOnudqqIJQGacOHEIVBbN5Uma9ee8szewtMBvgMFoGC-uzmhNXHqwin3Uk77i848Fkx0GvorSIjYIXBb7Y8fyNjLSJlHEaxz10xNezx8tLjn-Y2Wi2mEaOqJ9W4MlF4luZUBkV-qwjToqm5zxv2GtgX8-cMdml7bln20tP0_uKn90ZvUNmSjnukHbmVd5ZX9f00pHHoz1XvnFUXuT3U-Tw05E1xytoKNHKwdBmUUOJ49N0xVUMFZUamplSCUNlfkVkHkW8WhJiEUWIVg6KtIoqQhyfjldeRRFZqSKZKZVQxM2viJtHkWYtCbGIIkQrB0XaRRUhjk_H615FEbdSRTJTKqGIl18RL48irVpBQYhGDoLcFRWEOD4drncVQbxKBclMqaIPoU-KDpVd6oVVub5x6nHbKnxR-2tavTJT9WT0NCmzfxwkXPJDqGy0fyv2D73F_lXc4EdYoLDEYXkKi4-wewSLy-B2GVjIUnSzDC3rOO2iA_dw2MPTIrJuoHQTh5so3MLhVhlRcJgQBYcpUQiaEAWnKVHaZUS5w3dCnVgKxEqhdkpmqVwSN0ETeRM0FTiFE4kTOBW5yKyWSzIX-GoRHpEavlxEg8Az2-Wi0HGaCh2nydAJnAodx8nQ8c1KhZ5ZMseptYnU8C0j7gg8s2cuCh2nqdBxmgydwKnQcZwKXeIb9jT0ye7L_wAAAP__kRUgLA== # Ensure that even with more ordering columns, ordering propagates past local # DISTINCT processors. @@ -145,9 +171,24 @@ vectorized: true spans: FULL SCAN query T -SELECT url FROM [EXPLAIN (DISTSQL) SELECT DISTINCT ON (y) x, y FROM xyz ORDER BY y, x] +EXPLAIN (DISTSQL) SELECT DISTINCT ON (y) x, y FROM xyz ORDER BY y, x ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJy8lk1v2kAQhu_9Fas5Jcois2vzEZ9oEyohpZACh1YRBwevEiSC3V0j4UT898o2kgMOMzZGHP3xeGbnfTTyB5h_S3Bh0n_o303ZWi_Zz_HoF3vq_3l8-D4Ysqv7wWQ6-f1wzXavJNeD4d2UjYbsKr5mG87ijNnE72w0vu-P2Y-_LOZsMwMOq8BXQ-9NGXCfQAAHCRxs4OAAhxbMOIQ6mCtjAp288pECA38DbpPDYhWuo-T2jMM80ArcD4gW0VKBC1PveanGyvOVtprAwVeRt1imZTbxey_UizdPx8BhEnor47KGlVQerSOX9STv2TDbcgjWUV7BRN6LAldsefkuJoGOlLZa-w305A3viZujJWSVEvcLEy1W88gSzcMqyYG0r7Tyk0MdlMu_8ByzV8-8FujZNm_JPtpS_p0gq3XsrGjvhQmhved9OTX6-rqnYdAIQkvuD_NY-dZeeVFeSVFCSUs2LOcUKYk-dlK260hJlMiDFReTUpxdysKETpJSlrdClrHCaaTRVbaC6GNnRaeOFUSJfLLyYlbIs1tRmNBJVtjlrbDLWNFupNFVtoLoY2dFt44VRIl8svbFrLDPbkVhQidZ4ZS3wiljRadxihNEFzsnbus4QZTI5-pczAnn7E4UJlT7p-aLcmNlwmBlVKn_lWbSsPJfVHZIE6z1XD3qYJ6WyS5HKZfe8JWJsqciuxisskdJg59hgcISh-UhLD7D9h4sqsHdOrCQteh2HVo2cdpGB-7gsIOnRWTdQuk2DrdRuIPDnTqi4DAhCg5TohA0IQpOU6J064hyi--EJrEUiJVC7ZTCUqkSN0ETeRM0FTiFE4kTOBW5KKyWKpkLfLUIh0gNXy6iReCF7VIpdJymQsdpMnQCp0LHcTJ0fLNSoReWzH5qXSI1fMuIWwIv7JlKoeM0FTpOk6ETOBU6jlOhS3zDHoY-2377HwAA__8VCBZB +distribution: full +vectorized: true +· +• distinct +│ distinct on: y +│ order key: y +│ +└── • sort + │ order: +y,+x + │ + └── • scan + missing stats + table: xyz@primary + spans: FULL SCAN +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJy8ll9r4kwUxu_fTzGcq5aOxJnEP82V77YuCF3tqhe7LF6kZmgF67gzEUzF774kCqmmnpMY8TK1P5-T8_w4uAH7dw4-dH89P_3f67Obx95oPPr5dMtG3afuw5glz73-w5gN-uwmvmVrzmL2fTj4wdbxBxsMH7tD9u03izlbA4eFDlU_eFcW_D8ggIMEDi5w8IBDAyYclkZPlbXaJP-ySYFeuAa_zmG2WK6i5M8TDlNtFPgbiGbRXIEP4-BlroYqCJVx6sAhVFEwm6cx6_ijszSz98DEwGG0DBbWZzUnSR6sIp91JO-4MNly0KsoS7BR8KrAF1tefIqRNpEyTuNwgI684x1xdzJClol4nNlotphGjqgfpyQvZEJlVJi81FFc9g0vMXsL7FuOnmyzkdyTI2Xfo3dZp94VnT23IXT2bC6vwlxfz9TXNb105OEyT8U3DuJFcSVFASUdWXO8c6Qk5thL2awiJRGRFSuuJqW4uJS5DZ0lpSxuhSxihVdLqyttBTHH3opWFSuIiGyz8mpWyItbkdvQWVa4xa1wi1jRrKXVlbaCmGNvRbuKFUREtln3ala4F7cit6GzrPCKW-EVsaJVO8cJYoq9E_dVnCAisr16V3PCu7gTuQ1V_lHzRdxQ2aVeWFXo90o9GViFr2r3klavzFQ9Gz1NY3aPg5RL_xAqG-0-FbuH3mL3UTLgZ1igsMRheQyLz7B7AItycLsKLGQlulmFlnWcdtGFezjs4W0RXTdQuonDTRRu4XCriig4TIiCw5QoBE2IgtOUKO0qotzjN6FOHAXipFA3JXdUytRN0ETfBE0VTuFE4wROVS5yp6VM5wI_LcIjWsOPi2gQeO66lCodp6nScZosncCp0nGcLB2_rFTpuSNz2FqbaA2_MuKewHN3plTpOE2VjtNk6QROlY7jVOkSv7DHpU-2__0LAAD__xPOEOI= # Distinct processors elided becaue of strong key. query T @@ -163,9 +204,17 @@ vectorized: true spans: FULL SCAN query T -SELECT url FROM [EXPLAIN (DISTSQL) SELECT DISTINCT ON (a,b,c) a, b, c FROM abc] +EXPLAIN (DISTSQL) SELECT DISTINCT ON (a,b,c) a, b, c FROM abc ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJykk0-L2zAQxe_9FOKddkHG8Z_04FPLNgWD62yTFAobHxRr2Aa8livJ0BLy3YvlpfnTtCjNZfCT5vn9GEY7mO8NMixnxexhxXrdsI-L-Sf2NPv6WLzPS3b3IV-ulp-Le_baMui8fFixecnuBGcbzup79voxmsWmrsDRKkmleCGD7AkROGJwJOBIwTFFxdFpVZMxSg8tO2fI5Q9kE45t2_V2OK44aqUJ2Q52axtChpXYNLQgIUmHw38lWbFtXIzY1O86vX0R-ic4lp1oTcbC8ktRHEoQrhGt8bvGa6Dac6jeHjKNFc-ELNrzv3AdcPpWaUma5AlKtb9AXqpAdeH0rPFydHwSHfmPJPYZyR8jCI7FVVOJ_dGSa9DiY7RRJK6m3miJP1rqh3bGERyLcI2pN1rqjzbxQAvOlpyJVrKIKfuN9H9s9wWiBZlOtYa8lncybD_JZxqfilG9rulRq9rFjHLufO5AkrHjbTSKvHVXDvDYHP3T_PbEPDk3x7ckJ7eY01vM06vM1f7NrwAAAP__dnDXkQ== +distribution: full +vectorized: true +· +• scan + missing stats + table: abc@primary + spans: FULL SCAN +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJykk0-L2zAQxe_9FOKddkHG8Z_04FPLNgWD62yTFAqND4o1bAOJ5UoKtIR892K5NI6bFqW5DH7SPL8fw-gI822HDLPPz8XbvGQP7_LlavmxeGTLWTF7WrFO5-XTis1L9iA423BWP7JfH-z9Yv6BiU0NjkZJKsWeDLIviMARgyMBRwqOKSqOVquajFG6azk6Qy6_I5twbJv2YLvjiqNWmpAdYbd2R8iwEpsdLUhI0mH3X0lWbHcuRmzqN63e7oX-AY5lKxqTsbD8VBTnEoRrRGv8rvEaqE4c6mDPmcaKF0IWnfhfuM44h0ZpSZrkBUp1ukJeqkC14XTUeD06voiO_EcS-4zkjxEEQ3HTVGJ_tOQWtHiI1ovE1dQbLfFHS_3QRhzBUIRrTL3RUn-0iQdaMFpyJhrJIqbsV9L_sd1XiBZkWtUY8lreSbf9JF-ofypGHXRNz1rVLqaXc-dzB5KM7W-jXuSNu3KAQ3P0T_PrC_NkbI7vSU7uMaf3mKc3mavTq58BAAD__1Um0jI= query T EXPLAIN (VERBOSE) SELECT DISTINCT ON (a, b) a, b FROM abc ORDER BY a, b, c @@ -192,6 +241,18 @@ vectorized: true spans: FULL SCAN query T -SELECT url FROM [EXPLAIN (DISTSQL) SELECT DISTINCT ON (a, b) a, b FROM abc ORDER BY a, b, c] +EXPLAIN (DISTSQL) SELECT DISTINCT ON (a, b) a, b FROM abc ORDER BY a, b, c ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJy8lk9v4jwQxu_vp7Dm1KpG4PyhbU6827ISEgtdYKVdFQ4msVokGrN2kLaq-O6rJCsgFDxGVrhYGifP-Bn_RpN8gP69hAjG3X73YULWakm-jobfyHP351P__96AXD32xpPx9_41-fdKHvcGDxMyHJArTsn8muRrKePzmAxHj90R-fKr2KYkngGFVCZiwN-EhugZGFDwgIIPFAKgEMKMwkrJWGgtVf7KRyHoJX8galFYpKt1lm_PKMRSCYg-IFtkSwERTPh8KUaCJ0I187yJyPhiWRzD53FnpRZvXL0DhfGKpzoizcGPfn-3NJpTYFPYrt4UYLahINfZ7kyd8RcBEdtQe1-PC50t0jhrtqumOox28tqHKhFKJBEpN6pn7tLM38kr16_Hcsw2O2veSWu7VLI88TDVDe14N7Tj35QJT9bBmFUhFIbr7HhVO7u-o93jVgeyIVdNFlYkpywEFQvMvsk8myb71FSN_eCsPkOsbfncXr7PWC195tXVZ549ZP8cyN4-5DLwizWwhoxY217O3eUhe7VA9uuC7NtDDuwgHxBt7AfNKYTWkBFr28u5vzxkvxbIQV2QA3vILQvIjYOfAsLThDAis1ehLNkijrZ3El6ebVAL29Yl_gaOOBgJvZKpFlYf-VZeg0heRFm7lmsViycl4-KYMhwWumIjETorn7Iy6KXlo9zgvpgdillFHFbU7Dy15yJuu4jvXcQM8e0Z79s3i30zrLaZVmBUh2Zx6ITarEauzCxGUJvFCGqkaMR32wX1rVF8Z4Z15wTLrEaKNosRWGYxAgspGvF97wKLIVMUG6OOc9RtkLpNUrdR6jZLmdMwZcg0DRBon8bpedDMcqxysxqDZlZj0JDCMeufhqoR2mzz398AAAD__w5OR9U= +distribution: full +vectorized: true +· +• distinct +│ distinct on: a, b +│ order key: a, b +│ +└── • scan + missing stats + table: abc@primary + spans: FULL SCAN +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJy8lk9v4jwQxu_vp7Dm1KpG4PyhbU6827ISEgtdYKVdLRxMYrWRaJyNg7RVxXdfJZEIodRjZIWLpXF4xs_4Nxr8DurPBgIY_nwa_z-akKvH0Xwx_z6-JvPhePiwIEU8mjwsyHRCrjgl62tSrOTrbPqN8HVIprPH4Yx8-VVuUxIChURGYsJfhYLgNzCg4AAFFyh4QMGHFYU0k6FQSmbFT95LwSj6C0GPQpyk27zYXlEIZSYgeIc8zjcCAljw9UbMBI9E1i3yRiLn8aY8hq_DQZrFrzx7AwrzlCcqIN3Jj_G4XjrdJbAl7FdnCbDaUZDbvD5T5fxZQMB21NzXY6zyOAnzbr9pasDooKh9mkUiE1FAqo3mmXWa9Rt54erlVI7VrrbmfGqtTiWrE49T3dCBc0MH7k2V8NM6GDMqhMJ0m5-uqrbrWto9bXUiOzLtMr8h-cyC17DAzJvMMWmyD03VOQzO6jPE2p7P7eX7jLXSZ05bfeaYQ3bPgewcQq4Ct1w9Y8iItf3l3F0estMKZLctyK45ZM8M8hHRzmHQXYJvDBmxtr-c-8tDdluB7LUF2TOH3DOA3Dl6FBCeRIQRmb-IzJAt4mh_J_7l2XqtsO1d4jVwwsFMqFQmShj9yfeKGkT0LKraldxmoXjKZFgeU4XTUlduRELl1VdWBaOk-lQYPBSzYzFriP2Gmp2ndmzEfRvxvY2YIb4d7X27erGrh9XX0_K0al8v9q1Q69XIlenFCGq9GEGNFI347tugvtWK7_Sw7qxg6dVI0XoxAksvRmAhRSO-721gMWSKYmPUco7aDVK7SWo3Su1mKbMapgyZph4C7cM4PQ-aXo5Vrldj0PRqDBpSOGb9w1DVQlvt_vsXAAD__-9NQnY= diff --git a/pkg/sql/opt/exec/execbuilder/testdata/distsql_indexjoin b/pkg/sql/opt/exec/execbuilder/testdata/distsql_indexjoin index e2e71602a187..449006848a5d 100644 --- a/pkg/sql/opt/exec/execbuilder/testdata/distsql_indexjoin +++ b/pkg/sql/opt/exec/execbuilder/testdata/distsql_indexjoin @@ -23,23 +23,73 @@ NULL /10 {1} 1 /40 NULL {5} 5 query T -SELECT url FROM [EXPLAIN (DISTSQL) SELECT * FROM t WHERE v > 10 AND v < 50] +EXPLAIN (DISTSQL) SELECT * FROM t WHERE v > 10 AND v < 50 ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJyUUE9L-0AQvf8-xTCn9sdKNxVB9tRiUwzUtCYBhZrDmgwlkGbj7kaUku8uybbWChU9znvz_vB2aF5KFBj7C_8mgUaXMI-Wd7D2H1eLaRDCYBbESXy_GML-5b97sPBw60c-DF7hqeH8ksDjQ5iGs08kgys-TJFhpXIK5ZYMijV6mDKstcrIGKU7aNc_BPkbCs6wqOrGdnDKMFOaUOzQFrYkFJjI55IikjnpEUeGOVlZlL2tndS62Er9jgzjWlZGwAWmLUPV2KOhsXJDKLyW_T50XpSWNOmRd5rocAGDyfi4gBAiCJPr_RAHplviwJwtNf5LqYhMrSpDJ5XOOfM2ZUj5htzaRjU6o5VWWR_jzmWv64GcjHWs546gclRX8KvY-1E8_iZO238fAQAA___oe8It +distribution: full +vectorized: true +· +• filter +│ filter: (v > 10) AND (v < 50) +│ +└── • scan + missing stats + table: t@primary + spans: FULL SCAN +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJyUUE9L-0AQvf8-xTCn9sdKNxVB9tRiUwzUtCYBBc1hTYYSSLNxdyNKyHeXZK21QkWP8968P7wWzXOJAv37zWoehDBaBHES367GEPsr_yqB_7CM1jdg4e7aj3wYvcBjw_k5gcfHMA8Xn0gGF3yMDCuVUyh3ZFA8oIcpw1qrjIxRuofa4SHIX1FwhkVVN7aHU4aZ0oSiRVvYklBgIp9KikjmpCccGeZkZVEOtnZW62In9RsyjGtZGQFnmHYMVWMPhsbKLaHwOvb70GVRWtKkJ95xosMFjGbTwwBCiCBMLj922DP9EHvmZKnpX0pFZGpVGTqqdMqZdylDyrfk1jaq0RlttMqGGHeuB90A5GSsYz13BJWj-oJfxd6P4uk3cdr9ew8AAP__FVC8zg== query T -SELECT url FROM [EXPLAIN (DISTSQL) SELECT * FROM t WHERE v > 10 AND v < 50 ORDER BY v] +EXPLAIN (DISTSQL) SELECT * FROM t WHERE v > 10 AND v < 50 ORDER BY v ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJyUkVFr6kAQhd_vrxjmSe_di0mkUPZJWyMN2GiTQFtsHtJkkEDMprsbaZH895Ks1lpQ6uOeM-ebw-wW1VuBHEN35t5GUMsCpsH8Hpbu02I29nzoTbwwCh9mfdiN_DUDGh7v3MCF3gZeassaEthWH8b-5EtJ4crqwzyYuAHcPMMmRoalyMhP1qSQL9HGmGElRUpKCdlK227Ay96RWwzzsqp1K8cMUyEJ-RZ1rgtCjlHyWlBASUZyYCHDjHSSFx1WjyqZrxP5gQzDKikVh_8YNwxFrQ9ApZMVIbcb9vul07zQJEkO7OONRufQGzmHY3DOPT-63t1k77RH2TsnSzmXlAqF1CQHznGlkfPvJH54CT4gVYlS0RH-FNlqYoaUrch8phK1TGkhRdqtMc95l-uEjJQ2rm0eXmmstuD3sH027JwPO2fDwx_huPnzGQAA__9gPfgb +distribution: full +vectorized: true +· +• sort +│ order: +v +│ +└── • filter + │ filter: (v > 10) AND (v < 50) + │ + └── • scan + missing stats + table: t@primary + spans: FULL SCAN +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJyUkUFLw0AQhe_-imFOra40SRFkT602xUBNaxJQ0RzWZCiBNBt3N0Up-e-SxFortNjjvLfvm8fsBvV7jhzdp8Vs7PnQm3hhFD7M-hC6M_c2gnOYBvN7MPB45wYu9NbwWlnWkMC2-jD2Jz9KAldWH-bBxA3g5hnWyLCQKfliRRr5C9oYMyyVTEhrqRpp0z7w0g_kFsOsKCvTyDHDRCpCvkGTmZyQYyTecgpIpKQGFjJMyYgsb7FmVKpsJdQnMgxLUWgOlxjXDGVldkBtxJKQ2zX7_9JplhtSpAb2_sZO59AbObtbcM49P7r-PsnWaW6ydQ6Wck4pFUplSA2c_Uoj5-IgfngKPiBdykLTHv4Q2apjhpQuqftMLSuV0ELJpF3TjfM21wopadO5djd4RWc1BX-H7aNh53jYORoe_gnH9dlXAAAA__8M7_K8 # Here we care about ordering by v, but v is not otherwise used. query T -SELECT url FROM [EXPLAIN (DISTSQL) SELECT w FROM t WHERE v > 10 AND v < 50 ORDER BY v] +EXPLAIN (DISTSQL) SELECT w FROM t WHERE v > 10 AND v < 50 ORDER BY v ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJyUUV2Lm0AUfe-vuNynhE6JoxTKPJk2hgqppiq0JfXB6iUIxrEzY3aX4H9f1GSzWUjYPM4593xw5oD6f4UCY2_lfUugVRUso_AHbLzf69XcD2Cy8OMk_rmawvHkYTww8Ou7F3kw2cPf1rIcAm5NYR4sXpAcPltTCKOFF8HXP7BPkWEtCwqyHWkUG-SYMmyUzElrqXroMBz4xSMKi2FZN63p4ZRhLhWhOKApTUUoMMn-VRRRVpCaWciwIJOV1WBr3EaVu0w9IcO4yWot4BMyDFsjwLWZ62DaMZStObtrk20JBe_Y-xssy8qQIjXjl_EjLmDi8vMyQgg_SL4cBzox_UIn5mop-55SsVSG1My-rOTyj-cBrgY59wRFpBtZa7oIuuZsdSlDKrY0_rGWrcpprWQ-xIzPcNANQEHajCwfH349Un3B12J-U2zfFts3xc4bcdp9eA4AAP__RgD97A== +distribution: full +vectorized: true +· +• sort +│ order: +v +│ +└── • filter + │ filter: (v > 10) AND (v < 50) + │ + └── • scan + missing stats + table: t@primary + spans: FULL SCAN +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJyUUV1ro0AUfd9fcblPCTtLHGVhmSezG8MKWc2qsFtaH6xegmAcOzOmLcH_XtSmaQoJzeM9Z84HZ_aoHyoU6P1fr-Z-AJOFHyfx39UUYm_l_UrgEZZR-AcM_PvtRR5MdnDXWpZDwK0pzIPFG5LDd2sKYbTwIvh5AztkWMuCgmxLGsUtckwZNkrmpLVUPbQfHvjFEwqLYVk3renhlGEuFaHYoylNRSgwye4riigrSM0sZFiQycpqsDVuo8ptpp6RYdxktRbwDRmGrRHg2sx1MO0YytYc3bXJNoSCd-zzDZZlZUiRmvHT-BEXMHH5cRghhB8kP173OTD9QAfmbCn7mlKxVIbUzD6t5PKvxwHOBjnXBEWkG1lrOgk652x1KUMqNjT-sZatymmtZD7EjGc46AagIG1Glo-HX49UX_C9mF8U25fF9kWx80Gcdl9eAgAA__92zfiN # The single join reader should be on node 5, and doesn't need to output v. query T -SELECT url FROM [EXPLAIN (DISTSQL) SELECT w FROM t WHERE v > 40 AND v < 50 ORDER BY v] +EXPLAIN (DISTSQL) SELECT w FROM t WHERE v > 40 AND v < 50 ORDER BY v ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJyUkUHPmkAQhu_9FZM5abKGBfSyJ22lKY0FCyZtYzlQmBgSZOnuYtsY_nsDGKsm0u877jvvMw8Zzqh_ligw9jbeux00qoT3UfgJ9t7X7WblBzBZ-_Eu_ryZwqXyaygY-PLBizyYnOB7w7lLMOdTWAXra5LBgk8hjNZeBG-_wSlBhpXMKUiPpFHs0UaGC0wY1kpmpLVUXXzuS37-GwVnWFR1Y7o4YZhJRSjOaApTEgoM5EzWloMMczJpUfa1lqFszD9Im_RAKNyW3Sy2xxfv0h8lRZTmpCx-tx7N8oQM4zqttABrbs-sRdcIGyNgaeMzvf0a_UdZVBe7_WivVXFM1Z-r0n2qdO6U_zllRLqWlaYX3ZK3CUPKDzT8Li0bldFWyazXDM-w5_ogJ22GqTs8_GoYdR94C9ujsDMOO6Mwf4CT9s3fAAAA___99PGJ +distribution: full +vectorized: true +· +• index join +│ table: t@primary +│ +└── • scan + missing stats + table: t@v + spans: [/41 - /49] +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJyUkVGPmkAQx9_7KSbzpMkaFtCXfdJWmtJYsGDSNi0PFCaGBFm6u9i7GL77Bbh4aiJ39zj_md_8YPaE-l-JAr2f283KD2Cy9uNd_H0zhdjbeJ928B8-R-E3MPDjixd5MDnCn4Zzl2DOp7AK1uckgwWfQhitvQg-_oIjMqxkTkF6II3iN9rIcIEJw1rJjLSWqotP_ZCfP6DgDIuqbkwXJwwzqQjFCU1hSkKBgZzJ2nKQYU4mLcp-rGUoG_MCaZPuCYXbsovF9vjiXfq3pIjSnJTFr9ajWXa_EddppQVYc3tmLbqJsDECljbe09vv0X-VRfVst2_ttSoOqXo8K927SudK-copI9K1rDS96Za8TRhSvqfhubRsVEZbJbNeM5Rhz_VBTtoMXXco_GpodR94CdujsDMOO6Mwv4GT9sNTAAAA__82C-wq diff --git a/pkg/sql/opt/exec/execbuilder/testdata/distsql_inverted_index b/pkg/sql/opt/exec/execbuilder/testdata/distsql_inverted_index index 246326102d4a..949a9c2992e2 100644 --- a/pkg/sql/opt/exec/execbuilder/testdata/distsql_inverted_index +++ b/pkg/sql/opt/exec/execbuilder/testdata/distsql_inverted_index @@ -69,26 +69,86 @@ NULL /10 {1} 1 # Filter with a fully-specified array. This should use a zigzag join. query T -SELECT url FROM [EXPLAIN (DISTSQL) -SELECT a FROM json_tab WHERE b @> '[1, 2]' ORDER BY a] +EXPLAIN (DISTSQL) +SELECT a FROM json_tab WHERE b @> '[1, 2]' ORDER BY a ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJyUkk9v1DAQxe98itFcCsLSxtmbT6E0iK2WTUkq8WeJKjcZIpfUE2wHAat8d5QEFRbaVfc48-a995PlHfqvLSos0nX68hJ618KrPHsD2_T9xfrFagNPz1bFZfF2_Qx-n-j54MazvQr6Gt69TvMUriH51EfRkuBkKwXE5Qlk-Vmaw-kH0CUKtFzTRt-SR7VFiaXAznFF3rMbV7vpYFV_RxUJNLbrw7guBVbsCNUOgwktocKPpvmpm3M2ltwiQoE1BW3aKbcwNUGk7uCSz8xXxn5DMUvyXinrg4JEYjkI5D78qfZBN4RKDuLxeCNYTromt5D7cHfNnTO32v1AgWvmL30HN2wssJ0gBGYbSJb_PadS6rzINqeP4I2P4S3YBXKLeJ81kc8fjF8eE5-T79h62ot_KDkaSoFUNzT_CM-9q-jCcTXVzGM2-aZFTT7MqpyHlZ2lEfBvszxojg-b44Pm5T_mcnjyKwAA___NrxBc +distribution: full +vectorized: true +· +• sort +│ order: +a +│ +└── • lookup join + │ table: json_tab@primary + │ equality: (a) = (a) + │ equality cols are key + │ pred: b @> '[1, 2]' + │ + └── • zigzag join + left table: json_tab@foo_inv + left columns: (a) + left fixed values: 1 column + right table: json_tab@foo_inv + right columns: () + right fixed values: 1 column +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJyUkk1v1DAQhu_8itFcCsLSxtmbT6E0iK1CUpJKfJSocpMhctl6gu0gYJX_jpJIhQW66h5n3jzvPIq8Q_91iwrT9xfZi00OT8821WX1NnsGVZqlLy9Bw6uyeAO3nu110Dfw7nVapnADyachitYEJ1dSQFyfQFGepSWcfgCNAi23lOs78qiuUGItsHfckPfsptVu_mDTfkcVCTS2H8K0rgU27AjVDoMJW0KFH033U3fnbCy5VYQCWwrabOfeyrQEkbp3Sz4zXxv7DcUSyf9GxRAUJBLrUSAP4fdpH3RHqOQoHq83iZWkW3IruS93f7l35k67HygwY_4y9HDLxgLbWUJgkUOy_udvKqXOqyI_fYRvfIxvxS6QW8X7rol8_mD9-pj6knzP1tNe_UPN0VgLpLaj5UV4HlxDF46b-cwyFjM3L1ryYUnlMmzsEk2Cf8LyIBwfhuOD8PovuB6f_AoAAP__JdwK_Q== # Combine predicates with AND. Should have the same output as b @> '[1, 2]'. # This should use a zigzag join. query T -SELECT url FROM [EXPLAIN (DISTSQL) -SELECT a FROM json_tab WHERE b @> '[1]' AND b @> '[2]' ORDER BY a] +EXPLAIN (DISTSQL) +SELECT a FROM json_tab WHERE b @> '[1]' AND b @> '[2]' ORDER BY a ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJyUUl1v00AQfOdXrPalqTgpPuftntwSI1IFu9iV-AhWdY2X6Ep6a-7OCIjy35HtqtSojZrHm9mZnVndDv2PLSos02X65gpat4W3Rf4eVumny-XZIoPJfFFelR-Wp3A_ooeBW8_2Ougb-PguLVKY3EDytY2iGcHJSlYnp3CWzcdo3KF5MU8LOP8MukKBlmvK9B15VCuUWAlsHK_Je3YdtOsHFvUvVJFAY5s2dHAlcM2OUO0wmLAlVPjFbP7ozQUbS24aocCagjbb3rc0NUGkHhIn35ivjf2JYqDkk1TeBgWJxGovkNvwb7UPekOo5F68PF4XrCBdk5vKcbiHzY0zd9r9RoFL5u9tA7dsLLDtQwjMM5gks_GNlVIXZZ6d3996RMeP6Be0iY9pU7IL5KbxuEkiXz9rPzvGviDfsPU0sn_OOdpXAqne0PBfPLduTZeO1_2a4Zn3uh6oyYeBlcNjYQeqC_hYLA-K48Pi-KB49p-42r_6GwAA__8MxBzL +distribution: full +vectorized: true +· +• sort +│ order: +a +│ +└── • lookup join + │ table: json_tab@primary + │ equality: (a) = (a) + │ equality cols are key + │ pred: (b @> '[1]') AND (b @> '[2]') + │ + └── • zigzag join + left table: json_tab@foo_inv + left columns: (a) + left fixed values: 1 column + right table: json_tab@foo_inv + right columns: () + right fixed values: 1 column +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJyUUl1v00AQfOdXrPalqTgpPuftntwSI1IFu9iV-ChWdY2X6Ep6a-7OCIj835FtVGpEo-ZxZ25mZ1a3R_9thwrTD5frs1UGs-WqvCrfrU-hTNfpqyvQ8LrI38KdZ3sT9C28f5MWKcxuIfncRtGC4ORaViencJYtp2jco3mxTAs4_wgaBVquKdP35FFdo8RKYON4Q96z66H98GBV_0AVCTS2aUMPVwI37AjVHoMJO0KFn8z2l95esLHk5hEKrClosxt8S1MTROohcPKF-cbY7yhGSv6XytugIJFYdQK5DX9X-6C3hEp24vnx-mAF6ZrcXE7DPWxunLnX7icKXDN_bRu4Y2OB7RBCYJ7BLFlMT6yUuijz7PzPqSd0_Ih-Rpv4mDYlu0BuHk-bJPLlk_aLY-wL8g1bTxP7p5yjrhJI9ZbG_-K5dRu6dLwZ1oxjPugGoCYfRlaOw8qOVB_wsVgeFMeHxfFB8eIfcdW9-B0AAP__VW0XbA== # Filter with a nested array. This index expression is not tight. # This should use a zigzag join. query T -SELECT url FROM [EXPLAIN (DISTSQL) -SELECT a FROM json_tab WHERE b @> '[[1, 2]]' ORDER BY a] +EXPLAIN (DISTSQL) +SELECT a FROM json_tab WHERE b @> '[[1, 2]]' ORDER BY a ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJyUkl9v0zAUxd_5FFf3ZSAsNU7f_BTGguhUmpFM4k-xJq-5VB6Zb7AdBFT57igJGnTaqvXx3nPPOT9Z3mH43qDCKl_mry-h8w28KYt3sM4_XixfLVbw_GxRXVbvly_g74mZDm4Cu6toruHD27zM4RqyL12SzAlO1mspINX6BIryLC_h9BMYjQId17QytxRQrVGiFth63lAI7IfVbjxY1D9RJQKta7s4rLXADXtCtcNoY0Oo8LPd_jbbc7aO_CxBgTVFY5sxt7I1QaLu8LKvzFfW_UAxSfJBqeiigkyi7gVyF_9Vh2i2hEr24ul4A1hJpiY_k_twd82tt7fG_0KBS-ZvXQs3bB2wGyEEFivI5g88qFLqvCpWp08gTo8hrthH8rN0nzaTLx-Nnx8TX1Jo2QXai38sOem1QKq3NP2JwJ3f0IXnzVgzjcXoGxc1hTipchoWbpIGwP_N8qA5PWxOD5rn98y6f_YnAAD__2R8Ecw= +distribution: full +vectorized: true +· +• sort +│ order: +a +│ +└── • lookup join + │ table: json_tab@primary + │ equality: (a) = (a) + │ equality cols are key + │ pred: b @> '[[1, 2]]' + │ + └── • zigzag join + left table: json_tab@foo_inv + left columns: (a) + left fixed values: 1 column + right table: json_tab@foo_inv + right columns: () + right fixed values: 1 column +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJyUkk1v1DAQhu_8itFcCsLSxtmbT6E0iK1CUpJKfCxR5SZD5LL1BNtBwCr_HSWRCovaVXucefO88yjyHv33HSpMP15krzY5PD_bVJfV--wFVGmWvr4EDW_K4h3ceLZXQV_Dh7dpmcI1JF-GKFoTnGy3UkBc1ydQlGdpCaefQKNAyy3l-pY8qi1KrAX2jhvynt202s8fbNqfqCKBxvZDmNa1wIYdodpjMGFHqPCz6X7r7pyNJbeKUGBLQZvd3FuZliBSd3bJV-YrY3-gWCJ5b1QMQUEisR4F8hD-nvZBd4RKjuLxepNYSbolt5KHcneXe2dutfuFAjPmb0MPN2wssJ0lBBY5JOt7_qdS6rwq8tNHGMdPMa7YBXKr-NA2kS8frF8_pb4k37P1dFD_UHM01gKp7Wh5E54H19CF42Y-s4zFzM2LlnxYUrkMG7tEk-C_sDwKx8fh-Ci8_g-ux2d_AgAA__-nIAxt subtest array @@ -126,7 +186,27 @@ NULL /3 {1} 1 # This should use a zigzag join. query T -SELECT url FROM [EXPLAIN (DISTSQL) -SELECT a FROM array_tab@foo_inv WHERE b @> '{1, 2}' ORDER BY a] +EXPLAIN (DISTSQL) +SELECT a FROM array_tab@foo_inv WHERE b @> '{1, 2}' ORDER BY a ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJyUkkFv00AQhe_8itFcCmKleJ0L2pMDNcIoxGUdCUqwqm08RAvpjtldI0rk_45iV5RAG7U3z7x5732ydofh-xYVVvk8f7WEzm_htS7fwSr_eDafFQt4elpUy-r9_BncnJjxwHhvri-iucy-MF9Y9wM-vMl1DpeQfe6SZEpwspMC0v4ESn2aa3h5DqZGgY4bWpgrCqhWKLEW2HpeUwjs96vdcFA0P1ElAq1ru7hf1wLX7AnVDqONW0KFn-zml9m8ZevITxIU2FA0djvkVrYhSNT_lChGTd6tlV1UkEmse4HcxdvyEM2GUMlePBxwj6bJNOQn8hDvtrr19sr4axQ4Z_7WtfCVrQN2A4XAcgHZ9M8fnWk9O19JpVSxWL4Q6c1H_QDw9DHgFftIfpIeQmfy-b3x08fEawotu0AH8fclJ30tkJoNjY8jcOfXdOZ5PdSMYzn4hkVDIY6qHIfCjdIe8G-zPGpOj5vTo-bpP-a6f_I7AAD__5XSF-k= +distribution: full +vectorized: true +· +• sort +│ order: +a +│ +└── • lookup join + │ table: array_tab@primary + │ equality: (a) = (a) + │ equality cols are key + │ pred: b @> ARRAY[1,2] + │ + └── • zigzag join + left table: array_tab@foo_inv + left columns: (a) + left fixed values: 1 column + right table: array_tab@foo_inv + right columns: () + right fixed values: 1 column +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJyUklFv0zAUhd_5FVf3ZSAsNU5fkJ9SWBBBpRlOJRgjmrzmUhk632A7iFHlv6MkiFFg1fbme4_POZ8s7zF83aHC_P3ZclGs4PFpUa2rt8snUOXL_MUaDLzU5Rsw3puby2iusk_Ml9Z9g3evcp3DFWQfuySZE5zspYC0P4FSn-Yanp-DQYGOG1qZawqoLlBiLbD1vKEQ2A-r_XihaL6jSgRa13ZxWNcCN-wJ1R6jjTtChR_s9ofZvmbryM8SFNhQNHY35la2IUjUv5AoJk3-Xyu7qCCTWPcCuYu35SGaLaGSvbg_4ICmyTTkZ_IQ77a69fba-BsUuGT-0rXwma0DdiOFwHIF2fz3gy60XpxfSKVUsVo_E-mvQ30P8PQh4BX7SH6WHkJn8umd8fOHxGsKLbtAB_F3JSd9LZCaLU2fI3DnN3TmeTPWTGM5-sZFQyFOqpyGwk3SAPinWR41p8fN6VHz_C9z3T_6GQAA__-B9BKK diff --git a/pkg/sql/opt/exec/execbuilder/testdata/distsql_join b/pkg/sql/opt/exec/execbuilder/testdata/distsql_join index bd8da1107eee..011c8589a3fc 100644 --- a/pkg/sql/opt/exec/execbuilder/testdata/distsql_join +++ b/pkg/sql/opt/exec/execbuilder/testdata/distsql_join @@ -86,7 +86,7 @@ vectorized: true # · spans ALL · · # # query T -# SELECT url FROM [EXPLAIN (DISTSQL) (SELECT * FROM (SELECT a,b FROM data AS data1) JOIN (SELECT c,d FROM data AS data2 ORDER BY c,d) ON a=c AND b=d ORDER BY c,d)] +# EXPLAIN (DISTSQL) (SELECT * FROM (SELECT a,b FROM data AS data1) JOIN (SELECT c,d FROM data AS data2 ORDER BY c,d) ON a=c AND b=d ORDER BY c,d) # ---- # https://cockroachdb.github.io/distsqlplan/decode.html#eJzElk9v2kwQxu_vp4jm9FbZCu_a_LNUiWsqNanS3ioODt6CJcKitZEaRXz3ChyEbMM-ni6yjwR-3tmZ3-TxO21Mqh-TV51T_IskCVIkKCRBEQka0lzQ1pqFznNjDz8pgYf0D8WBoGyz3RWHP88FLYzVFL9TkRVrTTH9TF7W-lknqbaDgASlukiy9fGYrc1eE_s2S5MiIUFPuyK-m0kxUzTfCzK74uOp54e9vN2tknxVfcwJmQvKi2SpKZZ78W8FDlsUGIpZVCvwfLLinPzD2ELbgQzq97kXM3Xv24TwainnRxmbaqvTq-e3_uWF233Tdqm_mmxzuGKtsWv9u_j_g_70xWbL1fljxQThbnfkf8cLlT-az2Y7UNWxXCthWClBtndN9rIMjAJHt10GcPJpGWQHyyD7XYZRF8ug2g9a9WIio8DxbU0EJ59MVB2YqPo1cdyFiWH7QYe9mMgocHJbE8HJJxPDDkwM-zVx0oWJUftBR72YyChwelsTwcknE6MOTIz6NXHa9avqhYKedb41m1y3egMNDlfS6VKXDcvNzi70d2sWx2PKj09H7vjmk-q8KL8Nyw8Pm_KrQ4Ht4YkPLJUXPfKhVeCmZZ0OKnQFDuqwYjRc8eCJD1xrOJce-dC1hjfo0NnwyD2tyD0t6R7X0Gc_3DDYDzeM9gPQYD_cNNqPkbPjY3fDxz774YbBfrhhtB-ABvvhptF-THz2Y-pjuBsGhrthZDiggeFuGiZAI0AqHZfgn4psJAhHckADywGNNEc48BzgSHTZyBGO6bKRIxzVAQ1cBzSSHeHAdoBD3d0ZKodAd06INmfOSVEuDXVn5SgXh7q7kxTpzolSLo10Z4UpG0e6s-K0ibvzVE6B7pxEbc6cE6lcGurOClUujnRX7lSt6z7f__c3AAD__68_ThQ= # @@ -115,7 +115,7 @@ vectorized: true # · spans ALL · · # # query T -# SELECT url FROM [EXPLAIN (DISTSQL) (SELECT * FROM (SELECT a,b FROM data AS data1) JOIN (SELECT c,d FROM data AS data2 ORDER BY c,d) ON a=c AND b=d ORDER BY a,b)] +# EXPLAIN (DISTSQL) (SELECT * FROM (SELECT a,b FROM data AS data1) JOIN (SELECT c,d FROM data AS data2 ORDER BY c,d) ON a=c AND b=d ORDER BY a,b) # ---- # https://cockroachdb.github.io/distsqlplan/decode.html#eJzElk9v2kwQxu_vp4jm9FbZCu_a_LNUiWsqNanS3ioODt6CJcKitZEaRXz3ChyEbMM-ni6yjwR-3tmZ3-TxO21Mqh-TV51T_IskCVIkKCRBEQka0lzQ1pqFznNjDz8pgYf0D8WBoGyz3RWHP88FLYzVFL9TkRVrTTH9TF7W-lknqbaDgASlukiy9fGYrc1eE_s2S5MiIUFPuyK-m0kxUzTfCzK74uOp54e9vN2tknxVfcwJmQvKi2SpKZZ78W8FDlsUGIpZVCvwfLLinPzD2ELbgQzq97kXM3Xv24TwainnRxmbaqvTq-e3_uWF233Tdqm_mmxzuGKtsWv9u_j_g_70xWbL1fljxQThbnfkf8cLlT-az2Y7UNWxXCthWClBtndN9rIMjAJHt10GcPJpGWQHyyD7XYZRF8ug2g9a9WIio8DxbU0EJ59MVB2YqPo1cdyFiWH7QYe9mMgocHJbE8HJJxPDDkwM-zVx0oWJUftBR72YyChwelsTwcknE6MOTIz6NXHa9avqhYKedb41m1y3egMNDlfS6VKXDcvNzi70d2sWx2PKj09H7vjmk-q8KL8Nyw8Pm_KrQ4Ht4YkPLJUXPfKhVeCmZZ0OKnQFDuqwYjRc8eCJD1xrOJce-dC1hjfo0NnwyD2tyD0t6R7X0Gc_3DDYDzeM9gPQYD_cNNqPkbPjY3fDxz774YbBfrhhtB-ABvvhptF-THz2Y-pjuBsGhrthZDiggeFuGiZAI0AqHZfgn4psJAhHckADywGNNEc48BzgSHTZyBGO6bKRIxzVAQ1cBzSSHeHAdoBD3d0ZKodAd06INmfOSVEuDXVn5SgXh7q7kxTpzolSLo10Z4UpG0e6s-K0ibvzVE6B7pxEbc6cE6lcGurOClUujnRX7lSt6z7f__c3AAD__68_ThQ= @@ -150,26 +150,45 @@ vectorized: true spans: FULL SCAN query T -SELECT url FROM [EXPLAIN (DISTSQL) (SELECT * FROM (SELECT a,b FROM data AS data1) JOIN (SELECT c,d FROM data AS data2 ORDER BY c,d) ON a=c AND b=d ORDER BY b,a)] +EXPLAIN (DISTSQL) (SELECT * FROM (SELECT a,b FROM data AS data1) JOIN (SELECT c,d FROM data AS data2 ORDER BY c,d) ON a=c AND b=d ORDER BY b,a) ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJy8ll1v-jYUh-_3KaxzBatRsBPeIlWiW5lG1UEHvdhUcWGIV5Bowpwgrar63aeERm0I9Yn_hlxVCX7iX3ye05M3iP_dgg_z0f3o10eyV1vy22z6B3ka_fVwfzOekMbteP44__O-SRofa34-rMgvBSXLw51AJILczLO_rEnupin-sWpFSVBexcl0djuakV_-zhY0yXRCGoJck1WT3ExuSWNJrrPb-aolJaK5AAphFMiJeJEx-E_AgAIHCi5Q8IBCBxYUdipayTiOVLrkLQPGwX_gtylswt0-SW8vKKwiJcF_g2STbCX48CiWWzmTIpDKaQOFQCZis822SRMPd2rzItQrUJjvRBj7pOUwIsKAMBIla6mAwnSf-GTI6JDD4p1CtE8-tvvcZflK1iJeF5-fIwsKcSKeJfjsnf5Y8o5NcpcOPdvk_Nvkn4_ah5EKpJJB4WGLlMSWnHj930W8vos2oVQOOyrcVv6TNLKMzWu1eV7nF4Va0VPv_flCrkkp5pFK0hxHZRjyKzpkV9_u4VU4tFPn8eXBJ8JMola0c3j7-JRPRugUIrDqxrEqxjms5fCausUge9cu-_n7hdXcL-zS_YIUI--Xrk2_8OoF55UKzluOW5OsBtl7dtnPLyuvWVZ-aVmRYuSy9mxkdasX3K1UcLfleDXJapC9b5f9_LK6NcvqXlpWpBi5rH0bWb3qBfcqFdxrOZ2aZDXIPrDLfn5ZvZpl9S4tK1KMXNbBuT6bT-wxk_EuCmNZ6Wu4nZ6YDJ7loQJxtFcr-aCiVbbN4XKacdknTiDj5PArP1yMw8NPacDqcM8GZsyK7ljRAz3NDM6Mm8E9G_jozEzpjhU90NP8mG5_pd0C3D6GXS3s6avlaWHO9Ft3bPpDDyP9oYex_kBopD8QGumPrk1_6GGkP_Qw1h8IjfQHQiP90dNa2tdL2rfpj4GN4XoYMVwPY4YjNGI4QmMTwGRslv-TmsxNUxodAkaT0xhHNGelKVJQlXG96Ew_RhDTWWmOmKiO0IjrCI3JjuGI7RiO6V6aoUa662lMdz2N6o7gmO4IjuleGqRF3buI7qWZYqR7aaYY6a6nMd31NKo7gmO6Izime2meGumupzHd9TSqO4JjuiM4pntpqha_tdt63Xlptmh1X7z_9H8AAAD__wzmvEs= +distribution: full +vectorized: true +· +• sort +│ order: +b,+a +│ +└── • hash join + │ equality: (a, b) = (c, d) + │ + ├── • scan + │ missing stats + │ table: data@primary + │ spans: FULL SCAN + │ + └── • scan + missing stats + table: data@primary + spans: FULL SCAN +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJy8lt9u4jgUh-_3KaxzBVujYCf8i1SJ7pbVUnWgA72Y0YgLQzwFiSaME6Spqr77KKFMG0J94jHkqkrwF__i852ePEP8Yw0-DL7c3V4NR6R2PZzeTz_f1kltOrgd_HtP_ib_Tcaffl8KSua7O4FIBLmaZn9ZndyMU_x11YKSoLiKk_HkejAh_3zNFtTJeERqglySRZ1cja5JbU4us9v7VXNKRB0ohFEgR-JRxuB_AwYUOFBwgYIHFFowo7BR0ULGcaTSJc8ZMAx-gt-ksAo32yS9PaOwiJQE_xmSVbKW4MO9mK_lRIpAKqcJFAKZiNU62yYN3N-o1aNQT0BhuhFh7JOGw4gIA8JIlCylAgrjbeKTPqN9DrMXCtE2ed3ubZf5E1mKeJl__h6ZUYgT8SDBZy_0z5K3bJK7tO_ZJucfJn971DaMVCCVDHIPm6UktuTI6_8v4uVNtAqlcthB4dbye1LLMtYv1ephub_I1Yoee--3F3JNSjGNVJLmOChDn1_QPrv4cA-vxKEdO493Dz4SZhQ1oo3Dm4enfDRCKxeBlTeOlTHOYQ2HV9QtBtnbdtlP3y-s4n5h5-4XpBj7fmnb9AsvX3BequC84bgVyWqQvWOX_fSy8opl5eeWFSnGXtaOjaxu-YK7pQruNhyvIlkNsnftsp9eVrdiWd1zy4oUYy9r10ZWr3zBvVIF9xpOqyJZDbL37LKfXlavYlm9c8uKFGMva-9Un81H9pjIeBOFsSz1NdxMT0wGD3JXgTjaqoW8U9Ei22Z3Oc647BMnkHGy-5XvLobh7qc0YHm4YwMzZkW3rOienmYGZ8bN4I4NfHBmpnTLiu7paX5IN9_Tbg5uHsKuFvb01fK0MGf6rVs2_aGHkf7Qw1h_IDTSHwiN9Efbpj_0MNIfehjrD4RG-gOhkf7oaC3t6iXt2vRHz8ZwPYwYrocxwxEaMRyhsQlgMjaL_0lN5qYpjQ4Bo8lpjCOas8IUyanKuF50ph8jiOmsMEdMVEdoxHWExmTHcMR2DMd0L8xQI931NKa7nkZ1R3BMdwTHdC8M0rzubUT3wkwx0r0wU4x019OY7noa1R3BMd0RHNO9ME-NdNfTmO56GtUdwTHdERzTvTBV89_aTb3uvDBbtLrPXv76FQAA__9PLrbs # TODO(radu): rework these tests (the inner ORDER BY aren't useful anymore). # # # Merge joins should be planned for (FULL|LEFT|RIGHT) OUTER joins # # query T -# SELECT url FROM [EXPLAIN (DISTSQL) (SELECT * FROM (SELECT a,b FROM data AS data1) FULL OUTER JOIN (SELECT c,d FROM data AS data2 ORDER BY c,d) ON a=c and b=d ORDER BY a,b)] +# EXPLAIN (DISTSQL) (SELECT * FROM (SELECT a,b FROM data AS data1) FULL OUTER JOIN (SELECT c,d FROM data AS data2 ORDER BY c,d) ON a=c and b=d ORDER BY a,b) # ---- # https://cockroachdb.github.io/distsqlplan/decode.html#eJzEl0Fv2kAQhe_9FWhOrbJVvGNDwFIlLq2UKA1VmpwqDg7eEiTCorWRGkX57xUQhAxh3zqD8NHBb994Zj6_-IVmNjc32ZMpKP1DmhQxKYpJUUKK2jRUNHd2ZIrCuuUta8Fl_o_SSNFkNl-Uyz8PFY2sM5S-UDkpp4ZSussepubWZLlx5xEpyk2ZTaYrm7mbPGXuuZ9nZUaKBosybfW16jMNXxXZRfl26vawh-fWY1Y8Vo_ZSIaKijIbG0r1q_pYge2AAmPVT3YK3DpzHeff1pXGneto93nOVJ_PpE2ID5ayPcq63DiTH_QPvvOdp_tp3Nhc2cls-Yg7jb17npu09eP--ro1uL_7ftu6GlzekKKp-Vt-fjv1yzc3GT9uLysbovxjSD4wBg4aw9ajLe_vO8Xc2K92fs7Vfh0qoVMpQYfvuW4ExBoFdo4LInDegKhPAKJuFsROkyCGjYGDxnAIRA5fMm6EghoFXhyXAuC8oYBPQAE3S8FFkxSEjYGDxnCIgjh8yeJGKKhRYPe4FADnDQXxCSiIm6Wg2yQFYWPgoDEcoiAJX7KkEQpqFNg7LgXAeUNBcgIKkmYp6DVJQdgYOGgMIZ8m73jcmmJuZ4UJ-uKIlu00-dish1XYhRuZX86OVjbry8FKt_pvLzdFuf41Xl9cztY_LQsMF_ckYp2I1CJvBt56Vx1V1BVxtCvmGg3neuKeRLzT8LpqkTcD79jb8MTf8MQrbvtH3faPuuO37kjg8ovBgvvFCC6gFnkjuC68He_6G96VwOUXgwX3ixFcQC3yRnD1vA3Xkb_jeu9VWgcvvfcqrUMIUIM1BWrECJLL3GEE7b1Qq1OLwdT23qh1QAFqsK1AjVBBcpk7gkX700S3Qd_9eYJoEeUJUKN9lSUKksvcIS3-UNEgVbQoVoAa7assWJBc5g5p8WcLg2xhUbawKFuAGuwrUCNakFzmjmhhf7YwyBYWZQtQo88MWbYgucwd0cL-bGGQLVwvW4avn_4HAAD__9-kdhE= # # query T -# SELECT url FROM [EXPLAIN (DISTSQL) (SELECT * FROM (SELECT a,b FROM data AS data1) LEFT OUTER JOIN (SELECT c,d FROM data AS data2 ORDER BY c,d) ON a=c and b=d ORDER BY a,b)] +# EXPLAIN (DISTSQL) (SELECT * FROM (SELECT a,b FROM data AS data1) LEFT OUTER JOIN (SELECT c,d FROM data AS data2 ORDER BY c,d) ON a=c and b=d ORDER BY a,b) # ---- # https://cockroachdb.github.io/distsqlplan/decode.html#eJzEl0Fv2k4Qxe__T4Hm9K-yVbxjQ8BSJS6plKgNVUpPFQcHbwkSYdHaSI2ifPcKCEKGsG-dQfjo4LdvPDM_v_iF5jY3d9mTKSj9TZoUMSmKSVFCito0UrRwdmyKwrrVLRvBTf6X0kjRdL5Ylqs_jxSNrTOUvlA5LWeGUhpmDzNzb7LcuMuIFOWmzKaztc3CTZ8y99zPszIjRYNlmbb6WvWZRq-K7LJ8O3V32MNz6zErHqvHbCUjRUWZTQyl-lV9rMB2QIGx6id7Be6cuY7zT-tK4y51tP88F6rPF9ImxEdL2R1lXW6cyY_6B9_5ztN9N25ibu10vnrEvcYOnxcmbX27_jpsDX4Nr-9bt4ObO1I0M3_K_99O_fTFTSePu8vKhij_GJIPjIGDxrDzaMv7-04xd_azXVxytV_HSuhUStDhe64bAbFGgZ3TggictyDqM4ComwWx0ySIYWPgoDEcA5HDl4wboaBGgVenpQA4byngM1DAzVJw1SQFYWPgoDEcoyAOX7K4EQpqFNg9LQXAeUtBfAYK4mYp6DZJQdgYOGgMxyhIwpcsaYSCGgX2TksBcN5SkJyBgqRZCnpNUhA2Bg4aQ8inyTse96ZY2Hlhgr44olU7TT4xm2EVdunG5oez47XN5nKw1q3_28tNUW5-jTcXN_PNT6sCw8U9iVgnIrXIm4G33ldHFXVFHO2LuUbDuZ64JxHvNbyuWuTNwDv2NjzxNzzxitv-Ubf9o-74rTsSuPxisOB-MYILqEXeCK4rb8e7_oZ3JXD5xWDB_WIEF1CLvBFcPW_DdeTvuD54ldbBSx-8SusQAtRgTYEaMYLkMncYQQcv1OrUYjC1gzdqHVCAGmwrUCNUkFzmjmDR_jTRbdB3f54gWkR5AtRoX2WJguQyd0iLP1Q0SBUtihWgRvsqCxYkl7lDWvzZwiBbWJQtLMoWoAb7CtSIFiSXuSNa2J8tDLKFRdkC1OgzQ5YtSC5zR7SwP1sYZAvXy5bR63__AgAA__86O3Xp # # query T -# SELECT url FROM [EXPLAIN (DISTSQL) (SELECT * FROM (SELECT a,b FROM data AS data1) RIGHT OUTER JOIN (SELECT c,d FROM data AS data2 ORDER BY c,d) ON a=c and b=d ORDER BY a,b)] +# EXPLAIN (DISTSQL) (SELECT * FROM (SELECT a,b FROM data AS data1) RIGHT OUTER JOIN (SELECT c,d FROM data AS data2 ORDER BY c,d) ON a=c and b=d ORDER BY a,b) # ---- # https://cockroachdb.github.io/distsqlplan/decode.html#eJzEl0Fv2kAQhe_9FWhOrbJV2LEhYKkSl6olUkNF6ani4OAtQSIsWhupUZT_XgFByBD2rTMIHx389o1n5vOLn2lhM3OXPpqckj-kSRGToogUxaSoRWNFS2cnJs-tW9-yFfSzf5Q0Fc0Wy1Wx_vNY0cQ6Q8kzFbNibiihUXo_N0OTZsZdN0lRZop0Nt_YLN3sMXVPvSwtUlI0WBVJo6dVj2n8osiuitdT94fdPzUe0vyhfMxOMlaUF-nUUKJf1PsKbAUUGKlefFDg3pmrOP-yrjDuWjcPn-dK9fhK2oToZCn7o6zLjDPZSf_gO994uh_GTc2tnS3Wj3jQ2NHT0iSNYf_b91Fj8Hv0ddi4HfTvSNHc_C0-vh776YubTR_2l6UVUf45xO-YAwfNYe_Rkjf4jWLu7Ge7vOZyw06V0C6VoMMXXddCYoUC2-clETjvSNQXIFHXS2K7VhLD5sBBczhFIodvGdeCQYUCb86LAXDeYcAXwIDrxeCmVgzC5sBBcziFQRS-ZVEtGFQosHNeDIDzDoPoAhhE9WLQqRWDsDlw0BxOYRCHb1lcCwYVCuyeFwPgvMMgvgAGcb0YdGvFIGwOHDSHkM-TNzyGJl_aRW6Cvjqa636abGq208rtyk3MT2cnG5vt5WCj2_zDl5m82P4abS_6i-1P6wLDxV2JWMcitcibgbc-VDdL6pK4eSjmCg3nauKuRHzQ8KpqkTcD78jb8Njf8NgrbvlH3fKPuu23bkvg8ovBgvvFCC6gFnkjuG68He_4G96RwOUXgwX3ixFcQC3yRnB1vQ3XTX_H9dGrtApe-uhVWoUQoAZrCtSIESSXucMIOnqhlqcWgakdvVGrgALUYFuBGqGC5DJ3BIv2p4lugb778wTRIsoToEb7KksUJJe5Q1r8oaJBqmhRrAA12ldZsCC5zB3S4s8WBtnComxhUbYANdhXoEa0ILnMHdHC_mxhkC0syhagRp8ZsmxBcpk7ooX92cIgW7hatoxfPvwPAAD__wYqd4g= # @@ -208,7 +227,7 @@ https://cockroachdb.github.io/distsqlplan/decode.html#eJy8ll1v-jYUh-_3KaxzBatRsB # · spans ALL · · # # query T -# SELECT url FROM [EXPLAIN (DISTSQL) (SELECT * FROM (SELECT a,b from data AS data3 NATURAL JOIN ((SELECT a,b FROM data AS data1) JOIN (SELECT c,d FROM data AS data2 ORDER BY c,d) ON a=c AND b=d)))] +# EXPLAIN (DISTSQL) (SELECT * FROM (SELECT a,b from data AS data3 NATURAL JOIN ((SELECT a,b FROM data AS data1) JOIN (SELECT c,d FROM data AS data2 ORDER BY c,d) ON a=c AND b=d))) # ---- # https://cockroachdb.github.io/distsqlplan/decode.html#eJzMmE1v2kwQx-_Pp4jm9FTZKt61eZUq-ZpKTaq0t4qDg7cEiWBkG6lRxHevgFBiL5m_xxY2R15-zOxk9-d_9pWWSWzvomeb0fgXaVJkSJFPigJS1KOJolWaTG2WJen2K3vgNv5DY0_RfLla59u3J4qmSWpp_Er5PF9YGtPP6HFhH2wU2_TGI0WxzaP5Yldmlc6fo_QljKM8oslGUbLO337oyD--XD1F2VORDLUKjQp9FQY02UwUZXk0szTWG1Wvsx7TmaL7dT6-2tWs0WahQVO3Qc3N7tDh2zzed3gs7UtK_0jSfFu1V17QtQrNddMpBB-2cvypJI1tauMP61f-5onVfbPpzH5N5kub3pjSYBf2d_7_G_3pSzqfPR1fFraCOjXumvu213AgKvSvVRgIBvOOQAPqfTygw6-UBvXvbe7sHFffr7D69fLUak42f5d8TlY3vlf65unag0JtLTiQ7bpM0Fm_E5dJRsfNrobLQOmDy_otuEx36zJ9cS6TD-SsLuu36zJT_VCYdn0i6GzQiU8EDWpudjV8AkoffDJowSemW5-Yi_OJfCBn9cmgXZ_41Q-F365PBJ0NO_GJoEHNza6GT0Dpg0-GLfjE79Yn_sX5RD6Qs_pk2K5PguqHImjXJ4LORp34RNCg5mZXwyeg9MEnoxZ8EnTrk-DifCIfyFl9Muru7uZEaw82WyXLzFa6mfG2i7PxzO5HmSXrdGq_p8l0V2b_8n7H7f7LjG2W7z_t7V_cLvcfbRusDmvTiB42oU3QhPY9ntYsDUrzsNaN6EET2viN6BFPmzLtFUZegL0y7AsmbmRwaeJSetCELk1cSo94OhCcbSFcOttSetiENuDPzdOls-3QPXab9vk93uf3uOY3-aCJi3kYuRjQwMU8jVzM08jFwyYu5mHkYkADF_M0cjGggYtH7D7VHr9PNf_0BMcT0EjHCAc-BjgSMsKBkTX_CAVKBjRyMsKBlAGOrAxwpGXNxwfgZc0_SIFaAY3cinAgV4AjuwIcRl3-aYqKgxyAwi7AUdoFOQLFXYADx2o-Seg-kKyTJUSS5WkoWYAjyfI4lCzAkWQlOUpKQ8mKkpQUh5IVZSkXd1KFSLJOqhBJlqehZAGOJMvjULI8jiRrJIFKSiPJIhxIFuBIsghHlwpOqijsWGN4yRonVUgkC2gkWYQDyQIcSRbhQLJGkqikNJIswoFkAY4kC3AkWePEColkjZMqJJIFNJIswoFkAY4kC3AoWUmgktJQsqJAJcWhZEWBysWdVFGU7BBIVnJF4x4X0R2NGEeSFd3SiHEkWUmiktJQsqJEJcWhZEWJyr04d2IFK9nJ5r-_AQAA__9IVxsL # @@ -217,7 +236,7 @@ https://cockroachdb.github.io/distsqlplan/decode.html#eJy8ll1v-jYUh-_3KaxzBatRsB # CREATE TABLE distsql_mj_test (k INT, v INT) # # query T -# SELECT url FROM [EXPLAIN (DISTSQL) (SELECT l.k, r.k FROM (SELECT * FROM distsql_mj_test ORDER BY k) l INNER JOIN (SELECT * FROM distsql_mj_test ORDER BY k) r ON l.k = r.k)] +# EXPLAIN (DISTSQL) (SELECT l.k, r.k FROM (SELECT * FROM distsql_mj_test ORDER BY k) l INNER JOIN (SELECT * FROM distsql_mj_test ORDER BY k) r ON l.k = r.k) # ---- # https://cockroachdb.github.io/distsqlplan/decode.html#eJyskk9Lw0AQxe9-CpmT0pVk06SHgJBrBVup3qSUmB3jSpqNsxtQSr-7JHtIE8z2D952Z-f35r1ldlAqgYt0ixriV-DAIII1g4pUhlorasq2aS6-IfYZyLKqTVNeM8gUIcQ7MNIUCDEs1J2qvAgYCDSpLNq2PQNVmw7SJs0R4tmeHQhzt_BL-lbgClOB5Pk9eahIblP6SYTURn8Vm-3nxqA2wGBZm_g64TDmgJ_j4FmRQfJ4f3jCJ6PywaUBg_8KOL0g4PT0gOGofKdal4oEEorhThxv-cPjI1KOD0qWSF7YN1rgu7lJ-OT2nmT-YY_dF7EkGI0R9WIc2fAV6kqVGk9acb_JgCJH-yda1ZThE6msHWOvy5ZrCwK1sa8ze5mX9qkxeAhzJxy44cAJRz2YD-GpEw7dk8MzJgdDOHLC_mDyen_1GwAA___yFZqv diff --git a/pkg/sql/opt/exec/execbuilder/testdata/distsql_merge_join b/pkg/sql/opt/exec/execbuilder/testdata/distsql_merge_join index d5c11215475e..65b272745454 100644 --- a/pkg/sql/opt/exec/execbuilder/testdata/distsql_merge_join +++ b/pkg/sql/opt/exec/execbuilder/testdata/distsql_merge_join @@ -239,9 +239,26 @@ vectorized: true spans: /3/#/55/1-/5/#/55/2 query T -SELECT url FROM [EXPLAIN (DISTSQL) SELECT * FROM parent1 JOIN child1 USING(pid1) WHERE pid1 >= 3 AND pid1 <= 5] +EXPLAIN (DISTSQL) SELECT * FROM parent1 JOIN child1 USING(pid1) WHERE pid1 >= 3 AND pid1 <= 5 ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJzEVN1q20wQvf-eYpnc2F_WrFY_LggMCo3bKjhyaru0kOpCkaa2QNGquxI0BL97kddgyTiK3bj0TrMzZ-bMmYOeQf3MwIX5eDJ-vyCVzMiH2fSW3I-_3U2u_ID0rv35Yv550ifbkv91QRFJzEtObqZ-QOJVmiWcfJn7wUfSK9KE98nXT-PZWAfke2UYFo6I1SdXwXXzMR4Rpx8ChVwkGESPqMC9Bw4UTKBgQUihkCJGpYSsU8-bQj_5Ba5BIc2LqtTPZVpmCC5UuZAJSkyAQoJllGZ1PlyHFGIhEdxdaSAGomDDvUIKoiq3bUMKqoyWCK69po3RvDH6QONF9JDhDKMEJTNa7WErm1fI9DGST0BhXkS5cgmzBsxmF8xxGGe2DW0iu94PT2QVqVW7q8dhs-GWLP9Tsma7rT7rIa5bouejbL5Iedfn0GHB45f14KOqDmx_i3KJNyLNUTK7jcnwR9nz-GV_JNPlSn8ChWlVusTj1DOpZ1PPgZcsY7VWMo-_Aj_WMg3xB8xhF2c0zQl0rSNNs8-2Dswzmsb8J6Zx_qZpjO4rzFAVIld41B_MqDfBZIlaHyUqGeOdFPFmjA6nG9zmIUFV6uw7Hfi5TtUEm2C-D-ZNsNUC89PAw26wecJk8zTwsBtsdQpmdNO23yJYN_gVwZy3CNYNfkWw4UmChev_fgcAAP__kmG_Pw== +distribution: full +vectorized: true +· +• merge join +│ equality: (pid1) = (pid1) +│ left cols are key +│ +├── • scan +│ missing stats +│ table: parent1@primary +│ spans: [/3 - /5] +│ +└── • scan + missing stats + table: child1@primary + spans: [/3 - /5] +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJzEVE1r20AQvfdXLJOL3axZrT5cEBgUGrdVcOTUdmmh9UGRprZA0aq7K2gI_u9FlsGScRSrcelNszNv5s2bh55A_UrBhfG3u8mVH5DetT9fzD9P-mQ-nozfL8hb8mE2vSV5KDHTnNxM_YBE6ySNOfky94OPpJcnMe-Tr5_Gs3EVkB-FYVg4IlafXAXX9cdoRJw-UMhEjEH4gArc78CBggkULFhSyKWIUCkhy9TTttCPf4NrUEiyvNDVs050iuBCkQkZo8QYKMSowyQt88vNkkIkJIK7Lw3EQORseFBIQRR613ZJQelwheDaG1obzWujjzRehPcpzjCMUTKj0R52qnm5TB5C-QgU5nmYKZcwa8BsdsEch3Fm29Aksu99_0jWoVo3u3octhvuyPK_JWs221ZXPcZ1R_R8lM1nKe_7HDssePyyHHxS1ZHtb1Gu8EYkGUpmNzEp_tQ9j1_2RzJZratPoDAttEs8Tj2Tejb1HHjOMlZjJfP0K_BTLVMTf8AcdnFG03Sga51omkO2ZWCe0TTmfzGN8y9NY7RfYYYqF5nCk_5gRrkJxius9FGikBHeSRFtx1ThdIvbPsSodJV9VwV-VqVKgnUwPwTzOthqgHk38LAdbHaYbHYDD9vBVqtgRjtt-zWCtYNfEMx5jWDt4BcEG3YSbLl58ycAAP__nje54A== # Swap parent1 and child1 tables. query T @@ -277,9 +294,26 @@ vectorized: true parallel query T -SELECT url FROM [EXPLAIN (DISTSQL) SELECT * FROM child1 JOIN parent1 USING(pid1) WHERE pid1 >= 3 AND pid1 <= 5] +EXPLAIN (DISTSQL) SELECT * FROM child1 JOIN parent1 USING(pid1) WHERE pid1 >= 3 AND pid1 <= 5 ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJzEVE1r20AQvfdXLNOL3ayRVh8uCAwKjdsqOHJqu7SQ6qBIU1ugaNXdFTQE__dir8GScRSrcelNszNv5s2bh55A_srBg_l4Mv6wIJXIycfZ9Ibcjb_fTi6DkPSugvli_mXSJ7uSd7ogWWV5ysj1NAhJGQssFCNf50H4ifTKLGV98u3zeDbWAflRmaaNI2L3yWV4VX9MRsTtR0Ch4CmG8QNK8O6AAQULKNgQUSgFT1BKLjapp21hkP4Gz6SQFWWl9LPKVI7gQVVwkaLAFCikqOIs3-SjdUQh4QLB25eGfMBLY3hQSIFXatc2oiBVvETwnDWtjWa10UcaL-L7HGcYpygMs9EetGx-KbKHWDwChXkZF9Ijhm28NVzXYAPD2X0ZjgNNOvsJ949kFctVs7fPYLvnjjL7W8pWs-3uusc4n4-s9SzZfZ9jhwWfXWwGn1R1ZO8bFEu85lmBwnCamBx_qp7PLvojkS1X-hMoTCvlEZ9R36K-TX0XnrOM3VjJOl1_dqJlatoPDFcH1hkt04GyfaplDjmf0TTWfzGN-y9NY7ZfYIay5IXEk_5g5mYTTJeo9ZG8EgneCp5sx-hwusVtH1KUSmff6yAodGpDsA5mh2BWB9sNMOsGHraDrQ6TrW7gYTvYbhXMbKftvEawdvALgrmvEawd_IJgw06CRes3fwIAAP__OOu_PQ== +distribution: full +vectorized: true +· +• merge join +│ equality: (pid1) = (pid1) +│ right cols are key +│ +├── • scan +│ missing stats +│ table: child1@primary +│ spans: [/3 - /5] +│ +└── • scan + missing stats + table: parent1@primary + spans: [/3 - /5] +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJzEVE1r20AQvfdXLNOL3ayRVh8uCAwKjdsqOHJqu7TQ-qBop7ZA0aq7K2gI_u_FXoMl4yh245KbZmfezJs3Dz2C-p1DAMPvt6PLKCadq2g6m34Zdcl0OBp-mJF35ONkfEPSZZZzRq7HUUzKRGKhGfk6jeJPpFNmnHXJt8_DydAE5Gdl2y4OiNsll_FV_TEdEL8LFArBMU7uUUHwAxhQcICCC3MKpRQpKiXkOvW4KYz4HwhsCllRVto860znCAFUhZAcJXKgwFEnWb7Oz1dzCqmQCMGuNBY9UVr9vUIKotLbtnMKSicLhMBb0dpoVht9oPEsuctxgglHadmN9mBUC0uZ3SfyAShMy6RQAbFc663l-xbrWd72y_I8aNLZTbh7IMtELZu9QwabPbeU2b9Sdpptt8c9xPl8ZJ0nye76HDoshOxiPfioqgN736Bc4LXICpSW18Tk-Et3QnbRHchssTSfQGFc6YCEjIYODV0a-vCUZdzGSs7x-rMjLVPTvmf5JnDOaJkTKLvHWmaf8xlN47yKafz_aRq7_QITVKUoFB71B7PXmyBfoNFHiUqmeCtFuhljwvEGt3ngqLTJvjdBVJjUmmAdzPbBrA52G2B2GrjfDnZOmOycBu63g91Wwex22t5LBGsHPyOY_xLB2sHPCNY_SbD56s3fAAAA__9Ewbne # Select over two ranges for parent/child with split at grandchild key. # Also, rows with pid1 <= 30 should have 4 rows whereas pid1 > 30 should @@ -314,9 +348,26 @@ vectorized: true spans: /29/#/55/1-/31/#/55/2 query T -SELECT url FROM [EXPLAIN (DISTSQL) SELECT * FROM parent1 JOIN child1 ON parent1.pid1 = child1.pid1 WHERE parent1.pid1 >= 29 AND parent1.pid1 <= 31 ORDER BY parent1.pid1] +EXPLAIN (DISTSQL) SELECT * FROM parent1 JOIN child1 ON parent1.pid1 = child1.pid1 WHERE parent1.pid1 >= 29 AND parent1.pid1 <= 31 ORDER BY parent1.pid1 ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJy8UtFum0AQfO9XnDYvcXPpcYdxGiRLpA1VHTmQYkttlfJAYGsjEY4eIDWy_O8VxpWLZRNct3ljb3d2doZZQP4jARMm9th-PyWlSsgHz70l9_aXu_HVyCGn16PJdPJp3CPrkdf1QBYoTAtObtyRQ8J5nEScuM7v5zdZHHEyXDfq6vNH27PJaWPiW6lpOg6JuOyRK-d6VzccEp33iOtd2x5597XB4AOFVEboBI-Yg3kPHCgY4FPIlAwxz6WqnheroVH0E0yNQpxmZVE9-xRCqRDMBRRxkSCYMA0eEvQwiFCxaleERRAnq9VrXitT8WOgnoDCJAvS3CRM19gJMwaMswttXbxlnOnaOdM5OwF_SUGWxZp1Q_bwROZBPm_SWBz8pU8hL4IZgsmX9O-u15tr6x9x-PHMMJg4SoHYq2CzR6oIFUbbe84q4k5TO8y4RTXDGxmnqJjRxCT4vTi1-FlvqOLZvP4ECm5ZmMTi1BLU0qnVp5axpXyjSj9O1Y57HXkuMzZoTO9j7zfYefdUaF0zLS7P90fjHyb6gNtFx0SLyzq2_H8pEHsVvFyi-y-Y6B2neJhnMs2xU1q1SgxGM6wtymWpQrxTMlzR1KW7wq3cjDAv6u6gLkZp3aoO7A4W7WB-ALM4DCzawWIbrP0J1tvP1lvBFw2wtg3uH-N2O_gZt41j3G4HP-P24CC3_eWrXwEAAP__iRfeKg== +distribution: full +vectorized: true +· +• merge join +│ equality: (pid1) = (pid1) +│ left cols are key +│ +├── • scan +│ missing stats +│ table: parent1@primary +│ spans: [/29 - /31] +│ +└── • scan + missing stats + table: child1@primary + spans: [/29 - /31] +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJy8UlFvm0wQfP9-xWnzEn8597jDODWSJdKaqo4cSLGltmp5ILC1kQhHDyw1svzfK4wrF8smuG7zxu3u7OwMs4L8ewIm2J_uJzdjh1yOxtPZ9MOkQ6b2xH47I_-Td557R7JAYVpwcuuOHRIu4iTixHV-lV9lccTJcNuoXh_f255NLmsTX5eapuOQiEGH3DijQ91wSHTeIa43sj3y5nONASikMkIneMQczC9QFgzwKWRKhpjnUpXl1WZoHP0AU6MQp9myKMs-hVAqBHMFRVwkCCbMgocEPQwiVKzcFWERxMlm9ZbWylT8GKgnoDDNgjQ3CdM1dsGMPuPsWts-XjPOdK3LdM4uwF9TkMtiy7oje3giiyBf1GksDv7ap5AXwRzB5Gv6Z9fr9bXVfzj9eGYYTJylQBxVsNsjVYQKo_09VyVxq6kDZtyhmuOtjFNUzKhjEvxWXFr8qjNU8XxRfQIFd1mYxOLUEtTSqdWjlrGnfKdKP0_VgXsd2ZUZ69emj7H3auy8fSq0tpkWg-7xaPzFRJ9wu2iZaDGoYsv_lQJxVMHLJbr3gok-cIqHeSbTHFulVSvFYDTHyqJcLlWI90qGG5rq6W5wGzcjzIuq268e47RqlQe2B4tmMD-BWZwGFs1gsQ_WfgfrzWfrjeDrGljbB_fOcbsZ_IzbxjluN4Ofcbt_ktv--r-fAQAA__8HOtjL # Parent-child where pid1 <= 15 have one joined row and pid1 > 15 have no # joined rows (since child2 only has 15 rows up to pid1 = 15). @@ -359,9 +410,26 @@ vectorized: true spans: /12/#/56/1- query T -SELECT url FROM [EXPLAIN (DISTSQL) SELECT * FROM parent1 JOIN child2 USING(pid1) WHERE pid1 >= 12 ORDER BY pid1] +EXPLAIN (DISTSQL) SELECT * FROM parent1 JOIN child2 USING(pid1) WHERE pid1 >= 12 ORDER BY pid1 ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJy8ll1vuzYUxu_3Kayzm3Z_R2Dz0gSpEtuabanapEs6bVOXCxq8BCkFZoi0qsp3n4B0WV7wgVnhLg78sB-f38XzAdlfa_BgNnwYfv9MNnJNfphOHsnL8Lenh29HY3J1N5o9z35-uCa7V76pXkgDKeKckfvJaEwWq2gdcvLLbDT-kVylUciuya8_DadDUvwmf2xM0xK3hHEymd4Np-S738sHc6AQJ6EYB28iA-8FGFDgQMECCjZQcGBOIZXJQmRZIotXPkpgFP4NnkkhitNNXvw9p7BIpADvA_IoXwvw4Dl4XYupCEIhDRMohCIPonW5ze7sfiqjt0C-A4VZGsSZRwzGewbjxteG4xjMcDgJ4pBwkuQrITOYbykkm3y3536r13eyCrLV4SY-g_l2TiHLg6UAj23p_zv74PCz1VWfOTo3P4_tmj2DlyHcYsV3i77BDF4lYlUirUC8NtD-O4kMhRTh8Xe-FBs3euvM3TwKuRT3SRQLabCjwa7Fn_mVz75c38pouap-AoXJJveIz6jPqW9T36G-exR9H8vSi3XmwOOkl6QGcw5er9vePtieNdeENVd8r3fPYPanJ469WxSeMPtS5reI5DQ0n3263kkcXhunQ-_Zhb3nzafEG4tXN5uewdxL6dYiiNtUt25y8NocHXrGL-yZ1Xw8VmPP3J7B-v_OqL9blDPqX8qzFkFumnrWTQ5em6NDz6wLe2Y3H4_d2LO62fQOutiljGsRqd_UuK4T8dpEHbpnd9ghz5xlKrI0iTPRqB6aRRoRLkV1R1mykQvxJJNFuU21nJRcWU1CkeXVU14tRnH1qDhgc9jVgQc6MNM6N3PUNGtxZbwd7OrAAx2YaZ376MpOaH5Mm_-lLfV9W0qYHd6ZeUzbOoKrYURwNYwIroYxwREaEdzREVwNI4KrYURwNYwJjtCI4K6O4Dc6iqphRFE1jCiqhjFFERpRtK-jqBpGFFXDiKJqGFMUoRFFBzqKMq2egNCIpAiNWIrQmKYYjnUFvbKg1xb06oJmX9ArDEyrMbCTytDKVjWN2aqmMVvVNGorgmO2tilLpzNr05ba0pitrfpSaxyz9aQ8KG2db7_6JwAA__9-zsYU +distribution: full +vectorized: true +· +• merge join +│ equality: (pid1) = (pid1) +│ left cols are key +│ +├── • scan +│ missing stats +│ table: parent1@primary +│ spans: [/12 - ] +│ +└── • scan + missing stats + table: child2@primary + spans: [/12 - ] +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJy8ll1vm0gUhu_3V4zO3iSbsWCGj9hIkdjduK2jxE7tVG3V-oKYqY3kAAUsNYr83yvAqesP5kBH5s5jeJh55zwX7wuk35fgQP_T_e2_gyE5ux5MHibvb8_JpH_b__-B_EPejEd3JPYSEWaM3IwGQzJbBEufkw-TwfAtOYsDn52Tj-_64z7Jf5OvK103xBVhnIzG1_0x-e9z8QAohJEvht6TSMH5AvkfHCgYQMEEChZMKcRJNBNpGiX5Ky8FMPB_gKNTCMJ4leV_TynMokSA8wJZkC0FOPDgPS7FWHi-SDQdKPgi84Jlsc3m6G6cBE9e8gwUJrEXpg7RGO9ojGt_a5alMc3ixAt9wkmULUSSwnRNIVplmz23Wz0-k4WXLnY3cRlM11MKaebNBThsTf_s7L3dz5Y3feToXH89tq13NF6EsPMV3yy6GtN4mYiViZQC8cpA2-9EiS8S4e9_5yLfuNZbR-7mTiRzcRMFoUg0tjfYpfiWnbns4vwqCeaL8idQGK0yh7iMupy6JnUt6tp70bexDLVYRw48jDpRrDFr5_Wq7c2d7Vl9TVh9xbd6dzRmvnpimZtF7gkzT2V-g0hWTfPZq-utxOGVcVr0np3Ye15_Sry2eFWz6WjMPpVuDYLYdXVrJwevzNGiZ_zEnhn1x2PU9szuaKz7a0bdzaKYUfdUnjUIclnXs3Zy8MocLXpmnNgzs_54zNqeVc2ms9PFTmVcg0jdusa1nYhXJmrRPbPFDnnkLGORxlGYilr1UM_TCH8uyjtKo1UyE_dJNCu2KZejgiuqiS_SrHzKy8UgLB_lB6wP2ypwTwVmSudmlpxmDa6MN4NtFbinAjOlc-9d2QHN92n9d9qQ37chhdnunen7tKkiuBxGBJfDiOByGBMcoRHBLRXB5TAiuBxGBJfDmOAIjQhuqwh-qaKoHEYUlcOIonIYUxShEUW7KorKYURROYwoKocxRREaUbSnoihT6gkIjUiK0IilCI1piuFYV1ArC2ptQa0uKPYFtcLAlBoDO6gMjWyV05itchqzVU6jtiI4ZmuTsnQ4syZtqSmN2dqoLzXGMVsPyoPU1un6r58BAAD__0mvwLU= # These rows are all on the same node 1 (gateway). query T @@ -399,9 +467,26 @@ vectorized: true spans: /1/#/56/1-/1/#/56/2 /11/#/56/1-/11/#/56/2 /21/#/56/1-/21/#/56/2 /31/#/56/1-/31/#/56/2 query T -SELECT url FROM [EXPLAIN (DISTSQL) SELECT * FROM parent1 JOIN child2 USING(pid1) WHERE pid1 IN (1, 11, 21, 31) ORDER BY pid1] +EXPLAIN (DISTSQL) SELECT * FROM parent1 JOIN child2 USING(pid1) WHERE pid1 IN (1, 11, 21, 31) ORDER BY pid1 ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJycktFv0zAQxt_5K063lxaMUrtsD5GQAixApq4ZSRGgKQ8mPtpImR1sRwJV_d9RnEqjUweUt_P5-86_7-Qtuu8txlimi_TNCnrbwtsiv4bb9PPN4lW2hMllVq7KD4sp7CVPR0EnLWnP4SrPllBvmlYJ-Fhmy3cw6RrFp_DpfVqkMNQwjOEMOGcgOIM5n0JeXKYFvP4SBBUy1EbRUt6Rw_gWOVYMO2tqcs7YobUNgkz9wHjGsNFd74d2xbA2ljDeom98SxjjSn5tqSCpyEYzZKjIy6YNY_fMSWebO2l_IsOyk9rFEPHnEY_OQGoFczB-Q9ZhtWNoen__kvNyTRjzHfs_Gn5IMy7tGEx0Fp1f7JmGSvwbmHgU7J6n18YqsqQOWKrB-TfJkXTXZNd0ZRpNNhKH6Vr65icJfzZ9aZv1ZiyRYd77GBLOEsGSFyw5Z8nFo3nmpyy6INcZ7ehhrqOTZ0MYUmsal-NMb2u6saYOz4zHPPhCQ5Hz460YD5kOV-En_G7mJ5jFQ7P4o3l-YJ7tqt2TXwEAAP__rsIvEw== +distribution: full +vectorized: true +· +• merge join +│ equality: (pid1) = (pid1) +│ left cols are key +│ +├── • scan +│ missing stats +│ table: parent1@primary +│ spans: [/1 - /1] [/11 - /11] [/21 - /21] [/31 - /31] +│ +└── • scan + missing stats + table: child2@primary + spans: [/1 - /1] [/11 - /11] [/21 - /21] [/31 - /31] +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJycklFv0zAQx9_5FKfbSwtGqV22h0hIARYgU9eMpAgQyoOJjzZSZgfbkUBVvzuKM2lk6oDt7Xx3_7vf_-Q9uh8txph-vlq9ytYwO8_KTflhNYcyXaVvNvAU3hb5JXTSkvYcLvJsDfWuaZWAj2W2fgezrlF8Dp_ep0UKQwzDGM6AcwaCM1jyOeTFeVrA6y-hARlqo2gtr8lh_BU5Vgw7a2pyztghtQ8NmfqJ8YJho7veD-mKYW0sYbxH3_iWMMaN_NZSQVKRjRbIUJGXTRvG3iAnnW2upf2FDMtOahdDxJ9HPDoBqRUswfgdWYfVgaHp_e0m5-WWMOYH9jgaPqUZb3YMJjqJTs9umIZI_B-YuBfslqfXxiqypCYs1aD8V8sRd5dkt3RhGk02ElN3LX33s4Q_m7-0zXY3hsgw730MCWeJYMkLlpyy5OxeP8uHHLog1xnt6K6vo5MXgxlSWxqP40xva7qypg5rxmcedCGhyPmxKsZHpkMp_IQ_xfwBYnFXLP4qXk7Ei0N1ePI7AAD__9aLKbQ= # Parent-grandchild. # We add the pa1 > 0 condition so a lookup join is not considered to be a better plan. @@ -448,15 +533,34 @@ vectorized: true spans: FULL SCAN query T -SELECT url FROM [EXPLAIN (DISTSQL) +EXPLAIN (DISTSQL) SELECT * FROM parent1 JOIN grandchild2 USING(pid1) WHERE pid1 >= 11 AND pid1 <= 13 OR pid1 >= 19 AND pid1 <= 21 OR pid1 >= 31 AND pid1 <= 33 OR pa1 > 0 -] ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJzsl1-PozYUxd_7KSz3Jek6AtuEIUgjsepm26xmk20yVStt88AGN0HKAjVE6mo0370iJBkCxBeHzs7LvPHHP2zfc46veMDpP1vs4sX4bvzzPdrJLXo_n31En8d_frp7O5mi3rvJ4n7x210fHYb8VAxIfCmijKIPs8kUraUfBatNuA0Y-n0xmf6CekkY0D7649fxfIx6vd7-Hv21M00ubhGlffR2-g6Vnq5uEeX9PprNUXXwqGkwo_3G0bzx05wfRyf-cSwy-0tMcBQHYup_FSl2P2OKCWaYYI4JtjDBQ7wkOJHxSqRpLPMhD3tgEvyLXZPgMEp2Wf54SfAqlgK7DzgLs63ALr73v2zFXPiBkIaJCQ5E5ofb_TSH4nmJDL_68hsmeJH4UeqigcGMH42hbVDDYsW1Y1CDIT8KEEdxthEyxctHguNd9jR1mvlrgV36SNov7324zYQU0hier6147u5F88qSua47md47h_J6Zd2Orw6ClLHRRYydvtjA8cvTcV7hPHZS9PimUqKnXX_5hjZ-ujnfskfx8vGpjEynjGWVaUXmUiz-H6n19sEv7uPpO7EMhBRB9Ttv8olbjWooyUch1-JDHEZ5SSru2oq_s55H3_RvZbjeFJeY4Nkuc5FHiceIZxFvSDybeDcXjW612Nkualp144Kn8SBODGZWRjbPPTybm2q4o-UZcMEXA8PKr4f5c-ua8wBY6uk8sF_PA9V5oKM41TgPusre5WygL3M22M9_NrD2arG2-SwJMjDsk2p2cZ2rZl-TT2Cpp3zevOZTlU8NxSnTyWdH2bvkk71MPm-eP5-8vVq8bT6btRkYzjWpBBZ4SqXzmkpVKjV0plwnlVeJ3SWL_GWy6Dx_Fq32Gllts-gMDGoeJRqah5tcI2peE0dgjac4jl7jqIqjhtTU0onjtXp3SaT1Mokcfd8_24blzEWaxFEqWv23mvmGRLAWRZnSeCdX4pOMV_tpitvZnts_CESaFW9pcTOJilf5AsswrcK0DPMzmOrBTheYsk603YVmpppmGjVjerDTBa7UTJe2u9CVmtVorjSppS64pYQZYPGhkrbVsN0lH2oYyIcahvIB0EA-1DSUj5su-VDDQD7UMJQPgAbyoaahfDhd8jFSdwATaAG1BqLVA9Q01ATUNNgFABxqA2oc8jnVaZ41xQEacDpAQ1aHcMDrAA6ZndZ6iY7bqbqXUAuwe62baNldTUN2V9Og3QEcsrsaB-1ea6RadlfTkN3VNGh3AIfsrsZBu9faqZbda43l3O4OYPdaZ9Gyu5qG7K6mQbsDOGR3NQ7avdZVteyupiG7q2nQ7gAO2V2NQ3Zn6h_Sqt2Xjz_8FwAA___OjNsw +distribution: full +vectorized: true +· +• merge join +│ equality: (pid1) = (pid1) +│ left cols are key +│ +├── • filter +│ │ filter: ((((pid1 >= 11) AND (pid1 <= 13)) OR ((pid1 >= 19) AND (pid1 <= 21))) OR ((pid1 >= 31) AND (pid1 <= 33))) OR (pa1 > 0) +│ │ +│ └── • scan +│ missing stats +│ table: parent1@primary +│ spans: FULL SCAN +│ +└── • scan + missing stats + table: grandchild2@primary + spans: FULL SCAN +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJzsl1-PozYUxd_7KSz3Jek6AhvCEKSRWHWzbVazyTaZqpXaPLDBTZCyQIFIHY3mu1eESYYAuReHTuclb_zxD9v3nOMrHmn695Y6dPz7l7v3kynpfZgs7he_3PXJYnw3_vGe_EA-zmefSewlMsw4-TSbTMk68UJ_tQm2viC_LibTn0gvDnzeJ7_9PJ6PSa_X29-TP3e6bshbwnmfvJ9-IKWnq1vCjX6fzOakOnjUNFjwfuNoo_HThnEYHXuHsUTvU0bDyJdT75tMqfMH5ZRRQRk1KKMmZXRIl4zGSbSSaRol-ZDHPTDx_6GOzmgQxrssf7xkdBUlkjqPNAuyraQOvfe-buVcer5MNJ0y6svMC7b7aZ5r58ZJ8M1LHiiji9gLU4cMNKF9rw0tjWumKK5tjWuCeKFPDBJlG5mkdPnEaLTLXqZOM28tqcOfWPvlfQy2mUxkog1P11Y8d_aauWXFHMeZTO_t5-q6ZdkOr571KGOjs5g4frGBM85PZxgVzhVHQQ9vKiV62fXXB7Lx0s3pll1Ol08vZRQqZSyrzCsyl1Lx30ittg_j7D5evhMlvkykX_3Ou3ziVqMaSvJZJmv5KQrCvCQVd23lX1nP5e_6t0mw3hSXlNHZLnOIy5krmGsyd8hci7k3Z41uttjZLmxadeOCp9EgijWhV0Y2zz08mZsruKPlGXDGFwPNzK-H-XPzkvMAWerxPLCu5wF0HqgozhXOg66ydzkb-NucDdbrnw2ivVqibT5Lggw066iaVVznqlmX5BNZ6jGfN9d8QvlUUJwLlXx2lL1LPsXb5PPm9fNptFfLaJvPZm0Gmn1JKpEFHlNpX1MJpVJBZ26opPIisbtk0XibLNqvn0WzvUZm2yzaA43rB4mG-vNNrhHXL4kjssZjHEfXOEJxVJCamypxvFTvLok03yaRo__3z7ZhOXOZxlGYylb_rXq-IemvZVGmNNolK_kliVb7aYrb2Z7bP_BlmhVveXEzCYtX-QLLMK_CvAwbJzBXg-0uMBedaKsLLXSYFgo1E2qw3QWu1EyVtrrQlZrVaAM0qQkX3ARhgVh8CNIWDFtd8gHDSD5gGMsHQiP5gGksHzdd8gHDSD5gGMsHQiP5gGksH3aXfIzgDqAjLaDWQJR6AExjTQCm0S6A4FgbgHHM51yledYUR2jE6QiNWR3DEa8jOGZ2XuslKm7ncC_hJmL3WjdRsjtMY3aHadTuCI7ZHcZRu9caqZLdYRqzO0yjdkdwzO4wjtq91k6V7F5rLKd2txG71zqLkt1hGrM7TKN2R3DM7jCO2r3WVZXsDtOY3WEatTuCY3aHcczuAv4hrdp9-fTdvwEAAP__PbbV0Q== query T EXPLAIN (VERBOSE) @@ -501,15 +605,34 @@ vectorized: true spans: FULL SCAN query T -SELECT url FROM [EXPLAIN (DISTSQL) +EXPLAIN (DISTSQL) SELECT * FROM grandchild2 JOIN parent1 USING(pid1) WHERE pid1 >= 11 AND pid1 <= 13 OR pid1 >= 19 AND pid1 <= 21 OR pid1 >= 31 AND pid1 <= 33 OR pa1 > 0 -] ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJzsl9-PozYQx9_7V1juS9JzBLaBJUgrcerl2pz2kmuyVStd88AFN0HKATVE6mm1_3tFSDYJAQ9emtuXfeOHP3hm_P3OiAec_bPBHp6P7kY_36Ot3KD3s-lH9Hn056e7t-MJ6r0bz-_nv9310X7JT-WClQzicLmONiFDH6bjCUoDKeKcot_n48kvqJdGIe2jP34dzUao1-vt7tFfW9Pk4hZR2kdvJ-_QydPlLaK830fTGaouHtYtZrRfu5rXfprzw-o0OKxFZn-BCY6TUEyCryLD3mdMMcEME8wxwRYm2MYLglOZLEWWJbJY8rADxuG_2DMJjuJ0mxePFwQvEymw94DzKN8I7OH74MtGzEQQCmmYmOBQ5EG02W1zUjw_ldHXQH7DBM_TIM48NDCY8aNhOwY1LFZeuwY1GAriEHGU5GshM7x4JDjZ5vvtj7t--YbWQbY-38-nePG4IDjLg5XAHn0kz0vDPv_s_sj_nxSO4TGd8N5Hm1xIIQ1aqXH5wtuJzz-Vnud548m9u5eJf6q_w6u9sE6xYSPGnr5Yw_Hm7TivcD57UubhTadj5o11PH4nkaGQIqx-502xcatVNUfyUciV-JBEcXEqFclsxN95z6dv-rcyWq3LS0zwdJt7yKfEZ8TnxLeIbxP_plEhVovMtnFd1LUBT5JBkhrMrKys39s-25u2Nw_V6AEN_hkYVnFtF8-ta_UDjZSclv2gazpNvQEI9dgb6GtvUPUG-jK9wbl-b2Dtxcx0_Hki3IHhPKnbKa8LdTvX8qdGSjdt_dkxnSZ_AqEe_cle_anyJ3sZf95c35-8vZi5jj_rNTww3Gu5UiMRt60rn5VEkxeBAI9e5K9eVHmRv4wX3et70WovYUvHi-7AoOZByra5vym0TM1r2VEjl2FbOz43jyZHAjEeHWm9OlLlSOtlHDn8vn-2NeHMRJYmcSZa_beaRUIiXImyTFmylUvxSSbL3Tbl7XTH7f4HQpHl5Vte3ozj8lURYHvY7QJT1ol2utDMVNO0Sptn9BlsVmGmUXCmB7td4ErBdWmnC10p-AXNlQW31KdlqU-Lqo_L7uIPNQz4Qw1D_gBowB9qGvKHo6z4jbrgN138oYYBf6hhyB8ADfhDTUP-cLv4Y9hF4WoYULgahhQO0IDC1TQ4AS4GyFnFKdBU6MUE0RE5QAMqB2hI5hAO6BzAIaHTizmio3R6MUd0pA7QgNYBGhI7hANqB3BQ7uoZSm1A7jpD9PLMdaaoLg3KXWuO6uKg3NWTFJK7zijVpSG5aw1TbRySu9Y4vcTV85QOAbnrTNTLM9cZqbo0KHetoaqLQ3Jn6qlalfvi8Yf_AgAA__9rwtp2 +distribution: full +vectorized: true +· +• merge join +│ equality: (pid1) = (pid1) +│ right cols are key +│ +├── • scan +│ missing stats +│ table: grandchild2@primary +│ spans: FULL SCAN +│ +└── • filter + │ filter: ((((pid1 >= 11) AND (pid1 <= 13)) OR ((pid1 >= 19) AND (pid1 <= 21))) OR ((pid1 >= 31) AND (pid1 <= 33))) OR (pa1 > 0) + │ + └── • scan + missing stats + table: parent1@primary + spans: FULL SCAN +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJzsl9-P2kYQx9_7V6ymL9AssnfXgLEUyVFDWqILpHBVK7U8OHgLlojt2kZqdLr_vTKGA4y94z2X3su9-cd-vDOz3--M_ADp31twYPz757t3kynpvJ8s7he_3HXJYnw3_vGe_EA-zGefyDrxQn-1CbY-Jx9nkymJvUSGGSO_LibTn0gnDnzWJb_9PJ6PSafT2d-TP3emKeRbwliXvJu-J2dPV28JE90umc1JefGoajFn3crVovLTQhxXx95xLTG7QCGMfDn1vsoUnD-AAQUOFARQsIBCH5YU4iRayTSNknzJwx6Y-P-AY1IIwniX5Y-XFFZRIsF5gCzIthIcuPe-bOVcer5MDBMo-DLzgu1-m7PauXESfPWSb0BhEXth6pCewY3vjf7AYIbFi2vbYAYnXugTQaJsI5MUlo8Uol122P6065dvZOOlm8v9XAbLxyWFNPPWEhz2SJ-XRv_ys4cT_29SOIXHdcL7EGwzmcjEYKUaFy-cvfbcc-U5jjOZ3tsHlbjn8ju-OujqHBvVYvzpixWcqN9OiBLn8idhHt-0OmZRW8fTd6LEl4n0y995k2_caFXFkXySyVp-jIIwP5WSZLbyr6zjsjfdt0mw3hSXQGG2yxziMupy6grqWtTtU3dYqxCrQWa7sCrqyoCnUS-KDW6WVlbv3b_YmzU3D9PoATX-6RlWft3Pn1u36gcaKQ0a9oO26dT1BiTUU29gr71B1RvYy_SGwe17A28uZq7jzzPh9ozBk7oHxXWu7sGt_KmR0rCpP1umU-dPJNSTP_mrP1X-5C_jz-Ht_Smai1no-LNawz3DvpUrNRKxm7ryWUnUeREJ8ORF8epFlRfFy3jRvr0XreYStnS8aPcMZh6l3DcPN7mWmXkrO2rkMmpqx-fmUedIJMaTI61XR6ocab2MI0f_759tRThzmcZRmMpG_61mnpD017IoUxrtkpX8nESr_TbF7WzP7f8HfJlmxVtR3EzC4lUeYHPYbgMz3ooetKG5qaZZmTYv6AvYLMNco-BcD7bbwKWC69KDNnSp4Fe0UBbcUp-WpT4tpj6ufht_qGHEH2oY8wdCI_5Q05g_BsqKD9UFH7bxhxpG_KGGMX8gNOIPNY35w27jj1EbhathROFqGFM4QiMKV9PoBLgaIBcVZ0hTYVcTREfkCI2oHKExmWM4onMEx4TOruaIjtLZ1RzRkTpCI1pHaEzsGI6oHcFRuatnKOsjctcZotdnrjNFdWlU7lpzVBdH5a6epJjcdUapLo3JXWuYauOY3LXG6TWunqdshMhdZ6Jen7nOSNWlUblrDVVdHJM7V0_VstyXj9_9GwAA___wWdUX query T EXPLAIN SELECT * FROM grandchild2 JOIN parent1 USING(pid1) WHERE @@ -542,7 +665,7 @@ vectorized: true # Note there are 5 nodes because the filter cid2 >= 12 AND cid2 <= 14 # creates a giant parent span which requires reading from all rows. query T -SELECT url FROM [EXPLAIN (DISTSQL) +EXPLAIN (DISTSQL) SELECT * FROM child2 JOIN grandchild2 ON child2.pid1=grandchild2.pid1 AND child2.cid2=grandchild2.cid2 @@ -551,9 +674,28 @@ SELECT url FROM [EXPLAIN (DISTSQL) child2.pid1 >= 5 AND child2.pid1 <= 7 OR child2.cid2 >= 12 AND child2.cid2 <= 14 OR gcid2 >= 49 AND gcid2 <= 51 -] ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJzsl12P4jYXx--fT2Gd54Z0TBM7L4RII2XVZVVWs7BlRmqlLRdZ4kIkltAkSF2N5rtXITDkBXziyY7oxdwltn_xOcf_v4_yCOnfa_DgfnQ3-uWB7JI1-TCbfiJfRn98vns3npDe-_H9w_1vdxo5LPmpWLBYReuQk4_T8YQsk2ATHgamE9LrFc8_b6OQkdvy9H5II-8m78lx0SIKeW1RPqQ1VpnNVaZGfv91NBuRXnXPP3eGYYpbYlc_cppb3JKBppHp7BTsPo4jyPiZII8ks7Qju6xQ1vBALSvrbaZpc6CwiUMxCb6JFLwvwIACBwomULCAgg1zCtskXog0jZN8yeMeGIf_gGdQiDbbXZYPzyks4kSA9whZlK0FePAQfF2LmQhCkegGUAhFFkTr_TZF_P42ib4FyXegcL8NNqlH-jrX_6_bjs50ixfPrs50ToJNSEwSZyuRpDB_ohDvssPOpw2_fierIF1Vt_IZ9Tn1TZg_zSmkWbAU4LEn-rI87OrHSwf_Y5I5hchVQvwQrTORiERntUIXE16uRL8kQM_zxpMH96ALvyS_48xBSX5ZfDWqLL1n7MhZJfnVOKskwWfuBxyqebFip6_FSSgSEda_dkN9fkN98yYPQ2n1mcP4JJKl-BhHm_w8aoJZi7-yXukL2m0SLVfVIaAw3WUeOSZJfYv6NvUd6g-o71J_eFE0VosS7Dbn0jqbySTux1udG7WV5_e2K3uz9p5i7e6GC27q61b-bOfj1uveEwo5OQr3RNfELt0ZSLinO4O93RnNil3xznCueGfw9hrnLX1bknFfd5617hTPudad1_WtQk4DFd92TOySb5FwT77lb75tVuyKvh1c0bdme42bLX17XtF93X1dtypk4qq49UXpXPIoEuTJo-abR5sVu6JH3St61GqvbKulR92-zoyjsG3j8JIrmxmva1OFZIYqNn1pRpecisR5cqr15tRmxa7o1OF_5M_5TJwzkW7jTSpa_RcbeaYiXIqinmm8SxbicxIv9tsUr9M9t_8BCUWaFbNm8TLeFFN5gO1htwvMeCfa6UJzQ06zOm1U6Aps1GGuUHCuBrtd4FrBVWmnC10reIM2pQW35KdlyU-LyY_L7uIPOYz4Qw5j_kBoxB9yGvOHI634QF7wQRd_yGHEH3IY8wdCI_6Q05g_3C7-GHZRuBxGFC6HMYUjNKJwOY12gEYDqVScIZcKa3QQFZEjNKJyhMZkjuGIzhEcEzpr9BEVpbNGH1GROkIjWkdoTOwYjqgdwVG5y3sosxG5qzTR5pmrdFFVGpW7Uh9VxVG5yzspJneVVqpKY3JXaqbKOCZ3pXbaxOX9lA0Ruat01OaZq7RUVRqVu1JTVcUxuXN5V63Lff70v38DAAD__4igEZA= +distribution: full +vectorized: true +· +• merge join +│ equality: (pid1, cid2, cid3) = (pid1, cid2, cid3) +│ left cols are key +│ +├── • scan +│ missing stats +│ table: child2@primary +│ spans: FULL SCAN +│ +└── • filter + │ filter: (((pid1 >= 5) AND (pid1 <= 7)) OR ((cid2 >= 12) AND (cid2 <= 14))) OR ((gcid2 >= 49) AND (gcid2 <= 51)) + │ + └── • scan + missing stats + table: grandchild2@primary + spans: FULL SCAN +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJzsl12P4jYUhu_7K6zTG9IxTex8ECKNlFWXVVnNwpYZqZVaLrLEhUgsoUmQuhrNf69CYMgH-MSTHdGLuUtsP_E5x-_rozxC-s8aPBj98fnu3XhCeu_H9w_3v91p5H50N_rlgfxEPsymn8hiFa1DTj5OxxOyTIJNeBiYTkivVzz_vI1CRm7L0_shjbybvCfHRYso5LVF-ZDWWGU2V5ka-f3X0WxEetU9_9oZhiluiV39yGlucUsGmkams1Ow-ziOIONngjySzNKO7LJCWcMDtayst5mmAYVNHIpJ8FWk4P0JDChwoGACBQso2DCnsE3ihUjTOMmXPO6BcfgveAaFaLPdZfnwnMIiTgR4j5BF2VqABw_Bl7WYiSAUiW4AhVBkQbTeb1OE72-T6GuQfAMK99tgk3qkr3P9R912dKZbvHh2daZzEmxCYpI4W4kkhfkThXiXHXY-bfjlG1kF6aq6lc-oz6lvwvxpTiHNgqUAjz3Rl-VhVz9eOvfvk8wpRK4S4odonYlEJDqrFbqY8HIh-iX9eZ43njy4B1n4JfUdZw5C8svaq1Fl5T1jR84qqa_GWSUFPnPf4VDNixU7fS1OQpGIsP61G-rzG-qbN3kYSqvPHMYnkSzFxzja5OdRE8xa_J31Sl_QbpNouaoOAYXpLvPIMUnqW9S3qe9Qf0B9l_rDi6KxWpRgtzmX1tlMJnE_3urcqK08v7dd2Zu19xRrdzdccFNft_JnOx-3XveeUMjJUbgnuiZ26c5Awj3dGeztzmhW7Ip3hnPFO4O31zhv6duSjPu686x1p3jOte68rm8Vchqo-LZjYpd8i4R78i1_822zYlf07eCKvjXba9xs6dvziu7r7uu6VSETV8WtL0rnkkeRIE8eNd882qzYFT3qXtGjVntlWy096vZ1ZhyFbRuHl1zZzHhdmyokM1Sx6UszuuRUJM6TU603pzYrdkWnDv8nf85n4pyJdBtvUtHqv9jIMxXhUhT1TONdshCfk3ix36Z4ne65_Q9IKNKsmDWLl_GmmMoDbA-7XWDGO9FOF5obcprVaaNCV2CjDnOFgnM12O0C1wquSjtd6FrBG7QpLbglPy1LflpMflx2F3_IYcQfchjzB0Ij_pDTmD8cacUH8oIPuvhDDiP-kMOYPxAa8YecxvzhdvHHsIvC5TCicDmMKRyhEYXLabQDNBpIpeIMuVRYo4OoiByhEZUjNCZzDEd0juCY0Fmjj6gonTX6iIrUERrROkJjYsdwRO0Ijspd3kOZjchdpYk2z1yli6rSqNyV-qgqjspd3kkxuau0UlUak7tSM1XGMbkrtdMmLu-nbIjIXaWjNs9cpaWq0qjclZqqKo7Jncu7al3u86cf_gsAAP__Ue8MMQ== query T EXPLAIN @@ -588,12 +730,30 @@ vectorized: true # Aggregation over parent and child keys. query T -SELECT url FROM [EXPLAIN (DISTSQL) +EXPLAIN (DISTSQL) SELECT sum(parent1.pid1), sum(child1.cid1) FROM parent1 JOIN child1 USING(pid1) WHERE pid1 >= 10 AND pid1 <= 39 -] ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJzEl1Fvo0YQgN_7K1bTF1uHD3YBGyNFctRzW58S5xrn1EpXP3BmayM54C4g9RTlv1eAlWBwdtgA8psX-HZndr_xwBPE_-7BhdX8Zv7LA0nFnvx6f3dLvs3_-nJzvViSwafF6mH1x82QHB-J08fBwRM8TOjHQ-DToZZf2uyCvU8_brIrxRTHh8jnu8WSFLfJ19Vi-RsZ5Bz58_f5_bwYkL9TwzD5FaHGkFwvP5Wvbq6IOR2uQYMw8vnSe-QxuN-AggYMNDBBAws0sGGtwUFEGx7HkcgeecqBhf8fuIYGQXhIk-zyWoNNJDi4T5AEyZ6DCw_e9z2_557PhZ7N6_PEC_b5MscsZgcRPHriB2iwOnhh7BKdGvrPuj3WqW4bx4GjU50aI52ybGRntxjxQp8wEiU7LmLQ4C5NXDKjsH7WIEqTY1CvsXz_QXZevDuNIn9-rUGceFsOLn3W3pfc-HTa4lQ6z02bsVbpsTfTe50nEj4X3K_O8yFbuNFTZ3bqlost_xwFYaZBxYM9_ycZzOiH4ZUItrviZzljs5LxazamymFdb7eCb70kEjqtHNbq6-1gRrNF819s-OaKVoP9S8Nze3N2W0oxMeO9MdknMdHmyrLG9VgSc6RT68Vg6zjIDbb6r0eF5CZN67FVbt3WI71MPbJ-6hE5rHI9TrqpR9ZcD7Ox-28ZMdLpuH_jFVJymhr_joy69ZxdxnOzH8-RIyp77nTjudlcCqux5-ORTp0XM5zjIDfD6d9zhZSmTT1_R0bdem5exnOrH8-RIyp7Pu3Gc6u5FEbzb4vR2-_guRVmn54rpGQrfVHYOlVPrFvdrcvobvSjO3JSZd3t7j8nzqx4z-NDFMa88llxfmYj2zbub3lxGHGUig3_IqJNvkwxvMu5_EXN53FS3KXTYrQIi3tZhM1p1gaetIEpbUXbcpqq7BlTo1kbeNIGruyZKm3LaValjTJtnsBGFTalsCU_LUsKMypf2m5VH3IaqQ85jNQHEjdSHwiN1Me4VX3IaaQ-5DBSH0jcSH0gNFIfE6mljlxSp019TFsZLqcRw-UwYjgSN2I4QmMdQKlt1v9KVfqmKo01AaXOqYwjmtNaFzlRlTK56FTeRhDTaa2PKKmO4IjrCI3IjoWO2I7hmO61HqqmuxzHdJfTmO5I6JjuCI7pXmukp7qPEd1rPUVJ91pPUdNdjmO6y2lMdyR0THcEx3Sv9VM13eU4prucxnRHQsd0R3BM91pXPX3XNuS6s1pvkeq-fv7p_wAAAP__5IILNw== +distribution: full +vectorized: true +· +• group (scalar) +│ +└── • merge join + │ equality: (pid1) = (pid1) + │ left cols are key + │ + ├── • scan + │ missing stats + │ table: parent1@primary + │ spans: [/10 - /39] + │ + └── • scan + missing stats + table: child1@primary + spans: [/10 - /39] +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJzEl-GPokYUwL_3r5i8ftEcHswAiiSbuOnZ1suue1330iatHziZKokLdsCkl83-7xfA7CLoPEYgfnOA38x7M7_ngxeI_9uCC9O_vtzdzuak92m2eFr8cdcni-nd9JcnEu-feztP8DChH3eBT_tadmm1CbY-_bhKr5BfHx_uyeEh8vlhNif5bfJ1MZv_RnoZR_78ffo4zQfkn71hmPyGUKNPbuefildXN8Qc90GDMPL53HvmMbh_AwUNGGhgggYWaGDDUoOdiFY8jiORPvKSATP_f3ANDYJwt0_Sy0sNVpHg4L5AEiRbDi48ed-2_JF7Phd6Oq_PEy_YZssckpjsRPDsie-gwWLnhbFLdGroP-v2UKe6bRwGjk51agx0ytKRnd5ixAt9wkiUbLiIQYOHfeKSCYXlqwbRPjkE9R7Lt-9k48Wb4yiy55caxIm35uDSV-2y5IbH0-aH0npu2oQ1So-dTe99nkj4XHC_PM-HdOFaT53YqXsu1vxzFISpBiUPtvzfpDehH_o3Ilhv8p_FjM1Sxu_ZmCqHdbteC772kkjotHRYi6_3vQlNF81-sf7ZFa0a-7cPT-3NyW0pxMSMS2Oyj2Ki9ZVlteuxIOZAp9abwdZhkBlsdV-PCsmN6tZjo9zarUd6nXpk3dQjcljFehy1U4-svh5mbffPGTHQ6bB74xVScuoaf0FG7XrOruO52Y3nyBEVPXfa8dysL4VV2_PhQKfOmxnOYZCZ4XTvuUJK47qeX5BRu56b1_Hc6sZz5IiKno_b8dyqL4VR_9ticP4dPLPC7NJzhZRspS8KW6fqibWru3Ud3Y1udEdOqqi73f7nxIkVH3m8i8KYlz4rTs9spNvG_TXPDyOO9mLFv4holS2TDx8yLntR83mc5HfpOB_NwvxeGmF9mjWBR01gShvRtpymKnvG1GjWBB41gUt7pkrbcpqVaaNIm0ewUYZNKWzJT8uSwozKl7Yb1YecRupDDiP1gcSN1AdCI_UxbFQfchqpDzmM1AcSN1IfCI3Ux0hqqSOX1GlSH-NGhstpxHA5jBiOxI0YjtBYB1Bqm9W_UpW-qUpjTUCpcyrjiOa00kWOVKVMLjqVtxHEdFrpI0qqIzjiOkIjsmOhI7ZjOKZ7pYeq6S7HMd3lNKY7EjqmO4Jjulca6bHuQ0T3Sk9R0r3SU9R0l-OY7nIa0x0JHdMdwTHdK_1UTXc5jukupzHdkdAx3REc073SVY_ftQ257qzSW6S6L19_-hEAAP__vncF2A== ############### # Outer joins # @@ -701,9 +861,28 @@ vectorized: true spans: FULL SCAN query T -SELECT url FROM [EXPLAIN (DISTSQL) SELECT * FROM outer_p1 FULL OUTER JOIN outer_c1 USING (pid1)] +EXPLAIN (DISTSQL) SELECT * FROM outer_p1 FULL OUTER JOIN outer_c1 USING (pid1) ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJzMllFr4kwUhu-_XzGcK_06kszE2BpYSOnaxWK1qxYWiiypmdWATbKTCFuK_32J6dKt1TmTHRXvajLPzHvmPKTnBbKfC_Bg1Ol1rsZkKRfkeji4JQ-db3e9y26f1D53R-PR116dvC75v1yQLHMhv6eMXN_3euRm0O2_Ppoycj_q9r-QWhqFrD4BCnESin7wJDLwHoABBQ4UHKDQBAouTCikMpmKLEtkseRlDXTDX-DZFKI4XebF4wmFaSIFeC-QR_lCgAfj4HEhhiIIhbSKfUORB9FifcyffH4qo6dAPgOFURrEmUcsu2G5JIhDwkiSz4WEyYoW61_Pedv-8ZnMg2z-fmOfwWQ1oZDlwUyAx1b03_K2tuWdHjwv35n3bZ9EhkKKcHOfs-JgrVVbSr8VciZukiguWrXRq_FzKrxSpMH9uDNc6wQUFuJHXvPZWf2TjGbz8k-gMBRxKKRHrgaXvc7oqlPzGfWdOiU-p8RvUuK7lPitjWt6uwJH4wqW8bbytlbWTxpJajF3Y-X2s5vvzmb6unBtvd2GxewD-V0h8Lm23_sNzHcGPqLg_IQE5_o9c7QlY3bDYof6ilZIfKFt2Z4T852Jj6iZc0KaOfpNa-pr5jYsfqiPWYXEbX3N9puY70x8RM2aJ6RZU79ptq5mDetQilVI6-oqts-0fGfaI-pln5BeyAA_FFmaxJnQmvXsonIRzkR5n1mylFNxJ5Pp-pjy52DNreeUUGR5-Za55a9uXL4rEurT3ARumcBtE5ghuVmVK-PVaG4Ct0zgtgnMkNx8k7b_ph31fTtKmL2v2t6km0aCq2lEFDWMCK6GEcGRopHcrpHgahoRRQ0jgqthRHCkaCR3y0TwcyNF1TTSajWMKKqGEUWRopHcF0aKqmmk1WoYUVQNI4oiRSO52yaKMrM5AcGxf7hGkwJCI5pihWPRDYcFs2nBbFwwmxfMBgZmNDGwDyNDNVvVONZyNY3ZqqYxW5HCseiVhqWPTasyLVWlMVurzEtVadTWD8OD0tbJ6r_fAQAA__8cdcZP +distribution: full +vectorized: true +· +• render +│ +└── • merge join (full outer) + │ equality: (pid1) = (pid1) + │ left cols are key + │ + ├── • scan + │ missing stats + │ table: outer_p1@primary + │ spans: FULL SCAN + │ + └── • scan + missing stats + table: outer_c1@primary + spans: FULL SCAN +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJzMlvFr2kAUx3_fX3G8n3Q9Se5ibA0MUjo7LFY7tTAYMlJz04BNskuEleL_PmI6ulq9d9mp-FtN7nP3ffc-pO8Zsl8L8KDz7a532e2T2ufuaDz62quTUafXuRqTj-R6OLglyTIX8kfKyPV9r0duBt3-y6MpI_ejbv8LqaVRyOpAIU5C0Q8eRQbed2BAgQMFByg0gYILEwqpTKYiyxJZLHleA93wN3g2hShOl3nxeEJhmkgB3jPkUb4Q4ME4eFiIoQhCIa1i31DkQbRYH_M3np_K6DGQT0BhlAZx5hHLblguCeKQMJLkcyFhsqLF-pdzXrd_eCLzIJu_3dhnMFlNKGR5MBPgsRX9v7ytbXmnB8_Ld-Z93SeRoZAi3NznrDhYa9WW0m-FnImbJIqLVm30avyUCq_0aHA_7gzXNgGFhfiZ13x2Vv8ko9m8_BMoDEUcCumRq8FlrzO66tR8Rn2nTonPKfGblPguJX5r45per8DRuIJlvK28rZX1k0aSWszdWLn97Oabs5m-Llxbb7dhMftAflcIfK7t934D852Bjyg4PyHBuX7PHG3JmN2w2KG-ohUSX2hbtufEfGfiI2rmnJBmjn7TmvqauQ2LH-pjViFxW1-z_SbmOxMfUbPmCWnW1G-aratZwzqUYhXSurqK7TMt35n2iHrZJ6QXMsAPRZYmcSa0Zj27qFyEM1HeZ5Ys5VTcyWS6Pqb8OVhz6zklFFlevmVu-asbl--KhPo0N4FbJnDbBGZIblblyng1mpvALRO4bQIzJDffpO1_aUd9344SZm-rtjfpppHgahoRRQ0jgqthRHCkaCS3ayS4mkZEUcOI4GoYERwpGsndMhH83EhRNY20Wg0jiqphRFGkaCT3hZGiahpptRpGFFXDiKJI0UjutomizGxOQHDsH67RpIDQiKZY4Vh0w2HBbFowGxfM5gWzgYEZTQzs3chQzVY1jrVcTWO2qmnMVqRwLHqlYel906pMS1VpzNYq81JVGrX13fCgtHWy-vAnAAD__6IKwPA= query T EXPLAIN (VERBOSE) SELECT * FROM outer_gc1 FULL OUTER JOIN outer_c1 USING (pid1, cid1, cid2) @@ -743,9 +922,28 @@ vectorized: true spans: FULL SCAN query T -SELECT url FROM [EXPLAIN (DISTSQL) SELECT * FROM outer_gc1 FULL OUTER JOIN outer_c1 USING (pid1, cid1, cid2)] +EXPLAIN (DISTSQL) SELECT * FROM outer_gc1 FULL OUTER JOIN outer_c1 USING (pid1, cid1, cid2) ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJzUl1Fv2joUx9_vp7DOE9waJXYILZGulKqXXlFR6AUqTarQlBIPkGiSOUFaVfHdp0C3Fgo-9jyGeJlEyM_--5yf2ekL5F_nEMCg1WldDclCzsl1v3dLHlqf7jqX7S6p_NseDAf_d6rk9ZW_1y-ki0LIz5MxI9f3nQ656bW7r8_GjNwP2t3_SCWbxYyS8Y9_eXUEFJI0Ft3oSeQQPAADChwoeEChDhR8GFHIZDoWeZ7K8pWXFdCOv0HgUpgl2aIoH48ojFMpIHiBYlbMBQQwjB7noi-iWEinXDcWRTSbr7b5GTbM5Owpks9AYZBFSR4Qx605PomSmDCSFlMhYbSkJfC60dv6j89kGuXTzZVDRkNOQw9GyxGFvIgmAgK2pL8Wu7Er9p9KzfemflstlbGQIt5e7YyG_IyG3lkZw-jtHQW5FXIibtJZUvZxq5HD50wEa-N698NWf-UdUJiLL0Xl3crVf-RsMt18BBT6IomFDMhV77LTGly1KmUhGlX67gGn4fnGA4-GF1VKwjoloU9J2Nwq9VsBPY0CLpJdRdlZh25aSzOH-Vtv7t67vrE301eO698Uv-Yw96BXxSD3ufZVOURsvjf2Ee8KP9m7wvX77un7ytyaww77224Q_EJb2IPk5ntzH9FY72SN9fQbXzcw1q85_LA_sQbBm_rGHiI335v7iMbWT9bYun7jXW1ja85hbTUI7eva-vsz872Zj2iqe7KmIn8w9UWepUkutOZit6yTiCdi3Y08XcixuJPpeLXN-mNvxa3GuFjkxfpb5q8_tZP1d2VCfZrbwA0buGkDMyQ3MykZN6O5DdywgZs2MENy823afU976np7SphtntrdputWgqtpRBQ1jAiuhhHBkUMjuX0rwdU0IooaRgRXw4jgyKGR3A0bwc-tFFXTSKvVMKKoGkYURQ6N5L6wUlRNI61Ww4iiahhRFDk0krtpoyizmxMQHPsP12pSQGhEU-zgWHTLYcFuWrAbF-zmBbuBgVlNDOzDyGBmqxrHWq6mMVvVNGYrcnAsutGw9LFpJtOSKY3ZajIvmdKorR-GB6Wto-Vf3wMAAP__mJcbjw== +distribution: full +vectorized: true +· +• render +│ +└── • merge join (full outer) + │ equality: (pid1, cid1, cid2) = (pid1, cid1, cid2) + │ right cols are key + │ + ├── • scan + │ missing stats + │ table: outer_gc1@primary + │ spans: FULL SCAN + │ + └── • scan + missing stats + table: outer_c1@primary + spans: FULL SCAN +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJzUl1Fv2joUx9_vp7DOE9waJXYILZGulKqXTlQUOqDSpAlNKfEAiSaZE6RVFd99CnRroeBjz2OIl0mE_Oy_z_mZnT5D_m0OAbQ-3XUu211S-b89GA4-dqpk0Oq0robkX3Ld792SdFEI-WUyZuT6vtMhN7129-XZmJH7Qbv7gVSyWcwoGf_8l1eBQpLGohs9ihyCz8CAAgcKHlCoAwUfRhQymY5FnqeyfOV5BbTj7xC4FGZJtijKxyMK41QKCJ6hmBVzAQEMo4e56IsoFtIp141FEc3mq21-ZQ0zOXuM5BNQGGRRkgfEcWuOT6IkJoykxVRIGC1pCbxs9Lr-wxOZRvl0c-WQ0ZDT0IPRckQhL6KJgIAt6e_FbuyK_bdS872pX1dLZSykiLdXO6MhP6Ohd1bGMHp7R0FuhZyIm3SWlH3cauTwKRPBWrje_bDVX2kHFObia1F5s3L1PzmbTDcfAYW-SGIhA3LVu-y0BletSlmIRpW-ecBpeL7xwKPhRZWSsE5J6FMSNrdK_VpAT6OAi2RXUXbWoZvW0sxh_tabu_eub-zN9JXj-jfFrznMPehVMch9rn1VDhGb7419xLvCT_aucP2-e_q-MrfmsMP-thsEv9AW9iC5-d7cRzTWO1ljPf3G1w2M9WsOP-xPrEHwpr6xh8jN9-Y-orH1kzW2rt94V9vYmnNYWw1C-7q2_vnMfG_mI5rqnqypyB9MfZFnaZILrbnYLesk4olYdyNPF3Is7mQ6Xm2z_thbcasxLhZ5sf6W-etP7WT9XZlQn-Y2cMMGbtrADMnNTErGzWhuAzds4KYNzJDcfJt239Keut6eEmabp3a36bqV4GoaEUUNI4KrYURw5NBIbt9KcDWNiKKGEcHVMCI4cmgkd8NG8HMrRdU00mo1jCiqhhFFkUMjuS-sFFXTSKvVMKKoGkYURQ6N5G7aKMrs5gQEx_7DtZoUEBrRFDs4Ft1yWLCbFuzGBbt5wW5gYFYTA3s3MpjZqsaxlqtpzFY1jdmKHByLbjQsvW-aybRkSmO2msxLpjRq67vhQWnraPnPjwAAAP__-rwWMA== query T EXPLAIN (VERBOSE) SELECT * FROM outer_c1 LEFT OUTER JOIN outer_p1 USING (pid1) WHERE pid1 >= 0 AND pid1 < 40 @@ -780,9 +978,26 @@ vectorized: true parallel query T -SELECT url FROM [EXPLAIN (DISTSQL) SELECT * FROM outer_c1 LEFT OUTER JOIN outer_p1 USING (pid1) WHERE pid1 >= 0 AND pid1 < 40] +EXPLAIN (DISTSQL) SELECT * FROM outer_c1 LEFT OUTER JOIN outer_p1 USING (pid1) WHERE pid1 >= 0 AND pid1 < 40 ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJzMlVFv2jAQx9_3KazbS1mNYidAS6RKqVa6UVHogGqTumhKyQ0i0SRzEmlVxXefIJ1aULDNTNu9kdg_3__MT7kHyH7NwYVRp9f5OCaFmJPz4eCS3HS-XfVOu31ycNYdjUdfejXyuOVDuSEpchQ_Jpz0OudjcjHo9h9fpZxcj7r9T-QgjUJeI18_d4ad8oF8Lxhz8ISwGjntnz1_OSENVvOBQpyE2A_uMAP3BjhQsIGCAxQa4FNIRTLBLEvEcvlhtbkb_gaXUYjitMiXr30Kk0QguA-QR_kcwYVxcDvHIQYhCosBhRDzIJqvSvztw0tFdBeIe6AwSoM4c4nFrPdWi1m8bjVJEIeEkySfoQB_QZfYY7mnKrf3ZBZks_XzPQ7-wqeQ5cEUweUL-m-xG1Wx08rY-8xrb837dE4iQhQYbp5zuCystaui9UsUU7xIohiFdbzOjO9TdEvtBtfjznAlH1CY48_8wOOHtRMRTWflT6AwKHKXeJx6NvUc6jWo19q4kaduHY1ui7iqk8om-kk9SS1ub-ysrt1Yq831zeDaQjfrFmcvpPIOgZvaKu83sL018Ou53H4jl239v8fW9omzusVf6tu4Q-KWtlB7TmxvTfx6RnH2Rko5-n-Qo69Us27ZL_WN2iHxkb5S-01sb038ikrx_2DiVmQcYpYmcYZa85Qtu8RwiuXdZUkhJnglksmqTPk4WHGrWRBilperdvnQjculZUB9uGUCt01grsjNd2ja3g1umcBtE5grctubNHtOO_Ibc6QwX6fZJt0wkUwOKySTwwrJ5LBKsqaJZHJYIZkcVkgmh1WStUwkOzLRRA4rNJHDCk3ksEqTYxNN5LBCEzms0EQOqzRpm2jCjWaWglaIoqAVpiho5dgym1tmg8tscpmNLr7b7PIX7_4EAAD__yaJcIw= +distribution: full +vectorized: true +· +• merge join (left outer) +│ equality: (pid1) = (pid1) +│ right cols are key +│ +├── • scan +│ missing stats +│ table: outer_c1@primary +│ spans: [/0 - /39] +│ +└── • scan + missing stats + table: outer_p1@primary + spans: [/0 - /39] +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJzMlVFv2joUx9_vp7DOfSm3RrEToCVSpVS36b1UFDqg2qQNTSk5g0g0zpwgrar47hOkUwsKtplpuzcS--fzP-annEfIv8_Bh_DTTfe80yNHF53haPihWyPDsBv-OyL_kMtB_5qIRYHy64STbng5Ilf9Tu_pVcbJ7bDT-48cZUnMa-Tj_-EgLB_IlwVjHp4RViPnvYuXLyekwWpAIRUx9qJ7zMH_DBwouEDBAwoNGFPIpJhgngu5Wn5cb-7EP8BnFJI0WxSr12MKEyER_EcokmKO4MMoupvjAKMYpcOAQoxFlMzXJX61EWQyuY_kA1AYZlGa-8Rhzt9Oizm87jRJlMaEE1HMUMJ4SVfYU7nnKncPZBbls83zAw7j5ZhCXkRTBJ8v6e_FblTFzipjHzKvuzPv8zlCxigx3j7neFXYaFdF69cop3glkhSlc7rJjB4y9Evr-rejcLB2DyjM8VtxFPDj2plMprPyJ1DoLwqfBJwGLg08GjRo0Nq6keduPYNuF2lVJ5VN9ERdZA53t3ZW125s1ObmZnBjoZt1h7NXUnmPwE1jlQ8b2N0Z-O1cbr-Ty6753-Ma-8RZ3eGv9W3cI3HLWKgDJ3Z3Jn47ozh7J6U88z_IM1eqWXfc1_pG7ZH4xFypwyZ2dyZ-Q6X4HzBxKzIOMM9EmqPRPGWrLjGeYnl3uVjICd5IMVmXKR_7a249C2LMi3LVLR86abm0CmgOt2zgtg3MNbn5Hk27-8EtG7htA3NNbnebZi9pT31jnhLmmzTbphs2kqlhjWRqWCOZGtZJ1rSRTA1rJFPDGsnUsE6ylo1kJzaaqGGNJmpYo4ka1mlyaqOJGtZoooY1mqhhnSZtG0241czS0BpRNLTGFA2tHVt2c8tucNlNLrvRxfebXePlXz8DAAD__wLcay0= query T EXPLAIN (VERBOSE) SELECT * FROM outer_p1 RIGHT OUTER JOIN outer_gc1 USING (pid1) WHERE pid1 >= 1 AND pid1 <= 20 @@ -817,59 +1032,200 @@ vectorized: true parallel query T -SELECT url FROM [EXPLAIN (DISTSQL) SELECT * FROM outer_p1 RIGHT OUTER JOIN outer_gc1 USING (pid1) WHERE pid1 >= 1 AND pid1 <= 20] +EXPLAIN (DISTSQL) SELECT * FROM outer_p1 RIGHT OUTER JOIN outer_gc1 USING (pid1) WHERE pid1 >= 1 AND pid1 <= 20 ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJzMldFO2zAUhu_3FNbZDR2uEjttoZGQgkaAoNKyNmiTWDSFxmsjlThzEmkI9d2nNmjQKrWTGZXdNbG_nv84n3yeIPu1ABsm7sD97KNCLND5eHSN7txvN4NTb4gOzryJP_kyaKHnLZ_KDbzImfiREjT2Li59dDXyhs_vZlOCbife8AIdpHFEWujrpTt2ywf0vTBNi50g0kKnw7PXL6cniJqtADAkPGLD8IFlYN8BAQwUMFiAoQMBhlTwKcsyLlbLT-vNXvQbbBNDnKRFvnodYJhywcB-gjzOFwxs8MP7BRuzMGLCMAFDxPIwXqxL_I3tpCJ-CMUjYJikYZLZyCDGR6NnGqRtdFGYRIggns-ZgGCJV9xzvZcy949oHmbzzQIOgWAZYMjycMbAJkv8b7k7VbnTythvmZfuzPvyP1xETLBo-38OV4Vr7apo_ZqJGbviccKEcbzJ-I8ps9HAPffR6NZ3x2v_AMOC_cwPHHLYOhHxbF7-BAyjIreRQ7BzhB2KHQs7Hex0tw7lpWGrRsNFUtVMZR9D3uapQejWzuranY3apL4cpL7U3bZBzDdUuEHKbm2F9UPSnSH3523__byl9b8KbXAhmm2DbEfQkadBzF79-08_Jd2Zcn_2EPP99LHqfxergT7dtkHf8u5pEPOovj76KenOlHvUh_wfU7Mi5phlKU8yVmsmmqtGWTRj5fFlvBBTdiP4dF2mfBytufU1H7EsL1dp-eAl5dIqYH24pwP3dWCiyE0aNE2bwT0duK8DE0Vuuk2br2lLfmKWFCabtLlNd3Qkk8MKyeSwQjI5rJKsqyOZHFZIJocVkslhlWQ9HcmOdDSRwwpN5LBCEzms0uRYRxM5rNBEDis0kcMqTfo6mhCtmaWgFaIoaIUpClo5tvTmlt7g0ptceqOLNJtdwfLDnwAAAP__9zxeRA== +distribution: full +vectorized: true +· +• merge join (left outer) +│ equality: (pid1) = (pid1) +│ right cols are key +│ +├── • scan +│ missing stats +│ table: outer_gc1@primary +│ spans: [/1 - /20] +│ +└── • scan + missing stats + table: outer_p1@primary + spans: [/1 - /20] +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJzMlVFv2jwUhu-_X2Gd76asRokdoCVSpVQrbVNR6CDVJm1oSskZRKJx5gRpVcV_nyDVWlCwk7lqd0diP5z3OI98HiH7uQAXel9u-qf-gByc-eNg_KnfIONev_cxIB_I-Wh4TcQyR_k9ZWTkX1wG5GroD57ezaaM3I79wQU5SOOINcjny96oVzyQb0vbdvCEsAY5HZy9fDk9IdxuAIVERDgI7zED9yswoMCBggMUWjChkEoxxSwTcr38uNnsR7_AtSnESbrM168nFKZCIriPkMf5AsGFILxb4AjDCKVlA4UI8zBebEr8Se2lMr4P5QNQGKdhkrnEYtb_Vse2WNNqkzCJCCMin6OEyYquuad6z2XuHsg8zObbBTwGk9WEQpaHMwSXrejf5W6V5U5LY79mXr437_P_CBmhxGj3fw7XhSvtKmn9GuUMr0ScoLSOt5ngIUWX9HvnARneBr3RRj-gsMAf-YHHDhsnMp7Ni59AYbjMXeIx6h1Rj1PPoV6Leu2dQ3lu2KnQ8DIpa6a0j4FoitRifGdnee3WVm1WXQ5WXep202L2KypcI2W7ssLmIfnekG_nbff9vOXVvwqvcSHaTYvtRjCRp0bMTvX7zzwl35vy7exh9vvp41T_Lk4NfdpNi7_m3VMj5lF1fcxT8r0p31Af9m9MzZKYI8xSkWRYaSba60YxmmFxfJlYyineSDHdlCkehxtuc81HmOXFKi8e_KRYWgesDndM4K4JzDS5WY2meT24YwJ3TWCmyc13afsl7ahPzFHCbJu2d-mWiWRqWCOZGtZIpoZ1krVNJFPDGsnUsEYyNayTrGMi2ZGJJmpYo4ka1miihnWaHJtoooY1mqhhjSZqWKdJ10QTZjSzNLRGFA2tMUVDa8eW2dwyG1xmk8tsdLF6s2uy-u93AAAA___waljl query T -SELECT url FROM [EXPLAIN (DISTSQL) SELECT * FROM child1 JOIN child2 USING(pid1)] +EXPLAIN (DISTSQL) SELECT * FROM child1 JOIN child2 USING(pid1) ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJzEll1r2zAUhu_3K8TZTbsqyJI_mhgGHls3UtqkazoYlFy4sZYYUjuTHVgp-e_Dcbe2-dCRJ-LdybYeH706z8V5hOLnHEIYnV2cfbwhSzUnn6-Hl-T27PvVxYf-gBx96o9uRl8vjsnTlnf1hsksnSecnA_7g3otyLdRf_CFHC3ShB-PgUKWJ3IQ38sCwlvgQEEABRcoeEDBhzGFhconsihyVW15XAP95BeEDoU0WyzL6vWYwiRXEsJHKNNyLiGEm_huLq9lnEjFHKCQyDJO5-sy9bGihUrvY_UAFEaLOCtC0mGCvWV-wDjzRL3uMs4EibOEuCQvZ1IVMF5RyJflU-XngncPZBYXs9elIg7j1ZhCUcZTCSFf0X9L4O9IIP5HArE3wfN_cpVIJZPN_5xUhY127biMS6mm8jxPM6kY3-jnXP4ojyJ-cvxepdNZvQQKw2UZkojTSNDIpZFPo4BGpxvpn5O5BsmW2a5T7zzwIO_kC8b9jZ27a3uvanNzL7iZ2Xu06DCvWvvVe-9QljdIE5hZ3m4asTdNi8bzwxsvzPskDK170Y8OC_42LajXVdOCQ1nXIM2poXWtphF707RonTi8da55n1xD63a3psO6h3KtQYauoWstZBB7M7RomHt4wzzz7niGhnU7jDt_OuQ7Tw9Vi7hzKMkaxOgZStZODLE3Roueee1OjDuOcy2LRZ4V0mgedKpAMpnK-pqKfKkm8krlk3WZ-nG45tYTSSKLsv4q6od-Vn-qDmgOBzZwzwbmVufmvp7mDa5MNIMDG7hnA3Orc29c2RYtNmnnJe3q79vVwvz1nTmbtGcjuB5GBNfDiOB6GBMcoRHBfRvB9TAiuB5GBNfDmOAIjQge2Ah-aqOoHkYU1cOIonoYUxShEUW7NorqYURRPYwoqocxRREaUbRnoyi3mhMQGpEUoRFLERrTFMOxWcFuWLCbFuzGBct5wW5g4FYTA98aGRrZqqcxW_U0ZqueRm1FcMzWJsPSds-aTEtNaczWRvNSYxyzdWt40No6Xr35HQAA__-ki7aF +distribution: full +vectorized: true +· +• merge join +│ equality: (pid1) = (pid1) +│ +├── • scan +│ missing stats +│ table: child1@primary +│ spans: FULL SCAN +│ +└── • scan + missing stats + table: child2@primary + spans: FULL SCAN +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJzEll1r2zoYx-_PpxDPuWlPFWTJL00MB3w460ZKm3RNB4ORCzfWEkNqZ7IDKyXffTju1jYveuQJe3dy4p-lv57fxf8Jim9LCOHi883Vf8MROXk3nNxNPl6dksnF1cX_d-Qf8v52fE1mi3SZcHI5Ho7qtSCfJsPRB3KyShN-ChSyPJGj-EEWEH4BDhQEUHCBggcUfJhSWKl8JosiV9UrT1tgmHyH0KGQZqt1Wf08pTDLlYTwCcq0XEoI4S6-X8pbGSdSMQcoJLKM0-V2m_pU0UqlD7F6BAqTVZwVIekxwf5mfsA480S97jPOBImzhLgkLxdSFTDdUMjX5fPOLxveP5JFXCzebhVxmG6mFIoynksI-Yb-XgL_QALxJxKIowlevpOrRCqZ7H7nrNrY6K0Dl3Et1Vxe5mkmFeM781zKr-VJxM9O_1XpfFEvgcJ4XYYk4jQSNHJp5NMooNH5TvqXZK5BsnV26NQHDzzKe_mKcX_nzcN7e2_25uZecDOzj2jRY1619qvfvbYsb5AmMLO82zTiaJoOjeftGy_M5yQMrXs1jx4Lfg0tqNfV0IK2rGuQ5tzQuk7TiKNpOrROtG-daz4n19C6w6PpsX5brjXI0Dd0rYMM4miGDg1z2zfMM5-OZ2hYv8e483NCvvP8UI2IO21J1iDGwFCybmKIozE69MzrtjEeOM6tLFZ5VkijPuhUgWQyl_U1FflazeSNymfbberH8ZbbNpJEFmX9r6gfhln9V3VAcziwgQc2MLc6N_f1NG9wZaIZHNjAAxuYW51758r2aLFLO69pV3_frhbmb-_M2aU9G8H1MCK4HkYE18OY4AiNCO7bCK6HEcH1MCK4HsYER2hE8MBG8HMbRfUwoqgeRhTVw5iiCI0o2rdRVA8jiuphRFE9jCmK0IiiAxtFuVVPQGhEUoRGLEVoTFMMx7qCXVmwawt2dcGyL9gVBm7VGPheZWhkq57GbNXTmK16GrUVwTFbm5Sl_Zk1aUtNaczWRn2pMY7ZulcetLZON3_9CAAA__-z6rEm query T -SELECT url FROM [EXPLAIN (DISTSQL) SELECT * FROM parent1 JOIN parent2 ON pid1=pid2] +EXPLAIN (DISTSQL) SELECT * FROM parent1 JOIN parent2 ON pid1=pid2 ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJy8lVFr2z4Uxd__n0Lc_0u7KsiSHdc1FDy2DlLapGv6MCh-cOO7xJBanuzASsl3H46zpQmJ5CCcp0i2fr4651xy36H8NYcQxjd3N1-eyELNybfH0T15vvnxcPd5MCRnXwfjp_H3u3OyPvKpOVAkCvOKk9vRYLjeCDIakiJLObmuf0QMFHKZ4jB5xRLCZ-BAQQAFFyh4QKEPMYVCyQmWpVT1kfcVMEh_Q-hQyPJiUdWPYwoTqRDCd6iyao4QwlPyMsdHTFJUzAEKKVZJNl-VWV8tKlT2mqg3oDAukrwMSY8J9j_r-4wzTzTrgHEmSJKnxCWymqEqIV5SkItqXXpT8eWNzJJytl0r4hAvYwpllUwRQr6kByRsviNVigrT3e9c1IU3pxb5vnOrWrtW3KOa4q3MclTM3_7sHH9WZxG_OL9W2XTWLIHCaFGFJOI0EjRyaeTtaN7ocVvoOeKmQ9mTBeN85-T-2t5Wbd6-HXjLdjjQDT3m1et-_dzrqjX46VvjssvWEO3jEW3j-RBDj_n_svKbdZ2V31U84vTxBF3G47aPx20bz_5EeizoKhT39KFcdRmK1z4Ur20oQY9x528wfWe9qZPhTle5HKGjv0-H2DOpra4nDl7vRG3DnVON4T0XecSykHmJrYasU0vBdIqNO6VcqAk-KDlZlWm2oxW3mlkpllXzdr0Z5M2r-oLtYc8G9m3gwAbmBtF8l3Y-0kIPCy3Mt2lnl3ZtwtLDhrD0sCEsPWwIy6DZINqzCatvY7ceNtithw1262GD3QbNBtG-jd2XNnbrYYPdethgtx422G3QbBAd2Nh9ZWO3HjbYrYcNduthg90GzaZ__mOGpTiS9qxo34oOrGhuEn7cxIyX__0JAAD__-2HEUg= +distribution: full +vectorized: true +· +• merge join +│ equality: (pid1) = (pid2) +│ left cols are key +│ right cols are key +│ +├── • scan +│ missing stats +│ table: parent1@primary +│ spans: FULL SCAN +│ +└── • scan + missing stats + table: parent2@primary + spans: FULL SCAN +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJy8lVFr2zAUhd_3K8TdS7sqyJId1zUUPLYOUtqka_owGHlw47vEkFqe7MBKyX8fjrOlCY7kIJynSLY-X51zLrlvUPxeQAg3Px7uPg-G5OzrYPw0_n53TsY3dzdfnsgn8u1xdE_yWGFWcnI7Ggw3G0FGQ5KnCSfX1Y8ACplMcBi_YAHhT-BAoXroAgUPKPRhQiFXcopFIVV15G0NDJI_EDoU0ixfltXjCYWpVAjhG5RpuUAI4Sl-XuAjxgkq5gCFBMs4XazLbG4W5Sp9idUrUBjncVaEpMcE-8j6PuPME_U6YJwJEmcJcYks56gKmKwoyGW5Kb2t-PxK5nEx360VcZisJhSKMp4hhHxFD0jYfkeqBBUm-9-5qApvTy2zpnPrWvtW3KOa4a1MM1TM3_3sAn-VZxG_OL9W6WxeL4HCaFmGJOI0EjRyaeTtad7qcVvoOeKmQ9mTOeN872RzbW-nNm_fDrxlOxzohh7zqnW_eu511Rr89K1x2WVriPbxiLbxvIuhx_z_Wfn1usrK7yoecfp4gi7jcdvH47aNpzmRHgu6CsU9fShXXYbitQ_FaxtK0GPc-RdM39lsqmS401UuR-joN-kQDZPa6nri4PVO1DbcOdUYbrjIIxa5zApsNWSdSgomM6zdKeRSTfFByem6TL0drbn1zEqwKOu3m80gq19VF2wPezawbwMHNjA3iOb7tPOeFnpYaGG-Szv7tGsTlh42hKWHDWHpYUNYBs0G0Z5NWH0bu_WwwW49bLBbDxvsNmg2iPZt7L60sVsPG-zWwwa79bDBboNmg-jAxu4rG7v1sMFuPWywWw8b7DZoNv3zHzMsxZG0Z0X7VnRgRXOT8OMm5mT14W8AAAD__7prC-k= # Join on non-interleaved column uses hash joiner. query T -SELECT url FROM [EXPLAIN (DISTSQL) SELECT * FROM parent1 JOIN child1 ON pa1 = ca1] +EXPLAIN (DISTSQL) SELECT * FROM parent1 JOIN child1 ON pa1 = ca1 ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJy8ll1r2zAUhu_3K8TZTTsUZMkfTQwFj61jKV3SNb0YFF-4sdYEUtuTHVgp-e_DcbY2H9WRJ5w7O9Fj6dV5Lt5nKH8tIITJxdXFp1uyVAvy5Wb8jdxd_Li--jgckZPPw8nt5PvVKdks-dAsKBIls4qTy_FwRKaz-SLlZDwiRcLJOZkmPAYKWZ7KUfIoSwjvgAMFARRcoOABBR9iCoXKp7Isc1UveV4Dw_Q3hA6FeVYsq_rnmMI0VxLCZ6jm1UJCCLfJ_ULeyCSVijlAIZVVMl-st9mcKyrU_DFRT0BhUiRZGZIeE-w98wPGmSea5z7jTJAkS4lL8momVQnxikK-rDZbv-x4_0RmSTnb3isSEK9iCmWVPEgI-Yr-XwR_-7PNbR4ngbuVQLyZ4OU7yyxXqVQy3fpSXJPYkgPX8DUpZ5f5PJOK8Z1JLuTP6iQSp-dq_jCrTiL3FCiMl1VIIk4jQSOXRh6N_J3EL2lcizQHjjrKe3nBuL-b--De3tbe3NwFbqjzGy70mFc_-_XvXldqt4gTmKnddRqd5vzImvNONRfmsxGmqr0aQo8F_yYVNM_1pIKuVGsR58xQtY7T6FQTR1ZNdKqaaz4b11S1w_PosX5XgrUI0TcUrJMMOq3cI2vldqqVZz4Rz1Srfo9x5-9YfGfzUs-FO12Z1SLHwNCsrmLo5PKOLJd3tBZ44CA3sizyrJRGHc-po8j0QTZXU-ZLNZXXKp-ut2lex2tuXTJSWVbNv6J5GWbNX_UBzeHABh7YwNzq3NzX07zFlYl2cGADD2xgbnXunSvbo8Uu7bymXf19u1qYb9-Zs0t7NoLrYURwPYwIrocxwREaEdy3EVwPI4LrYURwPYwJjtCI4IGN4Gc2iuphRFE9jCiqhzFFERpRtG-jqB5GFNXDiKJ6GFMUoRFFBzaKcquegNCIpAiNWIrQmKYYjnUFu7Jg1xbs6oJlX7ArDNyqMfC9ytDKVj2N2aqnMVv1NGorgmO2tilL-zNr05ba0pitrfpSaxyzda88aG2NV-_-BAAA___aKbKo +distribution: full +vectorized: true +· +• hash join +│ equality: (pa1) = (ca1) +│ +├── • scan +│ missing stats +│ table: parent1@primary +│ spans: FULL SCAN +│ +└── • scan + missing stats + table: child1@primary + spans: FULL SCAN +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJy8ll1r2zwYhs_fXyGe96QdCrLkjyaGgsfWsZQu6ZoeDIYP3FhrDKntyQ6slPz34bhbm4_qkSecM39dlm4918H9BNXPJYRw8e366v14Qk4-jme3s69Xp2R2cXXx4Za8I59upl9ImSiZ15xcTscTMl9ky5ST6YSUCSfnZJ5woJAXqZwkD7KC8Ds0DwRQcIGCBxR8iCmUqpjLqipU88nTBhinvyB0KGR5uaqbxzGFeaEkhE9QZ_VSQgi3yd1S3sgklYo5QCGVdZItN8s8bysqVfaQqEegMCuTvArJgAn2P_MDxpkn2ush40yQJE-JS4p6IVUF8ZpCsaqfl35Z8e6RLJJqsb1WJCBexxSqOrmXEPI1_bcI_vZv28M8TgJ3K4F4M8HLf1Z5oVKpZLr1p7ghsU8OHMPnpFpcFlkuFeM7k1zKH_VJJE7PVXa_qE8i9xQoTFd1SCJOI0Ejl0YejfydxC9pXIs0B7Y6KQZFybi_m_vg2t7W2tzcBW6o8xsuDJjXXPvNc68vtTvECczU7juNTnN-ZM15r5oL89kIU9VeDWHAgr-TCtrrZlJBX6p1iHNmqFrPaXSqiSOrJnpVzTWfjWuq2uF5DNiwL8E6hBgaCtZLBp1W7pG1cnvVyjOfiGeq1XDAuPNnLL7zfNPMhTt9mdUhx8jQrL5i6OTyjiyXd7QWeGAjN7Iqi7ySRh3PaaLI9F62R1MVKzWX16qYb5Zpb6cbblMyUlnV7VvR3ozz9lWzQXM4sIFHNjC32jf39TTvcGSiGxzYwCMbmFvte-fI9mixSzuvaVd_3q4W5ttn5uzSno3gehgRXA8jguthTHCERgT3bQTXw4jgehgRXA9jgiM0InhgI_iZjaJ6GFFUDyOK6mFMUYRGFB3aKKqHEUX1MKKoHsYURWhE0ZGNotyqJyA0IilCI5YiNKYphmNdwa4s2LUFu7pg2RfsCgO3agx8rzJ0slVPY7bqacxWPY3aiuCYrV3K0v7MurSlrjRma6e-1BnHbN0rD1pb4_V_vwMAAP__C7ytSQ== query T -SELECT url FROM [EXPLAIN (DISTSQL) SELECT * FROM child2 JOIN grandchild2 USING(pid1, cid2)] +EXPLAIN (DISTSQL) SELECT * FROM child2 JOIN grandchild2 USING(pid1, cid2) ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJzEll1r2zwUx--fTyHOc9OuCrbklyaGgcfWjZQ26ZoOBiUXbqwlhtTOZAdWSr77cJwtzZuONRHnzi_6Wfqf8zOcV8h_TiGAwdXN1ccHMpdT8vm-f0ser77f3Xzo9sjZp-7gYfD15pyslryrFowmyTTm5Lrf7ZGxjNJ49eDboNv7Qs5mScwoGSUxPx8ChTSLRS96FjkEj8CAAgcKDlBwgYIHQwozmY1EnmeyXPK6BLrxLwhsCkk6mxfl4yGFUSYFBK9QJMVUQAAP0dNU3IsoFtKygUIsiiiZLrepDhTOZPIcyRegMJhFaR6QlsWt_y3Pt5jl8uq6bTGLkyiNiUOyYiJkDsMFhWxerHZeb_j0QiZRPtncKmQ05DBcDCnkRTQWELAF_bcQ3uaX35T2REn4wSTrT2UyFlLE25-6oCG_KPevvXJPcW6FHIvrLEmFtNhWi6fiR3G2os_fy2Q8Wd8Chf68CMgyEQ0dGro0vKRhm4adrZqswzo1ws7TfSH2nr2XtbKZxbytlfv3djf2ZvWVYfW8PyBLy3LLa6987h7xH9AI5Gv8A42n4gdTneB_YI3-D7x-C3lNJ990qWX5f1vpV9dlK_0jOqkR6FLHyaZT8YOpTuAkb9RJp34LnZpO7m9Yy2of0USNGG0dE5vJwg9mOYF_TqP-ufUb59b0r92ymP2nb569uikbx-wjKqiRpKOjYGNx-ME4J7DQPdmkuudk9yKfZWkuas2hdplNxGNRVS7P5nIk7mQ2Wm5T3faX3HL8iUVeVG95ddNNq1flAevDvgncMYGZ0bmZp6aZRsm4HuybwB0TmBmde6tkOzTfpu23tKOut6OE2WbN7G3aNRFcDSOCq2FEcDWMCY7QiOCeieBqGBFcDSOCq2FMcIRGBPdNBL80UVQNI4qqYURRNYwpitCIom0TRdUwoqgaRhRVw5iiCI0o2jFRlBnNCQiNSIrQiKUIjWmK4disYDYsmE0LZuOC4bxgNjAwo4mB7YwMWraqacxWNY3ZqqZRWxEcs1VnWNrtmc60pEtjtmrNS9o4ZuvO8KC0dbj473cAAAD__40N3Z8= +distribution: full +vectorized: true +· +• merge join +│ equality: (pid1, cid2) = (pid1, cid2) +│ +├── • scan +│ missing stats +│ table: child2@primary +│ spans: FULL SCAN +│ +└── • scan + missing stats + table: grandchild2@primary + spans: FULL SCAN +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJzElltr2zAUx9_3KcTZS7sq2JIvTQwDj60bKW3SNR0MRh7cWEsMqZ3JDqyUfPfhOFuam441EefNt5-l_zk_wXmB_NcUArj6fnfzodsjZ5-6g4fB15tzMri6ufr4QN6Rz_f9WzKaJNOYk-t-t0fGMkrj1YNvg27vCzmbJTGjZJTE_BwopFksetGTyCH4AQwocKDgAAUXKHgwpDCT2UjkeSbLT16WQDf-DYFNIUln86J8PKQwyqSA4AWKpJgKCOAhepyKexHFQlo2UIhFESXT5TLVfsKZTJ4i-QwUBrMozQPSsrj11vJ8i1kur67bFrM4idKYOCQrJkLmMFxQyObFauX1go_PZBLlk82lQkZDDsPFkEJeRGMBAVvQ_wvhbf75VWVPlIQfTLL-VSZjIUW8_asLGvKLcv3aX-4pzq2QY3GdJamQFttq8VT8LM5W9Pl7mYwn61ug0J8XAVkmoqFDQ5eGlzRs07CzVZN1WKdG2Hm6L8TevfeyVjazmLf15f613Y21WX1lWD3vD8jSstzy2iufu0c8AxqBfI0z0HgqfjDVCc4Da_Q88Pot5DWdfNWlluX_a6VfXZet9I_opEagSx0nm07FD6Y6gZO8USed-i10ajq5v2Etq31EEzVitHVMbCYLP5jlBP45jfrn1m-cW9O_dsti9t--efbqpmwcs4-ooEaSjo6CjcXhB-OcwEL3ZJPqnp3di3yWpbmoNYfaZTYRj0VVuTyby5G4k9louUx1219yy_EnFnlRveXVTTetXpUbrA_7JnDHBGZG-2aemmYaJeN6sG8Cd0xgZrTvrZLt0Hybtl_TjrrejhJmmzWzt2nXRHA1jAiuhhHB1TAmOEIjgnsmgqthRHA1jAiuhjHBERoR3DcR_NJEUTWMKKqGEUXVMKYoQiOKtk0UVcOIomoYUVQNY4oiNKJox0RRZjQnIDQiKUIjliI0pimGY7OC2bBgNi2YjQuG84LZwMCMJga2MzJo2aqmMVvVNGarmkZtRXDMVp1habdnOtOSLo3ZqjUvaeOYrTvDg9LW4eLNnwAAAP__O8TYQA== # Subset join on interleaved columns uses hash joiner. query T -SELECT url FROM [EXPLAIN (DISTSQL) SELECT * FROM child2 JOIN grandchild2 USING(pid1, cid3)] +EXPLAIN (DISTSQL) SELECT * FROM child2 JOIN grandchild2 USING(pid1, cid3) ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJzEll1r2zAUhu_3K8TZTTsUbMkfTQwDj63bUrqkazoYFF-4sZYYUjuTHVgp-e_Dcbo2XzrWRNw7y9Zj6T3nuTiPUPyeQQCj88vzjzdkIWfk8_XwG7k9_3l1-aE_ICef-qOb0ffLU7Le8q7eMJ6ms4STi2F_QCYyzpL1ix-j_uALOZmnCaNknCbOaQQUsjwRg_heFBDcAgMKHCg4QMEFCh5EFOYyH4uiyGW15XEF9JM_ENgU0my-KKvXEYVxLgUEj1Cm5UxAADfx3UxcizgR0rKBQiLKOJ2tjqkvFM5leh_LB6AwmsdZEZCOxa23ludbzHJ5_dy1mMVJnCXEIXk5FbKAaEkhX5Trk58PvHsg07iYbh4VMho6EC0jCkUZTwQEbEn_L4S3-ecXpX2lJPxgkudfLbJcJkKKZONnUUViW_aU42tcTC_yNBPSYls9nYlf5cnqjqfvZTqZPi2AwnBRBmS1oiGnoUtDn4ZdGva2CvCczDFItufag7yTzy3mbddg79nuxtmsuR-smeQHzOhYbvXsVe_dIwqvEcjXEL71VPxgqjbkZ63Jz5v3izcU8EVLOpb_r29-_Vz1zT-igBqBznQEbDsVP5iqDQF5awI6zfvlNBRwf3c6VveI2mnE6Opo104WfjBLG7I5rcnmNu-S21C2bsdi9lOTPHu9qLrE7CP6ppGkp-Nba3H4wThtKOe-ynS551LXopjnWSEazY52FUskE1GXqcgXciyuZD5eHVMvhytuNbIkoijrr7xe9LP6U3XB5rBvAvdMYGZ0b-apaaZRMq4H-yZwzwRmRvfeKtkOzbdp-yXtqOvtKGG2WTN7m3ZNBFfDiOBqGBFcDWOCIzQiuGciuBpGBFfDiOBqGBMcoRHBfRPBz0wUVcOIomoYUVQNY4oiNKJo10RRNYwoqoYRRdUwpihCI4r2TBRlRnMCQiOSIjRiKUJjmmI4NiuYDQtm04LZuGA4L5gNDMxoYmA7I4OWrWoas1VNY7aqadRWBMds1RmWdnumMy3p0pitWvOSNo7ZujM8KG2Nlm_-BgAA__9mJ9B7 +distribution: full +vectorized: true +· +• hash join +│ equality: (pid1, cid3) = (pid1, cid3) +│ +├── • scan +│ missing stats +│ table: child2@primary +│ spans: FULL SCAN +│ +└── • scan + missing stats + table: grandchild2@primary + spans: FULL SCAN +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJzEll1r2zwYhs_fXyGe96QdCrLkjyaGgcfWbSld0jUdDEYO3FhLDKmdyQ6slPz34bhdmy891kTcM8vJZenWcx3cD1D8mkMI59-vLt_1B-TkQ390M_p6eUpG55fn72_IG_LxeviFTGbpPBHkYtgfkKmKs-TxxbdRf_CJnCzShFMySRP3FChkeSIH8Z0sIPwBHCgIoOACBQ8o-DCmsFD5RBZFrqq_PKyBfvIbQodCmi2WZfV6TGGSKwnhA5RpOZcQwk18O5fXMk6kYg5QSGQZp_P1NvV5ooVK72J1DxRGizgrQtJhgv3P_IBx5on6ucs4EyTOEuKSvJxJVcB4RSFflo87P294e09mcTHb3CriNHJhvBpTKMp4KiHkK_pvIfzNL7-42VdKIg4mef7UMstVIpVMNj42rkjsL3uu43NczC7yNJOK8a2ZzuXP8mR9xtO3Kp3OnhZAYbgsQ7Je0UjQyKNRQKMujXpbF_CczLVItufYg7yTLxj3t-9g797ext68uR-8meQHzOgwr3r2q_feEYU3CBQYCN96KnEwVRvy89bkF83nJRoK-GIkHRb8nVtQP1dzC44ooEGgMxMB204lDqZqQ0DRmoBu83m5DQXcP50O6x5RO4MYXRPt2skiDmZpQza3Ndm85lPyGsrW7TDuPA3Jdx4X1ZS4c0TfDJL0THxrLY44GKcN5bxXaZd7DnUti0WeFbJRd3SqWDKZyvqainypJvJK5ZP1NvVyuObWlSWRRVn_KupFP6t_qg7YHA5s4J4NzK3OzX09zQ2uTJjBgQ3cs4G51bm3rmyHFtu085J29fftamG-eWfONu3ZCK6HEcH1MCK4HsYER2hEcN9GcD2MCK6HEcH1MCY4QiOCBzaCn9koqocRRfUwoqgexhRFaETRro2iehhRVA8jiuphTFGERhTt2SjKrXoCQiOSIjRiKUJjmmI41hXsyoJdW7CrC5Z9wa4wcKvGwHcqg5GtehqzVU9jtupp1FYEx2w1KUu7MzNpS6Y0ZqtRXzLGMVt3yoPW1vHqvz8BAAD__xM8yxw= # Multi-table staggered join uses merge joiner on the bottom join # and a lookup join on the higher join. query T -SELECT url FROM[EXPLAIN (DISTSQL) +EXPLAIN (DISTSQL) SELECT * FROM grandchild1 JOIN child1 USING (pid1, cid1) JOIN parent1 USING (pid1) ORDER BY pid1 -] ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJzEl12P2kYUhu_7K6Znb7LNoPGMP_iQKrltthURgRQ2UquICwdPwS2x3bGRGq32v1cG2rUxnuOpC9zFGT_MnDnvsweeIPtzCyNYPEwefngkO7UlP85n78jHh1_eT74bT8mrN-PF4-LnyT05vvLN4YW1CuJwtYm2ISdvZ-MpOf77w2I8_Ym8SqOQU7KKQn5_WE4DJeO8sn5PZvM3D3Py_a-keFwChTgJ5TT4LDMYfQQOFARQsIGCAxRcWFJIVbKSWZao4pWnPTAO_4KRRSGK011e_PeSwipREkZPkEf5VsIIHoNPWzmXQSgVs4BCKPMg2u63KVXipyr6HKgvQGGRBnE2Ij0m2B1zPcaZI5hgX08_TCbMHTDOBAnikNgkyTdSZbB8ppDs8uMRXnb-9IVsgmxT3dPn1BewfF5SyPJgLWHEn-l_q8atfnLbQu4uUYRoLOLloxIVSiXD0496TX3xuti_9Ztn7uWdVGv5NoliqRg_afNW_pa_OtL336povXl5BAqzXT4i-4qob1Pfob5LfY_6_ZM7eSnWNulYcahjw_hJx45mlFo2SZI_din5PYliksTFsc4esE_9YePpnA6tOH-506SXpExUr7Vpe7eyPW8fZ24gp8bNHnOKNbdYcy4oqkFlXjtRGzy9XEGisaAbSMuvKi3SvbK03vWlFe2zJUysKQWpx7x_0-Yxr6yQd0FrDCrrt7RGU9TdJQoSjQXdwBpxVWuQ7pWt6V_fGrt9tmwTa5pF6bHBBV0xqGfQ0pXzevzfZYjGMm5giH1VQ5CelQ0ZXN8Qp32iHBNDBj3GrX-i5VrFQ0kTbl1QEoOShi0lOVPN3UUqEY2V3MAT56qeIG0rezK87Y-mM6ebyyxN4ky2-j1kFTcvw7U89DVLdmol36tktd_m8Djbc_tvpaHM8sOqODyM48NSccD2cL8LzHkn2u1ED_U0N7gzYQb3u8And2ZKu53ooZ4Wp7RVpu0KbJ3CthZ29N1ytLDg-q3dLn7oYcQPPYz5gdCIHwiN-OF18UMPI37oYcwPhEb8QGjEj742pQN9SAdd_Bh2SbgeRhKuh7GEIzSScITGJoDJ2Kz_JTWZm6Y0OgSMJqcxjsSc16ZIJapc6IPO9WMESTqvzRGTqCM0knWExsKO4UjaMRyLe22GGsVdT2Nx19No3BEcizuCY3GvDdJq3D0k7rWZYhT32kwxiruexuKup9G4IzgWdwTH4l6bp0Zx19NY3PU0GncEx-KO4Fjca1O1-l3b0sdd1GaLNu7L56_-DgAA__-EQFI5 +distribution: full +vectorized: true +· +• lookup join +│ table: parent1@primary +│ equality: (pid1) = (pid1) +│ equality cols are key +│ +└── • merge join + │ equality: (pid1, cid1) = (pid1, cid1) + │ right cols are key + │ + ├── • scan + │ missing stats + │ table: grandchild1@primary + │ spans: FULL SCAN + │ + └── • scan + missing stats + table: child1@primary + spans: FULL SCAN +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJzEl12P4jYXx--fT-HnzM1M18ix88KLVCltd1qxYmELs1KriosscSEtG6dJkLoazXevArSTEOITNwXuJpgf9vH5_-bAM2R_bGEEjz99mHwznpL7t-PF0-LHyQNZPE4ev3siX5Hv57P3ZJ0GcbjaRNuQk3ez8ZQc__64GE9_IPdJFHJKVlHIHw7LSZDKOK-sP5DZ_O3jnHz7MykegUKsQjkNPssMRr9A8YIACjZQcICCC0sKSapWMstUWrzleQ-Mwz9hZFGI4mSXFy8vKaxUKmH0DHmUbyWM4Cn4tJVzGYQyZRZQCGUeRNv9NqVC_CSNPgfpF6CwSII4G5EeE-yOuR7jzBFMsP9PP04mzB0wzgQJ4pDYROUbmWawfKGgdvnxCK87f_pCNkG2qe7pc-oLWL4sKWR5sJYw4i_031XjVj-5bSF3lyhCNBbx-lEqDWUqw9OPekN98abYv_U7z9zLe5mu5TsVxTJl_KTNW_lrfn-kH75Oo_Xm9REozHb5iOwror5NfYf6LvU96vdP7uS1WNukY8Whjg3jJx07ilFq2USp33cJ-U1FMVFxcayzB-xTf9h4OqdDK85f7lT1VMJE9Vqbtncr2_P2ceYGcmrc7DGnWHOLNeeCohpU5rUTtcHTyxUkGgu6gbT8qtIi3StL611fWtE-W8LEmlKQesz7J20e88oKeRe0xqCyfktrNEXdXaIg0VjQDawRV7UG6V7Zmv71rbHbZ8s2saZZlB4bXNAVg3oGLV05r8d_XYZoLOMGhthXNQTpWdmQwfUNcdonyjExZNBj3Po7Wq5VPJQ04dYFJTEoadhSkjPV3F2kEtFYyQ08ca7qCdK2sifD2_5oOnO6ucwSFWey1e8hq7h5Ga7loa-Z2qUr-SFVq_02h8fZntt_Kw1llh9WxeFhHB-WigO2h_tdYM470W4neqinucGdCTO43wU-uTNT2u1ED_W0OKWtMm1XYOsUtrWwo--Wo4UF12_tdvFDDyN-6GHMD4RG_EBoxA-vix96GPFDD2N-IDTiB0IjfvS1KR3oQzro4sewS8L1MJJwPYwlHKGRhCM0NgFMxmb9P6nJ3DSl0SFgNDmNcSTmvDZFKlHlQh90rh8jSNJ5bY6YRB2hkawjNBZ2DEfSjuFY3Gsz1CjuehqLu55G447gWNwRHIt7bZBW4-4hca_NFKO412aKUdz1NBZ3PY3GHcGxuCM4FvfaPDWKu57G4q6n0bgjOBZ3BMfiXpuq1e_alj7uojZbtHFfvvzvrwAAAP__cpJM2g== # Multi-table join with parent1 and child1 at the bottom uses merge # joiner but induces a hash joiner on the higher join. query T -SELECT url FROM [EXPLAIN (DISTSQL) +EXPLAIN (DISTSQL) SELECT * FROM parent1 JOIN child1 USING (pid1) JOIN grandchild1 USING (pid1, cid1) -] ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJzEl11vo0YUhu_7K6anN0l3LJjhwx9SJao2rbzyOts4K1Va-YI1U5vWy9ABS11F-e8V4G4w2HOYEtt3JvAwc-a8T479BNnfW5jA4m5299Mj2akt-eXh_h35ePf7-9mP0zm5-Xm6eFz8Nrsl-0e-rx5IQyWSnJG399M5WW3ibcTIh8V0_iu5SeOI3VY31ipMovZdSlbFM0ugkMhIzMPPIoPJR2BAgQMFByi4QMGDJYVUyZXIMqmKR55KYBr9AxObQpyku7z485LCSioBkyfI43wrYAKP4aeteBBhJJRlA4VI5GG8LZepNhSkKv4cqi9AYZGGSTYhA4tb31mebzHL5dXnkcUsTsIkIg6R-UaoDJbPFOQu36_8suCnL2QTZpvDpQJGAw7L5yWFLA_XAibsmf6_IrzDN9eOFq_k2_mH2ewc1fCT1by8SqpIKBE1X_WGBvxNsX7nJ48c0Duh1uKtjBOhLNZo81b8kd_s6dsfVLzevFwChftdPiFlRTRwaODSwKOBT4Nh40xeinVMWldsat851mjd3p1a22ZS_rVLyZ8yTohMim193eCo3OC43KN2d26HVuySY0d89GTnciBTi9uNJ4-v7R2szbqHmnUz84SYA8stPnvF390zWmpQkG9gqUbS81XGT1Z2BWPZRY1F2lg31r-8sbx7yHhHa2oZGlj-17D51eciaP4ZrTEoaGhijaaqmkKvWxk_WdkVrOEXtQZpY92a4eWtcbqHzOlozXFRBtbojK4YlDEyceW0Hq9dDz9ZzxUMcS5qCNK8uiGjyxvido-W29GQ0cBi9n_J8uz9RRErZp9REoNKxiaSHCmnZsorl8RPlnQFT9yLeoL0r-7J-Lq_mI7s7kFkqUwy0en3kF2cvIjWouprJndqJd4ruSqXqS7vS678VhqJLK_u8upimlS3ig12h4d9YMZ60V4veqynmcGZcTN42AdunJkp7fWix3qaN2m7TjsHsN2EHS3s6rvlamHO9Et7ffzQw4gfehjzA6ERPxAa8cPv44ceRvzQw5gfCI34gdCIH0NtSkf6kI76-DHuk3A9jCRcD2MJR2gk4QiNTQCTsdn-T2oyN01pdAgYTU5jHIk5a02Rg6gyrg86048RJOmsNUdMoo7QSNYRGgs7hiNpx3As7q0ZahR3PY3FXU-jcUdwLO4IjsW9NUgP4-4jcW_NFKO4t2aKUdz1NBZ3PY3GHcGxuCM4FvfWPDWKu57G4q6n0bgjOBZ3BMfi3pqqh9-1bX3ceWu2aOO-fP7m3wAAAP__QBdOhA== +distribution: full +vectorized: true +· +• lookup join +│ table: parent1@primary +│ equality: (pid1) = (pid1) +│ equality cols are key +│ +└── • merge join + │ equality: (pid1, cid1) = (pid1, cid1) + │ left cols are key + │ + ├── • scan + │ missing stats + │ table: child1@primary + │ spans: FULL SCAN + │ + └── • scan + missing stats + table: grandchild1@primary + spans: FULL SCAN +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJzEl11vo0YUhu_7K6anN0l3LJjhwx9SJao2rbzyOts4K1WqfMGaqU3rZeiApa6i_PcKcDcY7DnMEtt3JvAwc-a8T479BNk_W5jA3e_vZz9O5-Tm5-nicfHb7JYs7mZ3Pz2S78kvD_fvSBoqkeSMvL2fzslqE28jRj4spvNfyU0aR-y2urFWYRK171KyKp4BComMxDz8JDKY_AEMKHCg4AAFFyh4sKSQKrkSWSZV8chTCUyjf2FiU4iTdJcXf15SWEklYPIEeZxvBUzgMfy4FQ8ijISybKAQiTyMt-Uy1X6CVMWfQvUZKCzSMMkmZGBx6zvL8y1mubz6PLKYxUmYRMQhMt8IlcHymYLc5fuVXxb8-JlswmxzuFTAaMBh-bykkOXhWsCEPdOvK8I7fHPtZPFKvp1_mM3OUQ0_Wc3Lq6SKhBJR81VvaMDfFOt3fvLIAb0Tai3eyjgRymKNNm_Fn_nNnr79QcXrzcslULjf5RNSVkQDhwYuDTwa-DQYNs7kpVjHpHXFpvadY43W7dWptW0m5d-7lPwl44TIpNjWlw2Oyg2Oyz1qd-d2aMUuOXbER092LgcytbjdePL42t7B2qx7qFk3M0-IObDc4rNX_N09o6UGBfkGlmokPV9l_GRlVzCWXdRYpI11Y_3LG8u7h4x3tKaWoYHlfwmbX30uguaf0RqDgoYm1miqqin0upXxk5VdwRp-UWuQNtatGV7eGqd7yJyO1hwXZWCNzuiKQRkjE1dO6_Ha9fCT9VzBEOeihiDNqxsyurwhbvdouR0NGQ0sZv-fLM_eXxSxYvYZJTGoZGwiyZFyaqa8ckn8ZElX8MS9qCdI_-qejK_7i-nI7h5ElsokE51-D9nFyYtoLaq-ZnKnVuK9kqtymeryvuTKb6WRyPLqLq8upkl1q9hgd3jYB2asF-31osd6mhmcGTeDh33gxpmZ0l4veqyneZO267RzANtN2NHCrr5brhbmTL-018cPPYz4oYcxPxAa8QOhET_8Pn7oYcQPPYz5gdCIHwiN-DHUpnSkD-mojx_jPgnXw0jC9TCWcIRGEo7Q2AQwGZvt_6Qmc9OURoeA0eQ0xpGYs9YUOYgq4_qgM_0YQZLOWnPEJOoIjWQdobGwYziSdgzH4t6aoUZx19NY3PU0GncEx-KO4FjcW4P0MO4-EvfWTDGKe2umGMVdT2Nx19No3BEcizuCY3FvzVOjuOtpLO56Go07gmNxR3As7q2pevhd29bHnbdmizbuy-dv_gsAAP__iIdJJQ== statement ok DROP TABLE grandchild2, grandchild1, child1, child2, parent1, parent2 diff --git a/pkg/sql/opt/exec/execbuilder/testdata/distsql_misc b/pkg/sql/opt/exec/execbuilder/testdata/distsql_misc index 15904f1ff2b8..a581ae5cd1f2 100644 --- a/pkg/sql/opt/exec/execbuilder/testdata/distsql_misc +++ b/pkg/sql/opt/exec/execbuilder/testdata/distsql_misc @@ -11,7 +11,7 @@ subtest scrub # CREATE TABLE test (k INT PRIMARY KEY, v INT, data INT, INDEX secondary (v) STORING (data)) # # query T -# SELECT url FROM [EXPLAIN (DISTSQL) +# EXPLAIN (DISTSQL) # SELECT leftside.v, leftside.k, leftside.data, rightside.v, rightside.k, rightside.data # FROM # (SELECT v,k,data FROM test@{FORCE_INDEX=[1]} ORDER BY v,k,data) AS leftside @@ -21,7 +21,6 @@ subtest scrub # WHERE (leftside.k IS NULL) OR # (rightside.k IS NULL) # ] -# ---- # https://cockroachdb.github.io/distsqlplan/decode.html#eJyckc2K2zAQgO99CjGnLBlIJDs9CAq6dCFLGpdscio-uNY0a3AkM5Khy5J3L45hNw5x2vQ4I33zzc8bOG9pXRwogP4BEnKEhn1JIXjuUv2Hpf0Neo5QuaaNXTpHKD0T6DeIVawJNGyLnzVtqLDEszkgWIpFVZ_KNlwdCn41kUIEhKyNWhiFRqJJID8i-DZ-FA6x2BNoecR_lz97jsQzOfQaOUWjpmiS6ahG3aM5n1ENXYFK7-zdUyb_MWUyPiXCoYjli6jJaaFGremo9UPWOs-WmOzAlnfk375caf0b8Z6efOWIZ-mw_-1rQ1o87lYrke22XzfiKVuuAaGmX3FyNtzDF672L8MUIDxWdSTWYmKUWD6L9W61ehDZRkzM4j1-P4fE7iIJmhTNAs3n0Q0t7rnLhkLjXaDLTV2tPO_WQ3ZP_bqDb7mk7-zLk6YPsxN3SlgKsX-VfbB0_VPX4Dksb8LpAJaXsLoJJ7fNyR1mdQmnN-HFhTk_fvoTAAD__3P7gDg= # # # Verify the foreign key check execution plan uses a merge join. @@ -42,7 +41,7 @@ subtest scrub # ) # # query T -# SELECT url FROM [EXPLAIN (DISTSQL) +# EXPLAIN (DISTSQL) # SELECT p.child_id, p.id, p.id2 # FROM # (SELECT child_id, id, id2 FROM child@{NO_INDEX_JOIN} ORDER BY id, id2) AS p @@ -51,7 +50,6 @@ subtest scrub # ON p.id = c.id AND p.id2 = c.id2 # WHERE (p.id IS NOT NULL OR p.id2 IS NOT NULL) AND # c.id IS NULL AND c.id2 IS NULL -# ] # ---- # https://cockroachdb.github.io/distsqlplan/decode.html#eJycklFrnTAUx9_3KcJ58nID1bi9BAYZbAWL0-G8T0PEmXNtqEskidBS_O7DCGstvRvdY345__wO5-QRtJFYdL_QAf8BCTQUJmt6dM7YFW0FmbwHHlNQepr9ihsKvbEI_BG88iMCh7r7OWKFnUR7FQMFib5TY3i2v1WjbLvZm1Zpifft-a5VsrV4bqfOovYiVECzUDCzf3I43w0IPFno__WR7PvYZKtaSdbe4YPYyEUxuyh-8s3aWIkW5c7VrMl_lbzS_Ve0A94YpdFesX339cOEnFyf8pyUp_pLRW7KrAAKI559JNiRivR4-GjVcOsjkRypYMcDULhWo0fLSRRFgpHsOynKmhSnPD-QsiKRSHfsQD4Vn0kk3gf6nHz4Q4BCOXtOREIFoyK9OL70LXur0E1GO3w5xldfjtfZoRxw24Uzs-3xmzV90GzHMuQCkOj8dsu2Q6bDVfhYz8PJG8LsZZj9NZzuwvHSLO9-BwAA__9_viDb @@ -86,9 +84,14 @@ NULL /1 {1} 1 /9 NULL {5} 5 query T -SELECT url FROM [EXPLAIN (DISTSQL) CREATE STATISTICS s1 ON a FROM data] +EXPLAIN (DISTSQL) CREATE STATISTICS s1 ON a FROM data ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJy0lEGL2kAUx-_9FMM77cJIMkl03ZxWrIWA1a3JobDkMOs8rDRm0pkJtBW_e4lBtso6GYh7zIx_f39-b3h70L8KiCGdzWfTjNSqIF9Wy6_kZfb9eT5JFuTuc5Jm6bf5PZmuZpNsRtJskiVplkxTohlZLghvE4IbngOFUgpc8B1qiF-AAYUAKIRAIQIKQ8gpVEquUWupmp_sj4FE_IbYp7Atq9o0xzmFtVQI8R7M1hQIMWT8tcAVcoHK84GCQMO3xRHTsJ8qtd1x9QcopBUvdUwGHiO8FIQRaX6gAgrL2sTkiUF-oCBr88bShm8QYnag7n1SvqsKVN7wvEt7nG7_YkyY7_tN1dRwOzi4Cn7j1aVUAhWKM15-uFptstko3HAjlcd895LkLvB98lqvf6LR91crh2eVmfvsmMvsPDbwgl7T62h0mt7o5tML3FUETiqCgRf2UtHR6KTi4eYqQncVoZOKcOBFvVR0NDqpGN9cReSuInJSEQ28YS8VHY1OKh4_dL29A16hrmSp8WLNvf_PfrP-UGyw3ZVa1mqNz0quj5j2c3nMHQ8EatPesvYjKdurpuD_YWYNB2dhdhkO7OQOdGhNR_Zw1Kf30Boe2cmjPuQHa3hsJ4_7kB_ts_I7non9kV2y88OnfwEAAP__Ik0KoQ== +distribution: full +vectorized: false +· +• create statistics +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJy0lEFr2zAUx-_7FOKdWlCwZDtt6lNDl4GhS7rYh8HIQY0eWZhjeZIM20K--7BN6BIaWeDsaCn__P78nnh7MD8LSGD29eV5ms7Jzcc0y7Mvz7fkaTmb5jOS5dM8zfL0KSOGk8WcCPJpufhMpLACKJRK4lzs0EDyDThQCIFCBBRioDCGFYVKqzUao3Tzk30bSOUvSBiFbVnVtjleUVgrjZDswW5tgZBALl4LXKKQqAMGFCRasS1aTIN-rPR2J_RvoJBVojQJGQWciFISTpT9jhooLGqbkEcOqwMFVds3lrFig5DwA_Xvk4ldVaAOxqdduuNs-wcTwhljTdXMCjc4vAh-49Wl0hI1yhPe6nCx2nSz0bgRVumAM_-S5CZkjLzW6x9oze3FytFJZe4_O-4zu4CPgnDQ9HoaHad3d_Xphf4qQi8V4SiIBqnoaXRUcX91FZG_ishLRTQK4kEqehodVUyuriL2VxF7qYhHwXiQip5GRxUP_3W9vQNeoqlUafBszb3_z6xZfyg32O1Ko2q9xhet1i2m-1y0ufZAorHdLe8-0rK7agr-G-bOcHgS5ufh0E3uQUfOdOwOx0N6j53hOzf5bgj53hmeuMmTIeQH96xYzzNxP7Jz9urw4W8AAAD__5sIBUI= statement ok INSERT INTO data SELECT a, b, c::FLOAT, 1 @@ -108,7 +111,16 @@ Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJzUldFq2z4Uxu__T · WARNING: this statement is experimental! -query T -SELECT url FROM [EXPLAIN (DISTSQL, TYPES) SELECT * FROM data] +query T retry +EXPLAIN (DISTSQL, TYPES) SELECT * FROM data ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJykk8GO0zAQhu88hfWfADlynaQccgJBkSqVbml6AK1yMPGwRErtYDsSqOq7ozorLUW7yNteItkzX_4vo8kB_mePCvVitXi_Y6Pr2cftzSd2u_iyWb1brtnLD8t6V39ecbb7ulnUr9h95-upT6ugGnAYq2mt9uRR3UKCIwdHAY4SHHM0HIOzLXlv3anlEIGl_oVqxtGZYQyn64ajtY5QHRC60BMq7NS3nrakNDkxA4emoLo-xpyy3w6u2yv3Gxz1oIyvWCYkU0YzyWz4QQ7NkcOO4SHBB3VHqOSRP2HxED4a6zQ50ufBnQng98_vvVUhlttur3o0x0c-Ym0zO4j52Vue8srPvGT6dGTKdITMRH7BfPJ0jzzJI89EcYFHke5RJHkUmSgv8CjTPcokjzIT8yv39hGPLfnBGk9Jmzc7rS7pO5p-Am9H19LG2TbGTMebyMULTT5MVTkdliaWouDfsPwv_OYMnv0L59ckF9fA5TXw_Flwc3zxJwAA__8Dwcwc +distribution: full +vectorized: true +· +• scan + columns: (a int, b int, c float, d decimal) + estimated row count: 1,000 + table: data@primary + spans: FULL SCAN +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJykk1Gr0zAUx9_9FOH_pJKSpe186JOiEwZzd657UKQPsTleC11SkwyUse8uy4Rr5U5y15dCzumv_18PJ0f4Hz0qLD5tVm-Wa_b83bLe1R9XnO0-bxb1C1YvVou3O_aSvd_efWBaBQUOYzWt1Z48qi-Q4MjBUYCjBMccDcfgbEveW3d-5RiBpf6JasbRmeEQzuWGo7WOUB0RutATKuzU1562pDQ5MQOHpqC6Psaco18Prtsr9wsc9aCMr1gmJFNGM8ls-E4OzYnDHsJDgg_qnlDJE79i8RB-MNZpcqTHwZ0J4H-e33qrQmy33V71aE6P_MTaZnYQ89FXrnnlIy-ZPh2ZMh0hM5HfMJ883SNP8sgzUdzgUaR7FEkeRSbKGzzKdI8yyaPMxHzi3j7isSU_WOMpafNm59UlfU-XS-DtwbW0cbaNMZfjXeRiQZMPl668HJYmtqLg37D8L_xqBM_-hfMpycUUuJwCz58EN6dnvwMAAP__eCPGvQ== diff --git a/pkg/sql/opt/exec/execbuilder/testdata/distsql_numtables b/pkg/sql/opt/exec/execbuilder/testdata/distsql_numtables index 709a7172531e..6896b6948478 100644 --- a/pkg/sql/opt/exec/execbuilder/testdata/distsql_numtables +++ b/pkg/sql/opt/exec/execbuilder/testdata/distsql_numtables @@ -46,36 +46,104 @@ NULL /2000 {1} 1 # Query with a restricted span. query T -SELECT url FROM [EXPLAIN (DISTSQL) SELECT 5, 2+y, * FROM NumToStr WHERE y <= 10 ORDER BY str] +EXPLAIN (DISTSQL) SELECT 5, 2+y, * FROM NumToStr WHERE y <= 10 ORDER BY str ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJyUkFFLwzAUhd_9FZfri7pIm-pAAkLVVSzMbbYFldmH2l5GoUtqkoJj9L_LWsVNmOjjOfeck4-s0bxVKDAOxsFNAo2u4Daa3sM8eJqNr8IJHI3COIkfxsfwGRky8GAAKwYnfVQ2S6uM1fB4F0QBrOClcd2z_BK4C9NoFERw_QzG6hQZSlXQJFuSQTFHjinDWqucjFF6Y627QFi8o3AZlrJu7MZOGeZKE4o12tJWhAKT7LWiiLKCtOMiw4JsVlbd7BePX-tymekVMozrTBoBpw53nUNkGJEsSAsYCiHCSXLBwOcDb0sw8D1MW4aqsd8QxmYLQsFb9nfQWGlL2uG7jP75YO-895_5iEytpKGd-X3LbpsypGJB_V8b1eicZlrl3TO9nHa9zijI2P7KexHK_rQB3C7zX8vej3LaHnwEAAD___00xj8= +distribution: full +vectorized: true +· +• sort +│ order: +str +│ +└── • render + │ + └── • scan + missing stats + table: numtostr@primary + spans: [ - /10] +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJyUkFFL60AQhd_vrxjmvtxrR5KNFmRBiNqIgdrWJKCieYjJUAJpNu5uwFLy36UJYitU9PGcyfnysRs0rxVKDB4W04twBv8mYZzEd9P_EAfT4CqBMYEHI1gTHMF1NL-Ful1ZZayG-5sgCmANz63rnuTnIFyYR5MggstHMFYjYa0KnmUrNiifUGBK2GiVszFKb6tN_0FYvKF0Ccu6ae22TglzpRnlBm1pK0aJSfZSccRZwdpxkbBgm5VVj_3Q8RtdrjK9RsK4yWoj4dgRrvMXCSOuC9YSxlLKcJacEfhi5O0EAt_DtCNUrf2UMDZbMkrR0c9FY6Uta0fsO_qno4N47zf4iE2jasN7-ENkt0sJuVjy8NZGtTrnhVZ5_5shzvtdXxRs7HAVQwjr4bQV3B2Lb8fel3Ha_XkPAAD___kwwOA= # Query which requires a full table scan. query T -SELECT url FROM [EXPLAIN (DISTSQL) SELECT 5, 2 + y, * FROM NumToStr WHERE y % 1000 = 0 ORDER BY str] +EXPLAIN (DISTSQL) SELECT 5, 2 + y, * FROM NumToStr WHERE y % 1000 = 0 ORDER BY str ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJzElV-LGj0Yxe_fTxEeeMGtkZnMH1cDBdvuLBWsbkehLYsXUycswjiZJhEq4ncvM6PuKpqkWvDOZHKec8zvQNYgf2VAYRwNok8TtBQZeoxHX9Bz9P1p8KE_RI2H_ngy_jq4Q9sjIUYeaqIVRu_qo_lyobhUAn37HMURaqzQ_4i4rnuH3iMXjeKHKEYffyCpxBQw5Dxlw2TBJNBnIIDBAww-YAgAQwhTDIXgMyYlF-WRdSXop7-BuhjmebFU5fYUw4wLBnQNaq4yBhQmyc-MxSxJmXBcwJAylcyzymaXsFeI-SIRK8AwLpJcUtRyPNd1YbrBwJfqdbhUyQsDSjbYPsDjPFNMMOGEh-71PkWNHtneDKW0P5x0qgva_gYMMcvT8ly43cKoR5remwVGPe9sVO9voo65UEw45OieekHz7Hz_7PzXsVykTLD01NATIYa8xQuHHN7WOfvgwJ7YV4HYVqFqQssJ7PtgSLHvQ_v2fTBE3fWBXNoHzx6IZw0kqIC07YEYUuyB3N8eiCHqDoh3KRDfHohvDaRdAenYAzGk2APp3B6IIeoOiH8pkMAeSGANpETRsmRhCLBn0b09C0PUHYvgX7xeJ-bHTBY8l8zqYXLLp42lL6x-CiVfihl7EnxW2dTLUaWrNlImVf2V1It-Xn8qA74VE63Y04s9rdg_EJNjsa-P3dZbB1p1qBeHWrHBuX3Nn77Xijt6545W3NWLu9fEJoaOmUqmbxkx1Ixc1TNiKFpgMNc3jRiqRvRdO84-3fz3JwAA__97VSbX +distribution: full +vectorized: true +· +• sort +│ order: +str +│ +└── • render + │ + └── • filter + │ filter: (y % 1000) = 0 + │ + └── • scan + missing stats + table: numtostr@primary + spans: FULL SCAN +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJzElV-LGjEUxd_7KcKFwm43MpP54-pAwbY7SwWr21FoS_Fh6lwWQSfTJEJF_O5lZtRdRZNUC76ZTM49x_wOZAXy9wwiiL8_9T50--TmoTscDb_2bskw7sWfRiSkxCN3ZEnJO_KYDL6QfDFXXCpBvn2Ok5jcLMlbwlzXvSXviUsGyUOckI8_iFQCKOQ8w346RwnRT2BAwQMKPlAIgEIIYwqF4BOUkovyyKoSdLM_ELkUpnmxUOX2mMKEC4RoBWqqZggRjNJfM0wwzVA4LlDIUKXTWWWzDdgpxHSeiiVQGBZpLiPScDzXdWG8psAX6mW4VOkzQsTW1D7A43SmUKBwwn33ej8iNx22uZgoirr9Uau6n81voJBgnpXnws0WJR12571aUNLxTkb1_iXqkAuFwmEH99QJ7k7O90_OfxnLRYYCs2NDj4To8wYvHLZ_W6fsgz17Zl8FZluFqgkNJ7DvgyHFrg_N6_fBEHXbB3ZuHzx7IJ41kKAC0rQHYkixA3J_fSCGqFsg3rlAfHsgvjWQZgWkZQ_EkGIHpHV9IIaoWyD-uUACeyCBNZASRcOShSHAjkX7-iwMUbcsgv_xeh2Zn6AseC7R6mFyy6cNs2esn0LJF2KCT4JPKpt6Oah01UaGUtVfWb3o5vWnMuBrMdOKPb3Y04r9PTE7FPv62E29daBVh3pxqBUbnJuX_Ol7rbild25pxW29uH1JbGbomKlk-pYxQ83YRT1jhqIFBnN905ihakzftcPs4_WbvwEAAP__8vsheA== # Query with a restricted span + filter. query T -SELECT url FROM [EXPLAIN (DISTSQL) SELECT str FROM NumToStr WHERE y < 10 AND str LIKE '%e%' ORDER BY y] +EXPLAIN (DISTSQL) SELECT str FROM NumToStr WHERE y < 10 AND str LIKE '%e%' ORDER BY y ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJyUUE9ro0AUv--neLwlJIFZ1Oxp55RsY1qp1VSFtqQerD6CYBw7M0JD8LsXnZYmhZT2-H7_eQdUzxVyjF3fvUiglRWsovAGNu792l94AUyWXpzEt_4U3iRKSyOp250W_XV35UYuTPbw2Nr23xwcewqLYAmTnvS9axfGIxqNpxBGSzeC_w-wT5FhLQoKsh0p5Bt0MGXYSJGTUkL20GEQeMULcpthWTet7uGUYS4kIT-gLnVFyDHJniqKKCtIWjYyLEhnZTXEvm-cN7LcZXKPDOMmqxWHP9Y_6zemHUPR6o9spbMtIXc69v3-VVlpkiQt57Tc4Bzms6MvcM7jJPKCS2QYtrpnz66Y_WRFRKoRtaKTDeeS7S5lSMWWzKeVaGVOaynyocac4eAbgIKUNqxjDq82VD_w2Ox8aZ59Mqfdr9cAAAD__5I2ysw= +distribution: full +vectorized: true +· +• filter +│ filter: str LIKE '%e%' +│ +└── • scan + missing stats + table: numtostr@primary + spans: [ - /9] +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJyUUE9L-0AQvf8-xTA_SltYSVJP7qnVphqMSU0CKppDTIYSSLNxdwOWku8umyC2QkWP7715f5g9qrcKObqPa3_hBTBZenES3_tTiF3fvUpAaQmrKLyDut1qYdDDjRu5MNnBS2vb5zk49hQWwRImRvS9WxfGIxqNpxBGSzeCyyfYIcNaFBRkW1LIn9HBlGEjRU5KCWmofX_gFe_IbYZl3bTa0CnDXEhCvkdd6oqQY5K9VhRRVpC0bGRYkM7Kqo_9nDhvZLnNpKmNm6xWHM6sC-s_ph1D0eqvbKWzDSF3Ovb7_lVZaZIkLee4fOA5zGcHT-Ccx0nkBdfIMGy1UU-umP1lRUSqEbWiow2nku0uZUjFhoZPK9HKnNZS5H3NAMPe1xMFKT2ozgC8epDMwEOz86N59s2cdv8-AgAA__9ZOcVt # Query which requires a full table scan. query T -SELECT url FROM [EXPLAIN (DISTSQL) SELECT str FROM NumToStr WHERE y % 1000 = 0 AND str LIKE '%i%' ORDER BY y] +EXPLAIN (DISTSQL) SELECT str FROM NumToStr WHERE y % 1000 = 0 AND str LIKE '%i%' ORDER BY y ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJzMlV2L2kwYhs_fXzE8IBt5R5yJ0XUHCtnWbBtq4zYKbVlykJphCcRMOjOBivjfS5Ktu0pNBjzxbOfjzn3t9YS4A_UrAwZLb-59WKFSZughXHxBT973x_m9HyBr5i9Xy6_zPnq5orRsruTlRotq9e2TF3rIsraohyghpI_eIdJH98EMWdX53P_soZte2rvpo0U480L0_gfaRoAhFwkP4g1XwJ6AAgYbMIwAgwMYxhBhKKRYc6WErK7s6oCf_AZGMKR5UepqO8KwFpID24FOdcaBwSr-mfGQxwmXQwIYEq7jNKtr_mK7hUw3sdwChmUR54qhwdAmhEC0xyBK_fpwpeNnDozusTnAQ5ppLrkcjo_bm32GLMulL7oYY36wmtbWDn_X8lz7jTvG2HIV-sHHPmBYlJoh18YuPYtrn8V9pRQy4ZInx4iu_T9E-3_8T4EYiGJIT3w2KOc5Rkcc1Hxu1HRu9dgGQ8d8eB0Uh-FNrmN4trk021iaU0ubmEvroDhIu70OaSNzaSNjaZNa2tRcWgfFQdr0OqQ55tIcY2mVroGhrw6Ag6-76_DV8SsQclWIXPEj2HNPJtU3lyfPvPlGK1HKNX-UYl3XNMtFnas3Eq50c0qbhZ83RxXg2zBtDdtHYXoattubO6pHrWmnPexcwj1uDU_amyeXNN-2hqftzdNLmu_aZ0U6XpP2l-y0O9r_9ycAAP__c_gt-g== +distribution: full +vectorized: true +· +• filter +│ filter: ((y % 1000) = 0) AND (str LIKE '%i%') +│ +└── • scan + missing stats + table: numtostr@primary + spans: FULL SCAN +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJzMlVGL2kwUhu-_XzEckI18I87E6LoDhWxrtg21cRuFthQvUnNYAppJZ0boIv73kqR1V6nJgDfeOTO-eR-fE8Yd6J9rEBB8fZzehxFxJuF8Mf887ZJ5MA3eLYg2ijzEs08k326MLFdfPgRxQBznmXQIZ4x1yRvCuuQ-mhCnPJ-GHwNy08k6N10yiydBTN5-I89AIZcpRskGNYjvwIGCCxQGQMEDCkNYUiiUXKHWUpVf2VWBMP0FglHI8mJryu0lhZVUCGIHJjNrBAGL5McaY0xSVH0GFFI0Sbauav5S-4XKNokqMeZFkmtBen2XMQbLPQW5NS8P1yZ5QhB8T-0BHrK1QYWqPzxur_cFcRyf_7ElhAijxbiSdvhcufPdV-qEEPNFHEbvu0BhtjWC-C71-Vlc9yzuC6VUKSpMjxF9939Y7v_xmyLZk0Wfn_isUc5zDI44uP3cuO3cqrH1-p798FooDsMbXcfwXHtprrU0r5I2spfWQnGQdnsd0gb20gbW0kaVtLG9tBaKg7TxdUjz7KV51tJKXT1LXy0AB1931-Gr5V8gRl3IXOMR7Lkns_LOxfQJ6ztay61a4aOSq6qmXs6qXLWRojb1Ka8XYV4flYCvw7wx7B6F-WnYbW5uqR40pr3msHcJ97AxPGpuHl3SfNsYHjc3jy9pvmueFWt5TZpfstPu5f6_3wEAAP__rxgomw== # # -- Join tests -- # query T -SELECT url FROM [EXPLAIN (DISTSQL) SELECT x, str FROM NumToSquare JOIN NumToStr ON y = xsquared] +EXPLAIN (DISTSQL) SELECT x, str FROM NumToSquare JOIN NumToStr ON y = xsquared ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJy8lVFr2zwUhu-_XyHOVQsqsWwnaQwFf2wdS-mSrunFoPjCjbXG4FiuJENCyH8ftgOpE0-ypySXtvRI5zwv6GxAfCTgwez-8f7LC8p5gr49T3-g1_tfT4__jyfo6ut49jL7-XiNdltWGAnJq11pvpRMfOQhp-hhOp7sfkiOphO0RndoVS1GAWBIWUQn4ZIK8F6BAAYbMDiAwQUMfQgwZJzNqRCMF1s2JTCOVuBZGOI0y2XxO8AwZ5yCtwEZy4SCBy_hW0KfaRhR3rMAQ0RlGCflNZ8K9DMeL0O-BgyzLEyFh24g2GJgudwdvT_xbY0WoVjUz_JtCLYBBiHDdwoe2eJ_K5E0lSh5Q30927KsjkWSWpH2X4vcn5OnjEeU06h2UlCQui0NnX4PxeKBxSnlvUG9tIT-lle-fX3H4_eFvPLJNWCY5tJDPsG-e9DnvgfHoIeGAifshmU9Qg67bbzbrd1N2odstw25zPim5542aXLZpIfnSNpub9tpbdstbQ9Oa9u-rO3bc9h22tt2W9selLZvT2vbuazt0Tlsu-1t91vbLjx3nWkq0e5lRRPr3POi4f5nKjKWCtpqGlhFBzR6p5URwXI-p0-czctrqs9pyZUvcESFrFbt6mOcVktFge3hvgk8NIFHJjAhapp0MGZ3g_sm8NAEHpnAB8aOaPuQtj7Tjlq3o4RJ3bd1SLsmYalhTVhqWBOWGtaEpYZ1YfVNwhqY6FbDGt1qWKNbDWt0q2Gd7qGJ7lsT3WpYo1sNa3SrYY1uNazTPTLRTboMy-M3tMu07ErrHv8u87IrrXNOjqaHUnqw_e9PAAAA__-O9umd +distribution: full +vectorized: true +· +• hash join +│ equality: (xsquared) = (y) +│ right cols are key +│ +├── • scan +│ missing stats +│ table: numtosquare@primary +│ spans: FULL SCAN +│ +└── • scan + missing stats + table: numtostr@primary + spans: FULL SCAN +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJy8ld-K2kAUh-_7FMO52oVZzCRR18BCSmupi9WtelEouciaqQY0k52ZgCK-e0my4KrpTNJRL_Pnm3PO94M5OxBvK_Cg_-tl-HkwQndfB9PZ9OfwHk37w_6XGdpgJCRH3ybjHyjJ1pKJtyzkFD2PB6P3F5Kj8Qht0RPalB8jwJCwiI7CNRXg_QYCGGzA4AAGFzC0IcCQcjanQjCe_7IrgEG0Ac_CECdpJvPXAYY54xS8HchYrih4MAtfV3RCw4jylgUYIirDeFWU-dCfn_J4HfItYJimYSI89ADBHgPL5PvRhxNft2gZiuXxWb4NwT7AIGS4oOCRPf6_FklVi5JX9NeyLctq2CQ5atL-Z5OHc7KE8YiWGR1OCnJS90vFpN9DsXxmcUJ5q3Pc2or-kXe-ff_E48VS3vnkHjCMM-khn2DfPZnzMINjMENFgyP2wNIWIafTVtZ2j2qT-iHbdUMuMn5ouZdNmtw26e41krbr23Zq23YL253L2rZva_vxGrad-rbd2rY7he3Hy9p2bmu7dw3bbn3b7dq2c89Nd5pKtHtb0cS69r6oqD-hImWJoLW2gZVPQKMFLY0IlvE5feFsXpQpH8cFV9zAERWy_GqXD4Ok_JQ3WB9um8BdE7hnAhOipkkDY3YzuG0Cd03gngl8YuyMtk9p6yPtqHU7Spgc-7ZOadckLDWsCUsNa8JSw5qw1LAurLZJWB0T3WpYo1sNa3SrYY1uNazT3TXR_WiiWw1rdKthjW41rNGthnW6eya6SZNleX6HNtmWTWnd5d9kXzaldc7J2fZQSg_2n_4GAAD__8eN5D4= query T EXPLAIN (VERBOSE) SELECT x, str FROM NumToSquare JOIN NumToStr ON x = y WHERE x % 2 = 0 @@ -122,9 +190,33 @@ vectorized: true spans: FULL SCAN query T -SELECT url FROM [EXPLAIN (DISTSQL) SELECT x, str FROM NumToSquare JOIN NumToStr ON x = y WHERE x % 2 = 0] +EXPLAIN (DISTSQL) SELECT x, str FROM NumToSquare JOIN NumToStr ON x = y WHERE x % 2 = 0 ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJzEllFr4k4Uxd__n2K48AdLR8wkMaaBgsuuZS2tdlXYheJDamZtIE3sZAKW0u--JOk2GnVmsoP1zUzmzD1zfre3eYX0OQIPpoObwdcZyliEribjW3Q_-HV382U4Qq1vw-ls-uPmDL1vWWOUclbuirMnnqTPmc8ouh4PR-8LnKHxCK3RJXpBP78PJgPUWqP_kXmGLpExBwxxEtCR_0RT8O6BAAYTMFiAwQYMXZhjWLFkQdM0YfmW10IwDNbgGRjCeJXxfHmOYZEwCt4r8JBHFDyY-Q8RnVA_oKxjAIaAcj-MijIbXvsrFj757AUwTFd-nHqoDRjGGfdQn8D8DUOS8apIyv0lBY-8YXUjV2HEKaOsQ7ZdlOseavVJnojnecPRzC2Cef9dq18d-fCCHv30cfu8wm_l0WzicTMsc19YnO1JqmMahnEwJOufQup9akj2QY_VOVmcsIAyGmydNM-Vf7fs2wB9cl7Wqt_1lrIlvU7COO-JWtoR_c1bfXJ-dsnC5WP5s2pI3LcOxt3VuMoek6Oknaw6pFe_9N7azlZtot5rlmqvFa3W7tjqDSdx8dFw7gkbjpyg4azjNJypDt1Whm4X0B116BIXH9AvTgjdPAF0-zjQLXXoXWXoTgHdVYcucVH9_zVOSN06AfXucajb6tQdZeo577YicImBCvjnfnHZB01-FnDn-B8TeyxMaLpK4pQqfSoY-SVosKRlLmmSsQW9Y8miKFM-jgtdsRDQlJdvSfkwjMtXucFNMamLyabY3hKTZmJXR0yIllrLOOmJ1aYwcEscuNUgcLOZ2NUR1wJvqtYyXgt8R20LA--KaXXFfx6uGJcjVPfE4p4Oa7FYwloslrGWqLWMy1i7OqwvxKwNySzcmaRNeEnUEmAStYyYTK7nXcaM7MzTJtCIeJ4SyUAlWhNVopZR05upMrmedyk1rbFKJHPVkVDbGayNqInVMmpitZSaRK7nXUptZ7wKqc3f_vsTAAD__wHPXPM= +distribution: full +vectorized: true +· +• merge join +│ equality: (x) = (y) +│ left cols are key +│ right cols are key +│ +├── • filter +│ │ filter: (x % 2) = 0 +│ │ +│ └── • scan +│ missing stats +│ table: numtosquare@primary +│ spans: FULL SCAN +│ +└── • filter + │ filter: (y % 2) = 0 + │ + └── • scan + missing stats + table: numtostr@primary + spans: FULL SCAN +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJzEluFr2kAYxr_vrzheGFh6Yi6JmgYKjs0yS6udChsMP6TmZgM2sXcXsJT-7yNJ12jUu8sO67fkkufe557f62tegD8twYf-r7ubL4MhanwbTKaTHzdnaNK_6X-dojVGXDB0NR7dojh9FAl_SgNG0fVoMHxbEAyNhmiNLtEz-vm9P-6jxhp9RvYZukQWYIiTkA6DR8rB_w0EMNiAwQEMLmBowwzDiiVzynnCsldecsEgXINvYYjiVSqy5RmGecIo-C8gIrGk4MM0uF_SMQ1CylpZoZCKIFrmZTas9lYsegzYM2CYrIKY-6gJGEap8FGPwOwVQ5KKsggXwYKCT16xvpGraCkoo6xFtl0U6z5q9EgWiO_7g-HUy3N5u67UL7e8f0YPAX_Y3i_3W3q063jcDMveF5Zge5Jq2ZZlHQzJ-a-Quh8aknvQY7lPGicspIyGWzvNMuW_V_a9AD1yXtSqnvWWsgW9TqI464lK2kv6RzR65PzskkWLh-KybEjccw7G3TY4yh6Tw6SZrFqkWz303tqdrdpEv9cc3V7LW63ZcvUbTuHiveG8EzYcOUHDOcdpOFsfuqsN3c2hd_ShK1y8Q784IXT7BNDd40B39KG3taF3cuiePnSFi_L_1zohdecE1NvHoe7qU-9oU894NzWBKwyUwD_2i8s9aPKjgHeO_zGxx8KY8lUSc6r1qWBlh6Dhgha58CRlc3rHknleprgd5bp8IaRcFE9JcTOIi0eZwU0xqYrJptjdEpN6Ys9ETIiR2sg46crVtjRwRx64UyNwu57YMxFXAq-rNjJeCXxH7UoDb8tpteU_D0-OqyNVd-XirglruVjBWi5WsVaojYyrWHsmrC_krC3FLNyZpHV4KdQKYAq1iphKbuZdxYzszNM60Ih8nhLFQCVGE1WhVlEzm6kquZl3JTWjsUoUc7WjoLYzWGtRk6tV1ORqJTWF3My7ktrOeJVSm71--hsAAP__o1BXlA== # # -- Aggregation tests -- @@ -132,41 +224,101 @@ https://cockroachdb.github.io/distsqlplan/decode.html#eJzEllFr4k4Uxd__n2K48AdLR8 # Sum the numbers in the NumToStr table. query T -SELECT url FROM [EXPLAIN (DISTSQL) SELECT sum(y) FROM NumToStr] +EXPLAIN (DISTSQL) SELECT sum(y) FROM NumToStr ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJyslF9r2zAUxd_3Kcx9SkAhlu24qZ9StgwCadPFGQyKH7z4YgKO5ekPrIR892F5o3ZoZSXeo6R7dM5PV9wTiF8FRBAv18vPO0fxwvm63Tw6L8sfz-uH1ZMz-rKKd_G39dj5WyLUcfQ6bqpKdZRMSJ4AgZJl-JQeUUD0AhQIeEDABwIBEJhBQqDibI9CMF6XnLRglf2GyCVwKCsl6-2EwJ5xhOgE8iALhAh26c8Ct5hmyKcuEMhQpodC2_zzX1T8cEz5KxCIq7QUkTOZeq5bV2-UjJwFheRMgCn5ZiNkmiNE9EzsozzkOcc8lYxPZ90k8ffH0YKOP7TxPrR5u12VjGfIMetcnZzNQah7XRK_k4Tavz21fXv99JNpcEsDevK0uMMhDfDssT1r7EBjh7dg9-RpYd8NwfbtsX1r7FBjz2_B7snTwp4PwQ7ssQNr7Bp4cjVxT5QW8f3_GjDv2GxRVKwUeDFo3r_ZrQcQZjk200owxff4zNle2zTLjdbpjQyFbE5ps1iVzVEdsC2mRrHXEdNLsWd27rH2jerALA6G5J4ZxaHZORzifGcUz83O8yHO9-ZeuT3fxPzJLr2T86c_AQAA__83td0T +distribution: full +vectorized: true +· +• group (scalar) +│ +└── • scan + missing stats + table: numtostr@primary + spans: FULL SCAN +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJyslF1r2zAUhu_3K8y5SkAhlu24qa9StgwCadPFGQyGL7ToYAKJ5UkyrIT892GZUTu0shrv0h-vnveRxDmD-n2EBJY_ntcPqydv9GWV7tJv67GXLtfLzztPVafRy9j7ut08ekV10kJpCQQKwfGJnVBB8hMoEAiAQAgEIiAwg4xAKcUelRKy_uVsAiv-BxKfwKEoK12_zgjshURIzqAP-oiQwI79OuIWGUc59YEAR80OR4P5h1-U8nBi8gUIpCUrVOJNpoHv139vKp14CwrZhYCo9CtGaZYjJPRC3Ks85LnEnGkhp7Nuk_T742hBx-9igncxr6tXhZAcJfLO0tnFXoT6H2sSdppQ972nrntvtn4yjW45gJ4-Le94yAEE7tqBs3ZktONbtHv6tLTvhmiH7tqhs3ZstOe3aPf0aWnPh2hH7tqRs3YtPPmwcU-VlvH9_xowb2C2qEpRKLwaNG-v7NcDCHmOzbRSopJ7fJZibzDN48bkzAuOSjdfafOwKppPdcF2mFrDQSdMr8OBndyDDq3pyB6OhvSeWcOxnRwPId9Zw3M7eT6EfG8_K7_nmtgv2TU7u3z6GwAA___56Ne0 # Count the rows in the NumToStr table. query T -SELECT url FROM [EXPLAIN (DISTSQL) SELECT count(*) FROM NumToStr] +EXPLAIN (DISTSQL) SELECT count(*) FROM NumToStr ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJyslNGKm0AUhu_7FHKukjIhaoyb9WqXbQpCVrfRpYVFFqsHCZgZOzNCS8i7F7VlTdiMQ9xLdX6___PIOYD4VYIH0XqzfoiNmpfG1234aLysfzxt7v3AmHzxozj6tpka_45krKZy8nnanaP1XjIheQIEKMsxSPcowHsBCwjYQGABBBwgsISEQMVZhkIw3hw5tAE__w2eSWBHq1o2txMCGeMI3gHkTpYIHsTpzxK3mObI5yYQyFGmu7LF_OffVXy3T_kfIBBVKRWeMZvbptmcDmvpGQGjCMmRAKvlG0jItEDwrCPRL3NfFByLVDI-X552eQifg_h1G36PJtOLLPsi6w1RU8Zz5JifvD85qttYZ58men589YN4cmddbrM4aWPpj8HSHUM7hdncuW4WA4169u7oWdj69ra2vdPau9fZDzTq2d-Mtl_o2y-07d3WfnWd_UCjnv1qtL2jb-9o2zfesyvEB8r0xG8_dAG9w9qiqBgVeLaI3n-z2SwozAvstplgNc_wibOsxXSXYZtrb-QoZPfU6i582j1qCvbDljJsn4St87CtJg-gF8q0ow47Y3ovlWFXTXbHkG-U4ZWavBpDvlXPyhz4TdQ_2Tk7OX76GwAA__96Ce1- +distribution: full +vectorized: true +· +• group (scalar) +│ +└── • scan + missing stats + table: numtostr@primary + spans: FULL SCAN +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJyslF2Lm0AUhu_7K-RcJWVC_Iqb9WqXbQpCVrfRpYUii9WDBJIZOzNCS8h_LyplTUjGIe6lH6_P-3iGcwDxewc-rH68rB-D0Jh8CeIk_raeGvFqvXpKjJzVVE4-T42vm-jZoPVeMiE5EKCswDDbowD_J1hAwAYCDhBwgcACUgIVZzkKwXjzyqENBMUf8E0CW1rVsrmdEsgZR_APILdyh-BDkv3a4QazAvncBAIFymy7azH_8Q8V3-4z_hcIxFVGhW_M5rZpNm9HtfSNkFGE9EiA1fIdJGRWIvjWkeiXeSxLjmUmGZ8vTrs8Ra9h8raJvseT6VWWfZX1jqgp4wVyLE6-nx7VbayzXxO_Pr8FYTJ5sK63cU7aWPpjsHTH0E5hNndvm8VAo569N3oWtr69rW3vtvbebfYDjXr2d6PtHX17R9vea-2Xt9kPNOrZL0fbu_r2rrZ94z27QXygTE_8_kMX0AXWBkXFqMCzRXT5y2azoLAosdtmgtU8xxfO8hbTXUZtrr1RoJDdU6u7CGj3qCnYD1vKsH0Sts7Dtpo8gHaUaVcddsf0XijDnprsjSHfKcNLNXk5hnyvnpU5cEzUh-ycnR4__QsAAP__YDroHw== # Count how many numbers contain the digit 5. query T -SELECT url FROM [EXPLAIN (DISTSQL) SELECT count(*) FROM NumToStr WHERE str LIKE '%five%'] +EXPLAIN (DISTSQL) SELECT count(*) FROM NumToStr WHERE str LIKE '%five%' ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJy0lVFvmzwUhu-_X4GOVDX95CoxkDT1VaqObmgp6YCqkypUsXAWIVGcGTNtqvLfJ2BNk6ixaVnugvHLeeLnlfwExY8MGATO1LkMjVJkxpU_uzbuna830wvXM3of3CAMvkxPjL9b5rzMZe__k2ZfXj5KXkhh3H1yfMeofk3dz45xfPQ9_YlHxxEQyHmCXvyIBbB7oEDABAIWELCBwBAiAkvB51gUXFRbnuqAm_wCNiCQ5stSVssRgTkXCOwJZCozBAZh_C1DH-MERX8ABBKUcZrVY565JkuRPsbiNxAIlnFeMOO0bw4G1e5ZKZkxMSFaEeClfBlTyHiBwOiKtEe5SjOJAkV_uM3RrDNjQrfPhTEWhL7rfXwG8XiOe1HMt6BcLBYCF7Hkok93TuVyduuFD_7sLuid7B1m7R32MqPMuUhQYLL1_Wilwdk5nOD2-sH1wt6E7qext2ho-0LQtoWo-3Dat9_TCg3PuhWjw7dCg7KpgXZuhdneg9nag117GL3Hg4Zn7eHs8B40KJsezM4erPYerNYeRrWH8Xs8aHjWHsaH96BB2fRgdfZgt_dgt_ZQGTh9swINylrB-eEVaFA2Fdj_9KJ6ZZiPxZLnBe5cWK9_eVBdZJgssLn1Cl6KOd4IPq_HNI-zOlcvJFjI5i1tHty8eVUBboapMmyqw6YybG2F6W7YUmOP1KNtZXqoDg-VYc3kUZc_faYMj9WTx8rwuTp83gWbajqmK5m6ZVRTM9qpZ1RTNFszXN00qqkaVXdtlz1a_fcnAAD__1YKMbs= +distribution: full +vectorized: true +· +• group (scalar) +│ +└── • filter + │ filter: str LIKE '%five%' + │ + └── • scan + missing stats + table: numtostr@primary + spans: FULL SCAN +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJy0lVFv2jwUhu-_XxEdqSr9ZAROAgVfUXXpFo2GLknVSROqMnKGIkHMHGfahPjvUxKVAip2SsYdcfL6PPh5Ja8h-7kABs7Xh_GN6xmtD24QBl_GV0bgjJ3b0JjxPJWt_6-MO39yb6T5UvJMCuPpk-M7RvFr7H52jMuLH8kvvLgEAimP0YuWmAH7BhQImEDAAgI2EOjBlMBK8BlmGRfFJ-sy4Ma_gXUJJOkql8XylMCMCwS2BpnIBQKDMPq-QB-jGEWnCwRilFGyKMe8YI1WIllG4g8QCFZRmjGj3TG73eLrSS6ZMTJhuiHAc_k6JpPRHIHRDamPcpcsJAoUnd4-R7XOjBHdPxbGWBD6rvfxBcTjKR5FMd-DcjOfC5xHkosOPTiV28mjFz77k6egdXV0mHV02OuMPOUiRoHx3v7TjQbn4HCCx_tn1wtbI3qcxt6jofULQesWouxDu2Of0goNz7YV_fO3QoOyq4E2boVZ34NZ24Ndeuif4kHDs_VwfX4PGpRdD2ZjD1Z9D1ZtD_3Sw-AUDxqerYfB-T1oUHY9WI092PU92LU9FAba71agQdkqGJ5fgQZlV4H9Ty-qN4b5mK14muHBhfX2zt3iIsN4jtWtl_FczPBB8Fk5pnqclLlyIcZMVm9p9eCm1asCcDdMlWFTHTaVYWsvTA_Dlhq7rx5tK9M9dbinDGsm95v86WtleKCePFCGh-rwsAk21XRMVzJ1y6imZrRRz6imaLZmuLppVFM1qu7aIft089_fAAAA__-w0Sxc # # -- Limit tests -- # query T -SELECT url FROM [EXPLAIN (DISTSQL) SELECT y FROM NumToStr LIMIT 5] +EXPLAIN (DISTSQL) SELECT y FROM NumToStr LIMIT 5 ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJyMT0tLMzEU3X-_IpzVJ0TsLLrJqqIVAtOHnVkIJYs4uZTATDLmAZYy_106UcSF4PI87jnnXhDfegg063r90LIcevZ02G3Ycf2yr-_llv1_lE3bPNc37NNyLgaXh-RjCqyWG9mypQKH84a2eqAIcUQFxTEG31GMPlypy2yQ5h1iwWHdmNOVVhydDwRxQbKpJwi0-rWnA2lD4W4BDkNJ236O_epdjcEOOpzB0YzaRcFuwbHLSbBVBY7aDjaxJdTE4XP67opJnwiimvjf9xwojt5F-jHlt-TFpDjInKj8HH0OHe2D7-aaAnfz3UwYiqmoVQHSFWlS07-PAAAA__9-34W2 +distribution: full +vectorized: true +· +• scan + missing stats + table: numtostr@primary + spans: LIMITED SCAN + limit: 5 +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJyMj0FL_DAUxO__TxHm9Bcibg97yWlFVwh0t2vbgyA9xOaxBNqkJq_gUvrdZVtEPAgeZyaZ37wJ6b2Dwv7llN_ro_j_qKu6es5vRLXP9w-1uIinsjgIP_YcEkeR64OuxRYSPlg6mp4S1CsyNBJDDC2lFOLVmpYH2n5AbSScH0a-2o1EGyJBTWDHHUGhNm8dlWQsxbsNJCyxcd1S-4XdDdH1Jl4gUQ3GJyVuIVGMrMQug0Tuesdii2aWCCN_sxKbM0Fls_z7npLSEHyiH1N-a97MjQTZM603pzDGlk4xtAtmlcXybzEsJV7TbBXar9HczP8-AwAA___5z4BX query T -SELECT url FROM [EXPLAIN (DISTSQL) SELECT y FROM NumToStr ORDER BY y LIMIT 5] +EXPLAIN (DISTSQL) SELECT y FROM NumToStr ORDER BY y LIMIT 5 ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJyMT01Lw0AUvPsrHnNSWLE59LKnqo0QSJua5KCUHNbkUQJJNu4HWEL-uzSriAfB43y8mXkT7HsHiSJO48eSvOnoKc92dIxfDul9sqfrbVKUxXN6Q1-WczAMvnfaOkNZvo1zenilM6XJLilpXUFg0A3vVc8W8ogIlcBodM3WanOhpsWQNB-QK4F2GL270JVArQ1DTnCt6xgSpXrrOGfVsLlbQaBhp9puif2esBlN2ytzhkAxqsFKuoVA5p2kTQSBtO1bR2tUs4D27qfLOnViyGgW_9-Tsx31YPnXlL-SV3MlwM2Jw89We1Pzweh6qQkwW-4WomHrghoFkAxBmqv56jMAAP__awyIpg== +distribution: full +vectorized: true +· +• scan + missing stats + table: numtostr@primary + spans: LIMITED SCAN + limit: 5 +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJyMj0FLxDAUhO_-isecFCJuD3vJadWtUOhu17YHRXqIzWMJtElNUnBZ-t9lW0Q8CB5nJpn53hnho4NE-nLI77M9XW-zqq6e8xuq0jx9rOlET2WxIzv20YXoqSi3aUkPr3SiPNtlNa0hYJ3mveo5QL4hQSMweNdyCM5frPP8INOfkCsBY4cxXuxGoHWeIc-IJnYMiVq9d1yy0uzvVhDQHJXp5tpvgs3gTa_8CQLVoGyQdAuBYoySNgkEctObSGs0k4Ab489WiOrIkMkk_s9TchicDfwL5a_m1dQIsD7ycnNwo2_54F07zyyymP_NhuYQlzRZRGaXaGqmq68AAAD__6v2g0c= # Test that the correct node is chosen in a reverse scan with multiple spans. query T -SELECT url FROM [EXPLAIN (DISTSQL) SELECT y FROM NumToStr WHERE y < 1000 OR y > 9000 ORDER BY y DESC LIMIT 5] +EXPLAIN (DISTSQL) SELECT y FROM NumToStr WHERE y < 1000 OR y > 9000 ORDER BY y DESC LIMIT 5 ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJyMkEEPk0AQhe_-isl4aZNtWGp6YE_VFiMJLRVI1FQOK0wqCbC4uySShv9ugKqtidXjvnnf2zdzRfOtQoGJH_q7FDpdwds4OsDZ_3gKXwdHWOyDJE3eh0u4WfrZ0HS1VcZq-PDOj31Y9PC54_xVDi7nfAlR_Esi8G7S3o_hzSfoYe8nOwiDQ5DCJkOGjSroKGsyKM7oIsMNZgxbrXIyRulRvk6moPiOgjMsm7azo5wxzJUmFFe0pa0IBR7VSrXOmFKQlWU12QaGqrO_IWPlhVCsB3YX7D4PTuWXimKSBWmHP8Tjz2tsW13WUvfIMGllYwSsHM_znJcgmwJcUPYraWQYdVbAduwYlnVpYYN_a-g-NPzH6jGZVjWG_mt3PmQMqbjQfF6jOp3TSat8-mZ-RhM3CQUZO0_X8yNo5tFY8B52n8L8DzgbXvwIAAD__-xGysw= +distribution: full +vectorized: true +· +• revscan + missing stats + table: numtostr@primary + spans: [ - /999] [/9001 - ] + limit: 5 +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJyMkMGrm0AQxu_9K4bpJYENrik5uKe0iaWCiakKbWk9bHVIBXXt7gqV4P9e1Pa95MHLe8f5Zn7ffDMXNL8rFOh_PYXvgyMs9kGSJp_DJSR-6O9S6OFjHB2g6WqrjNXw5ZMf-7Do4UfH-bscXM75EqL4QSLw_kl7P4YP36CHvZ_sIAwOQQobZNiogo6yJoPiO7rIcIMZw1arnIxRepQv01BQ_EHBGZZN29lRzhjmShOKC9rSVoQCj2qlWmd0KcjKsprGBoaqs4-QsfJMKNYDuzJ27xun8mdFMcmCtMNv7PH_M7atLmupe2SYtLIxAlaO53nOW5BNAS4o-4s0Mow6K2A7ZgzLurSwwecSujcJXzg9JtOqxtCrbudDxpCKM83vNarTOZ20yqc1cxlN3CQUZOzcXc9F0MytMeA17N6F-RM4G978DQAA__-fu8Vt query T EXPLAIN (VERBOSE) SELECT x FROM (SELECT x, 2*x, x+1 FROM NumToSquare) @@ -183,9 +335,17 @@ vectorized: true # Verifies that unused renders don't cause us to do rendering instead of a # simple projection. query T -SELECT url FROM [EXPLAIN (DISTSQL) SELECT x FROM (SELECT x, 2*x, x+1 FROM NumToSquare)] +EXPLAIN (DISTSQL) SELECT x FROM (SELECT x, 2*x, x+1 FROM NumToSquare) ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJyMT01L80AYvL-_YplT-7pi43FPFa0QqG1tchDKHtbsQwkku-l-QCTkv0uyinoQPC3zsTPzDPCXBgLFZru5L1l0DXs87p_YafNy2N7lO7Z4yIuyeN4u2YelT4bFJ-Tslv2fnp5dsSyJJrbB-ktUjpYSHMZq2qmWPMQJGSRH52xF3ls3UcNsyHUPseKoTRfDREuOyjqCGBDq0BAESvXa0JGUJnezAoemoOpmjv3Wue5c3Sr3Bo6iU8YLdg2OfQyCrTPIkcPG8FXigzoTRDbyvw85ku-s8fRjw2_Jq1FykD5TOtbb6Co6OFvNNQnu538zocmHpGYJ5CZJoxz_vQcAAP__tjyKSg== +distribution: full +vectorized: true +· +• scan + missing stats + table: numtosquare@primary + spans: FULL SCAN +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJyMT81K9EAQvH9PMdRp93PEjcc5regKgbhZkxwEyWHMNEsgmcnOD0RC3l2SQdSD4Kmpqu6q6gnu0kHg8HLK7tIj2zykZVU-Z1tWHrLDfcVG9ljkT2zzCTm7Zf-XMbIrlkRRh94bdwnS0hYc2ig6yp4cxCsS1ByDNQ05Z-xCTetCqkaIHUerh-AXuuZojCWICb71HUGgkm8dFSQV2ZsdOBR52Xar7bfI_WDbXtp3cJSD1E6wa3DkwQu2T1DPHCb4rxDn5Zkgkpn_vUhBbjDa0Y8Ovznv5pqD1Jnis84E29DJmmaNiTBf71ZCkfNRTSJIdZTmev73EQAA___Tc4Tr query T EXPLAIN (VERBOSE) SELECT y, str, repeat('test', y) AS res FROM NumToStr ORDER BY res @@ -244,6 +404,22 @@ vectorized: true # Regression test for #20481. query T -SELECT url FROM [EXPLAIN (DISTSQL) SELECT count(*) FROM (SELECT 1 AS one FROM NumToSquare WHERE x > 10 ORDER BY xsquared LIMIT 10)] +EXPLAIN (DISTSQL) SELECT count(*) FROM (SELECT 1 AS one FROM NumToSquare WHERE x > 10 ORDER BY xsquared LIMIT 10) ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJyUkU1r20AQhu_9FcOc7HaLtfJtT3ETlQoUK5VU0pKKspUGIZB3lf0AF6P_XqwNNC7YxMd9533mGdgD2ucBBZZJltxW4M0An4v8Hp6S7w_ZJt3C4i4tq_JrtoSXSqO9cov3y9BbvKQcNiVoRSFVfue0ffbSEDx-SYoE9vDTR9GagEeQF3dJAZ9-wD5UWsjS-7QCHi1rZKh0S1u5I4viCTnWDEejG7JWm2N0mAtpu0cRMezV6N0xrhk22hCKA7reDYQCK_l7oIJkS2YVIcOWnOyHee2rA29G0--k-YMMy1EqK2DF-UesJ4bau3_brZMdoeATe_sFpTaOzIqfym_iD8gw907AVitChlm_6x3w6Kw1vsa66TpDnXTarOJT823-bVv9KvLHcrE861pf4yrIjlpZOvGc2xxNNUNqOwr_aLU3DT0Y3cya8Mxnbg5asi5MeXikKoyOB76G-UU4vgzHF-H1f3A9vfsbAAD__wD3Bz4= +distribution: full +vectorized: true +· +• group (scalar) +│ +└── • limit + │ count: 10 + │ + └── • sort + │ order: +xsquared + │ + └── • scan + missing stats + table: numtosquare@primary + spans: [/11 - ] +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJyUkU1r20AQhu_9FcOc7HaLd-XbnuImKhUoViqppKUVZSsNQiDtKvsBLkb_vVgqNC7YJMd9Z555XtgjuqceJcZfH9JdsofVXVKUxed0DUWcxrcl1CZov3q7ho95dg-rv6mAXQFG05LqMHjjnoKyBI-f4jyGA_wInG8JBIcsv4tz-PANDstKA2lyn5Qg-BoZatPQXg3kUH5HgRXD0ZqanDP2FB3nhaQ5oOQMOz0Gf4orhrWxhPKIvvM9ocRS_eopJ9WQ3XBk2JBXXT-ffdbvZrTdoOxvZFiMSjsJGyHeYzUxNMH_u-68agmlmNjLGxTGerIbcS6_id4hwyx4CXujCRmm3dB5EPyiNXqNdde2llrljd1E5-bb7Mu-_Jlnj8VqfdG1fY0rJzca7ejMc-kynyqG1LS0_KMzwdb0YE09a5ZnNnNz0JDzy1Qsj0Qvo1PB57C4CkfX4egqvP0PrqY3fwIAAP__BvUB3w== diff --git a/pkg/sql/opt/exec/execbuilder/testdata/distsql_ordinality b/pkg/sql/opt/exec/execbuilder/testdata/distsql_ordinality index 9ffb43a866c7..ffe74e06bdd6 100644 --- a/pkg/sql/opt/exec/execbuilder/testdata/distsql_ordinality +++ b/pkg/sql/opt/exec/execbuilder/testdata/distsql_ordinality @@ -47,6 +47,16 @@ vectorized: true spans: FULL SCAN query T -SELECT url FROM [EXPLAIN (DISTSQL) SELECT x, y, z, ordinality FROM xyz WITH ORDINALITY] +EXPLAIN (DISTSQL) SELECT x, y, z, ordinality FROM xyz WITH ORDINALITY ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJyUkE9Lw0AQxe9-imVOCiNtqqc9pdiKC7GpSUClzWHNDiWQZuPuBpKWfHdJIv4DpR7nzfzee7tHsK8FcIiXwfImYbUp2G0U3rPN8mkdzMWKnS9EnMQPwQV7P2mQtcgOyLagjcpLWeSu3cKINe2BPYrkjoXRQqzmgUieU0AotaKV3JMFvgEPUoTK6Iys1aaXjsOBUA3wKUJeVrXr5RQh04aAH8HlriDgkMiXgiKSisxkCgiKnMyLwbZpD35l8r00LSDElSwtZ5eAENaOM3-G_hX615B2CLp2nxHWyR0B9zo8vUb48fCJ963Fb-6z_7hHZCtdWjrJedqlCKR2NH6k1bXJaG10NsSMYzhwg6DIunHrjYMox1Vf8Cvs_QnPfsBpd_YWAAD__zpkvUQ= +distribution: local +vectorized: true +· +• ordinality +│ +└── • scan + missing stats + table: xyz@primary + spans: FULL SCAN +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJyUkF9ro0AUxd_3UwznaRfukpjdp3kybLJUsDFVoS2ND1O9BME4dmYETfC7lyj0H7Skj_fcOb9z5p5gnypIrO-24TLYiJ-rIEmTm_CXSNbh-l8qOhI9iSOJHbQpylpVpet3EP_j6Fp0_VHcBumViOJVsFmGQXoPQq0L3qgDW8gHeMgIjdE5W6vNWTqND4Kig5wTyrpp3VnOCLk2DHmCK13FkEjVY8Uxq4LNbA5CwU6V1Yjt-qPfmPKgTA9C0qjaSvEbhKh1UvgL8v-Q_xfZQNCte42wTu0Z0hvo8hrRy79n3rsWn9EX36HHbBtdW76IPB8yAhd7ng5pdWty3hqdjzHTGI2-USjYumnrTUNQT6tzwbdm70vz4oM5G348BwAA__8gULfl diff --git a/pkg/sql/opt/exec/execbuilder/testdata/distsql_union b/pkg/sql/opt/exec/execbuilder/testdata/distsql_union index 656b88fd4ad6..4094546df965 100644 --- a/pkg/sql/opt/exec/execbuilder/testdata/distsql_union +++ b/pkg/sql/opt/exec/execbuilder/testdata/distsql_union @@ -32,254 +32,1066 @@ subtest Union # Simple UNION ALL and UNION. (The ORDER BY applies to the UNION, not the last select.) query T -SELECT url FROM [EXPLAIN (DISTSQL) SELECT x FROM xyz UNION ALL SELECT x FROM xyz ORDER BY x] +EXPLAIN (DISTSQL) SELECT x FROM xyz UNION ALL SELECT x FROM xyz ORDER BY x ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJysVluL2kwYvv9-xfBefaUT4kziKVduuxYEq1u10LLkIjXDIrhOOhMhrvjfi0llq5h3JofLJPPMc0Q8gv69hQCW4-n484rs1ZZ8Wcy_kufxj6fpw2RG_n-cLFfLb9MP5O-RrDiQHd7I99lkPiMP0-mdb_PF43hBPv0kWQgUdjIWs-hVaAiegQEFDhQ8oOADhS6EFBIl10Jrqc5HjjlgEmcQdChsdsk-Pb8OKaylEhAcId2kWwEBrKJfW7EQUSyU2wEKsUijzTanyQ5vo0RtXiN1AArLJNrpgDjumXm-TwMyYhCeKMh9-n69TqMXAQE70XoSuq1J4KUS3pmlioUS8TUnhKc7ImfSkYnLriMq4-5Usb-UKhXKZTfWR-xjqTevrrfi0lJ73M6ef0XP7NtlFu263HG9yhOrIKLXogheKqLJyFiNkRkCuIysV3dk3D5gbhOw57h-5ZYriOi3KIKXimjSMq_RsiGAS8v9ui179gF7NgH7Tv6LXq3lCiIGLYrgpSKatOzVaNkQwKXlQd2WffuAfZuAu07ljitIGLYmgZdKaNKwX6Nhg_1Lw8M2_hLcuX8hdCJ3WlgqDymI-EUUQWm5V2vxpOQ6pyke5zkufxELnRZfefEw2eWf8v7_BbMmYI6CvStw5xbsoWAfZ_Zx2Qyn7qLoPk7dawLuo-ABLnvQJLEhCmbMMBN8ZEY4PjPGceMMH5rBOcOXxroGOL41IxwfG-sZrONzM1nH98aGBji-OCMc3xzv4NY5vrlb6-Hpvz8BAAD__-vKM3c= +distribution: full +vectorized: true +· +• sort +│ order: +x +│ +└── • union all + │ + ├── • scan + │ missing stats + │ table: xyz@primary + │ spans: FULL SCAN + │ + └── • scan + missing stats + table: xyz@primary + spans: FULL SCAN +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJysVk2L2kAYvvdXDO-ppRPiTOJXTm67FgSrW7XQUnJIzbAIrpPORIgr_vdiguwq5p3JxzEZn3k-kRxB_9tCAONfT9OHyYx8fJwsV8sf009kOZ6Ov65IRr4t5t9JdnglP2eT-Yw8TKd3zuaLx_GCfPlNMqCwk7GYRS9CQ_AHGFDgQMEDCj5Q6EJIIVFyLbSW6vyTYw6YxBkEHQqbXbJPz69DCmupBARHSDfpVkAAq-jvVixEFAvldoBCLNJos81pssPrKFGbl0gdgMIyiXY6II57Zp7v04CMGIQnCnKfvl2v0-hZQMBOtJ6EbmsSeKmEN2apYqFEfM0J4emOyJl0ZOKy64jKuDtV7C-lSoVy2Y31Eftc6s2r6624tNQet7PnX9Ez-3aZRbsud1yv8sQqiOi1KIKXimgyMlZjZIYALiPr1R0Ztw-Y2wTsOa5fueUKIvotiuClIpq0zGu0bAjg0nK_bsuefcCeTcC-k_-jV2u5gohBiyJ4qYgmLXs1WjYEcGl5ULdl3z5g3ybgrlO54woShq1J4KUSmjTs12jYYP_S8LCNT4I79y-ETuROC0vlIQURP4siKC33ai2elFznNMXjPMflL2Kh0-KUFw-TXX6U9_8ezJqAOQr2rsCdW7CHgn2c2cdlM5y6i6L7OHWvCbiPgge47EGTxIYomDHDTPCRGeH4zBjHjTN8aAbnDF8a6xrg-NaMcHxsrGewjs_NZB3fGxsa4PjijHB8c7yDW-f45m6th6cP_wMAAP__BE4uGA== query T -SELECT url FROM [EXPLAIN (DISTSQL) SELECT x FROM xyz UNION SELECT x FROM xyz ORDER BY x] +EXPLAIN (DISTSQL) SELECT x FROM xyz UNION SELECT x FROM xyz ORDER BY x ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJyslt-L2k4Uxd-_f0W4T9_SkTiTxB952rZaEKxu1ULLkofUDEvATezMBHTF_72YFFKte2cmyaMx557PnHsIcwL5awchrKfz6aeNU4id83m1_OI8Tb8_zj_MFs7_k9l6s_46f-f8eeVQvXA4vjrfFrPl4s7z5WoyXTkffziHCAhkecIX8QuXED4BBQIMCHhAwAcCAUQE9iLfcilzcXnlVApmyQHCPoE02xfq8jgisM0Fh_AEKlU7DiFs4p87vuJxwoXbBwIJV3G6K20Ox9eHvUhfYnEEAut9nMnQ6bkX52WhQueBQnQmkBeqHi9V_MwhpGfSDCHoDIHZIExSqdJsq1x6kwFi4DUzCIwN_DcN6rlFlouEC55cTY3OGAIzP2Ngc8Z1LhQXLqO349-_OX9wNZ-a94Qa9MRlPdezLqsFxKBDCGYDUbfpn6wN62psMGhYV2YeIzOJ0eu5vvUuLSCGHUIwG4g6atZwl8YGw4a79Mxj9Exi9Hvld95ulxYQow4hmA1EHbXXcJfGBqOGu_TNY_RNYgx61pu0QBh3hsBsEOqY_YZ7NDYYd3AduGOw4nKfZ5LfXAvuT-5frgs8eebV3ULmhdjyR5FvS5vq57LUlQ8SLlX1r1f9mGXVXxfAv8UUFTNczFCxfyWmt2KvjdhHxQGOHeBn1hx6gKrHuHiIike4eNQmsXEbMcU7RnUlw1tGNYnTVj2jrYpG8abRoQYd7xodaOR42XTseNt0arxujGrQ8cKxvubTgjdOw87wwt2qo_N_vwMAAP__-ZQ87A== +distribution: full +vectorized: true +· +• sort +│ order: +x +│ +└── • union + │ + ├── • scan + │ missing stats + │ table: xyz@primary + │ spans: FULL SCAN + │ + └── • scan + missing stats + table: xyz@primary + spans: FULL SCAN +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJyslk-P2jAQxe_9FNacWtUo2En4k9O2hUpIFLZApVYVh5RYq0hsTG0jwSK-e0U4pLDs2A45kvDm_fzmKfIB9N81JDD8-Tj-NJqQ94PRfDH_Pv5A5sPx8MuC7MjX2fQb2e1fyI_JaDq58Xw6Gwxn5PMvsgMKhczEJH0WGpLfwIACBwohUIiAQgxLChslV0JrqU5_OZSCUbaDpE0hLzZbc3q8pLCSSkByAJObtYAEFumftZiJNBMqaAOFTJg0X5c2u_3Lw0blz6naA4X5Ji10QlrByXm6NQl5YLA8UpBbU43XJn0SkLAjrYcQN4bAfRAGuTZ5sTIBu8oAMQjrGcTOBtGbBtXcbSFVJpTILqYujxgCdz9j7HPGuVRGqICz6_Ef35zfuZjP3HvCHHoS8FYQepfVA6LTIAT3gaja9Cprx7o6G3Rq1pW7x8hdYgxbQeS9Sw-IboMQ3AeiiprX3KWzQbfmLkP3GEOXGKNW-Z3326UHRK9BCO4DUUUd1tyls0Gv5i4j9xgjlxjjlvcmPRD6jSFwH4Qq5qjmHp0N-g1cB24YzITeyEKLq2vB7cnt03VBZE_ifLfQcqtW4lHJVWlz_jktdeWDTGhzfhuef4yK86sT4P9ihoo5LuaoOLoQs2txeI84QsUxjh3jZ7YcuoOq-7i4i4p7uLh3T2L9e8QM7xizlQxvGbMkzu7qGburaAxvGuta0PGusY5FjpfNxo63zabG68aZBR0vHG9bPi144yzsHC_ctXp5fPcvAAD__4tHN40= # UNION with no overlap. query T -SELECT url FROM [EXPLAIN (DISTSQL) SELECT x FROM xyz WHERE x < 3 UNION SELECT x FROM xyz WHERE x >= 3 ORDER BY x] +EXPLAIN (DISTSQL) SELECT x FROM xyz WHERE x < 3 UNION SELECT x FROM xyz WHERE x >= 3 ORDER BY x ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJysl19v2koQxd_vp1jN0726RmZ2zT9LV8ptQ1SkFFKgaquUB4pXkSVi07UtkUR89wpc4UCTmV3Hj9g-e-bs_GazeYLs5xpCmA2vh-_nojBrcTWdfBS3w6831_-PxuLvy9FsPvt0_Y_4_cm2_GD78Ci-fBhOh2IrvhfttloJJT6PR5Mx96H-TygxmV4Op-LdN7FdgAdJGunx8l5nEN4CggcSPFDgQQAedGDhwcakK51lqdl_8nQQjKIthG0P4mRT5PvHCw9WqdEQPkEe52sNIcyXP9Z6qpeRNn4bPIh0vozXB5vtw-PFxsT3S_MAHsw2yyQLRcvfO0-KPBQXCIudB2mRV8tn-fJOQ4g7z76Eq3ida6ON3zn1L5_vfaptCcNwNJ73XzWWLsbPs2Nz4VWt8MikX_HhAxfjyzjL42SV-_IsOZGsU8-gY23QfdWgWrdIUhNpo6OTVRc7qgRln7HnknGWmlwbX-H58v--un7_ZH10INQCUF-2fOU8n0wRR0S7Tc-nS_om46ta8ZHJ7zyhjHE1QH_gZTmh1gbdmhMq7RsobfqnWn7gjC9TxLF_vabxdUiPTcZXteIjk98ZX8a4okvWxNfaoFcTX2XfQGXTv6B1uMO44csUcexfv2l8HdJjk_FVrfjI5HfGlzGu6FI18bU26NfEN7BvYGDTv07LGV6mhGP3Bk3D65AdmwuvaoVHJr0zuoxxRVZQE11rg0EDV_sXDKY626RJps-u-C-v3N5f_XV0p8v_E7K0MCt9Y9LVwab8OTnoDg8ineXlWyx_jJLy1b7A52IkxR1aLEmxosWKFAe0OCDF3RMxnos7bxF3SXGPLrtHb5ik1X1SPaDFA5oSplnIQMZRRmOGTHCkQWM6hjRpnJpGDZkRQRo2ZLqGNG7I8IY0cNhn5DRx3M7RyDFqSRMnGeIkTZzkTjaaOMmMi6SRk8zpJt90vMk3nW-SJk4yxEnmiOPaRhMnmXGRNHKqzfxJopljdk7RyJ2rF7u_fgUAAP__drSVQQ== +distribution: full +vectorized: true +· +• sort +│ order: +x +│ +└── • union + │ + ├── • filter + │ │ filter: x < 3 + │ │ + │ └── • scan + │ missing stats + │ table: xyz@primary + │ spans: FULL SCAN + │ + └── • filter + │ filter: x >= 3 + │ + └── • scan + missing stats + table: xyz@primary + spans: FULL SCAN +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJysl99u2kwQxe-_p1jN1VfVyMyu-WepUtqGqEgppEDVVi0Xrr2KLBGbro1EEvHuFSDhQJOZXceX2D575uz8ZrN5hOLPEkIYfr-5fj8ai_8vR7P57Mv1GzEbXg8_zsVGXE0nn8Xm_kF8-zScDsVG_Fq32yoWSnwdjyZj7kP9TigxmV4Op-LDD7EBD7I80ePoThcQ_gQEDyR4oMCDADzowMKDlcljXRS52X3yuBeMkg2EbQ_SbLUud48XHsS50RA-QpmWSw0hzKPfSz3VUaKN3wYPEl1G6XJvs7l_uFiZ9C4y9-DBbBVlRSha_s55si5DcYGw2HqQr8tq-aKMbjWEuPXsS7hKl6U22vidU__D851PtSthGI7G8_6LxtLF-Gl2bC68qhUemfQxHz5wMb5MizLN4tKXZ8mJZJ16Bh1rg-6LBtW66yw3iTY6OVl1saVKUPYZey4ZZ7kptfEVni__9sX1-yfrowOhFoD6suUr5_lkijgi2m16Pl3SNxlf1YqPTH7nCWWMqwH6By_LCbU26NacUGnfQGnTP9XyA2d8mSKO_es1ja9DemwyvqoVH5n8zvgyxhVdsia-1ga9mvgq-wYqm_4Frf0dxg1fpohj__pN4-uQHpuMr2rFRya_M76McUWXqomvtUG_Jr6BfQMDm_51Ws7wMiUcuzdoGl6H7NhceFUrPDLpndFljCuygproWhsMGrjaP2Mw1cUqzwp9dsV_fuX27uqvk1t9-D-hyNcm1jcmj_c2h5-TvW7_INFFeXiLhx-j7PBqV-BTMZLiDi2WpFjRYkWKA1ockOLuiRjPxZ3XiLukuEeX3aM3TNLqPqke0OIBTQnTLGQg4yijMUMmONKgMR1DmjROTaOGzIggDRsyXUMaN2R4Qxo47DNymjhu52jkGLWkiZMMcZImTnInG02cZMZF0shJ5nSTrzre5KvON0kTJxniJHPEcW2jiZPMuEgaOdVm_iTRzDE7p2jkztWL7X9_AwAA__-dZI_i # UNION with partial overlap. query T -SELECT url FROM [EXPLAIN (DISTSQL) SELECT x FROM xyz WHERE x <= 4 UNION SELECT x FROM xyz WHERE x > 1 ORDER BY x] +EXPLAIN (DISTSQL) SELECT x FROM xyz WHERE x <= 4 UNION SELECT x FROM xyz WHERE x > 1 ORDER BY x ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJysl19v2koQxd_vp1jN0726RmZ2zT9LV8ptQ1SkFFKgaquUB4pXkSVi07UtkUR898q4gkCTmV3Hj9g-e-bs_GazeYLs5xpCmA2vh-_nojBrcTWdfBS3w6831_-PxuLvy9FsPvt0_Y_4_cm2-mD78Ci-fBhOh2Irvhfttlr9JwLxeTyajLkvtUAxmV4Op-LdN7FdgAdJGunx8l5nEN4CggcSPFDgQQAedGDhwcakK51lqSk_edoLRtEWwrYHcbIp8vLxwoNVajSET5DH-VpDCPPlj7We6mWkjd8GDyKdL-P13mb78HixMfH90jyAB7PNMslC0fJL50mRh-ICYbHzIC3y4_JZvrzTEOLOsy_hKl7n2mjjd079q-elz2FXwjAcjef9V32li-_z6NhcdlUrOzLhS3i49IGL82Wc5XGyyn15Fp2I1qln0LE26L5qcFy3SFITaaOjk1UXO6oEZZ-x55JxlppcG1_h-fL_vrp-_2R9dEDUglBftnzlPJ9MEQdGuw3Pp0v4JtOrWumRie8-oYzzcYD-wMtyQq0NujUnVNp3UNo0ULX8wBlfpohDA3sN4-sQHptMr2qlRya-O76M85EuWRNfa4NeTXyVfQeVTQOD1v4O44YvU8Shgf2G8XUIj02mV7XSIxPfHV_G-UiXqomvtUG_Jr6BfQcDmwZ2Ws7wMiUc2jdoGF6H6NhcdlUrOzLh3dFlnI9kBTXRtTYYNHC1f8FgqrNNmmT67Ir_8srt8uqvoztd_Z-QpYVZ6RuTrvY21c_JXrd_EOksr95i9WOUVK_KAp-LkRR3aLEkxYoWK1Ic0OKAFHdPxHgu7rxF3CXFPbrsHr1hklb3SfWAFg9oSphmIQMZRxmNGTLBkQaN6RjSpHFqGjVkRgRp2JDpGtK4IcMb0sBhn5HTxHE7RyPHqCVNnGSIkzRxkjvZaOIkMy6SRk4yp5t80_Em33S-SZo4yRAnmSOOaxtNnGTGRdLIqTbzJ4lmjtk5RSN3rl7s_voVAAD__20OlTs= +distribution: full +vectorized: true +· +• sort +│ order: +x +│ +└── • union + │ + ├── • filter + │ │ filter: x <= 4 + │ │ + │ └── • scan + │ missing stats + │ table: xyz@primary + │ spans: FULL SCAN + │ + └── • filter + │ filter: x > 1 + │ + └── • scan + missing stats + table: xyz@primary + spans: FULL SCAN +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJysl99u2kwQxe-_p1jN1VfVyMyuzR9LldI2REVKIQWqtmq5cPEqskRsujYSScS7VwYJAk1mdh1fYvvsmbPzm83mEYo_S4hg8P3m-v1wJP6_HE5n0y_Xb8R0cD34OBMbcTUZfxab-wfx7dNgMhAb8WvdbqvFOxGIr6PheMR9qQWK8eRyMBEffogNeJDliR7Fd7qA6CcgeCDBAwUeBOBBCHMPViZf6KLITfXJ404wTDYQtT1Is9W6rB7PPVjkRkP0CGVaLjVEMIt_L_VEx4k2fhs8SHQZp8udzeb-4WJl0rvY3IMH01WcFZFo-ZXzeF1G4gJhvvUgX5fH5YsyvtUQ4dazL-EqXZbaaOOHp_7755XPYVOiKBqOZr0XfaWL79Po2Fx2VSs7MuErdrj0gYvzZVqUabYofXkWnYgW1jMIrQ06Lxoc111nuUm00cnJqvMtVYKyz9h1yTjNTamNr_B8-bcvrt87WR8dELUg1JctXznPJ1PEgdFOw_PpEr7J9KpWemTiu08o43wcoH_wspxQa4NOzQmV9h2UNg1ULT9wxpcp4tDAbsP4OoTHJtOrWumRie-OL-N8pEvWxNfaoFsTX2XfQWXTwKC1u8O44csUcWhgr2F8HcJjk-lVrfTIxHfHl3E-0qVq4mtt0KuJb2DfwcCmgWHLGV6mhEP7-g3D6xAdm8uuamVHJrw7uozzkaygJrrWBv0GrvbPGEx0scqzQp9d8Z9fuV1d_XVyq_f_JxT52iz0jckXO5v9z_FOt3uQ6KLcv8X9j2G2f1UV-FSMpDikxZIUK1qsSHFAiwNS3DkR47k4fI24Q4q7dNldesMkre6R6j4t7tOUMM1CBjKOMhozZIIjDRrTMaRJ49Q0asiMCNKwIdM1pHFDhjekgcMeI6eJ43aORo5RS5o4yRAnaeIkd7LRxElmXCSNnGRON_mq402-6nyTNHGSIU4yRxzXNpo4yYyLpJFTbeZPEs0cs3OKRu5cPd_-9zcAAP__k7-P3A== # UNION ALL with swapped column orders. query T -SELECT url FROM [EXPLAIN (DISTSQL) SELECT x, y FROM xyz UNION ALL SELECT y, x from xyz] +EXPLAIN (DISTSQL) SELECT x, y FROM xyz UNION ALL SELECT y, x from xyz ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJysldGKm0wcxe-_pxj-V19hxMyMZjdeZWlTCFizTVIoLF7YOCwB17EzCroh716ibbdZknFGc6njz3M855AcQP3MIIDNIlx83KJKZujzevUFPS2-P4YPywj9_2m52W6-hh_Q70dqjJrumbp5Rd-i5SpCD2H457jBqP57HAOGXKQ8Sl64guAJCGCggIEBBg8w-BBjKKTYcaWEPD1yaIFlWkMwwbDPi6o83Y4x7ITkEByg3JcZhwC2yY-Mr3mSculOAEPKy2SftTJ18zov5P4lkQ1g2BRJrgLkuCflVVUGaE7xnEB8xCCq8k1Blckzh4Ac8TAXvqULguf0qgt61cWbuJAplzw9l4X4eMFnJBxRuOQ8qGvaEwPtKr-krtP2jbTZmTYxT58YpO9Sx2VDVmDhY2rtw2IH5EY7IAN2QM0zoCYZMMf1hnRh4ePO2odFF_RGXdABXTDzDJhJBp7T_npZd2Hh497ah0UX7EZdsAFdeOYZeCYZ-M6QJixczCxdWPTg3agHb-T_1IU3r7kqRK644ZtjDDx95t2HKFHJHX-UYtfKdJerlmtvpFyV3SntLpZ5e9RW9C9MxsBUCzM9zLQwmZ7Rk_e0p6Wneml_DDwd89F3Wnimh-_HwLMxtol-Y6RvZPqV9eKjdkZ6hub34Pql9eL6rb33Hh__-xUAAP__Ixk2GA== +distribution: full +vectorized: true +· +• union all +│ +├── • scan +│ missing stats +│ table: xyz@primary +│ spans: FULL SCAN +│ +└── • scan + missing stats + table: xyz@primary + spans: FULL SCAN +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJyslUGLm0Acxe_9FMP_1MKImRnNbjxlaVMQrNkmKRSKBxuHJZB17IyCbsh3LzG0u1mScUY96uTne773iAdQf_YQwOLnY_QQxujjl3C9WX-PPqH1Ilp83qAaowZ9XS2_obp5QT_icBmjhyj6d9xgVP8_Bgy5yHicPnMFwS8ggIECBgYYPMDgQ4KhkGLLlRLy9JNDC4RZDcEEwy4vqvJ0O8GwFZJDcIByV-45BLBJf-_5iqcZl-4EMGS8THf7VqZuXuaF3D2nsgEM6yLNVYAc96S8rMoAzSmeE0iOGERVviqoMn3iEJAj7ufCt3RB8JzedEFvungVFzLjkmeXspAcr_iMhSMKl1wGdUt7YqBd5dfUddq-kTa70Cbm6ROD9F3quKzPCix8TK19WOyAjLQD0mMH1DwDapIBc1yvTxcWPu6sfVh0QUfqgvbogplnwEwy8Jz238u6Cwsf99Y-LLpgI3XBenThmWfgmWTgO32asHAxs3Rh0YM3Ug_ewO_UlSevuCpErrjhkxMMPHvi5xdRopJb_ijFtpU5Xy5brr2RcVWeT-n5Iszbo7aitzAZAlMtzPQw08JkekFP3tOelp7qpf0h8HTIS99p4Zkevh8Cz4bYJvqNka6R6VfWiQ_aGekYmt-B65fWieu39t57cvzwNwAA__9z7TC5 # UNION ALL and UNION with different ORDER BY types. query T -SELECT url FROM [EXPLAIN (DISTSQL) (SELECT x FROM xyz ORDER BY y) UNION ALL (SELECT x FROM xyz ORDER BY z) ORDER BY x] +EXPLAIN (DISTSQL) (SELECT x FROM xyz ORDER BY y) UNION ALL (SELECT x FROM xyz ORDER BY z) ORDER BY x ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJysVk2L2kAYvvdXDO9ppRPiTOJXTm67FgSrW7XQsuSQmmERXCedRIiK_72YVFxl887k47ZJ5pnnk8UjxH834MFiNBl9XZKd2pBv89l38jL69Tx5HE_Jw9N4sVz8mLTIw_8zaX4i3R_IbP40mpMvv8m-RX5Ox7MpeZxM0IOH1vXv1AcKWxmKafAmYvBegAEFDhQcoOAChQ74FCIlVyKOpTofOWaAcZiC16aw3ka75Pzap7CSSoB3hGSdbAR4sAz-bMRcBKFQdhsohCIJ1puMJt0fhpFavwVqDxQWUbCNPWLZZ-bZLvHIkIF_oiB3yfX6OAleBXjsRKtJ6DQmgRdKuDJLFQolwltO8E8fiJxKS0Y2u42oiLtdxv5CqkQom91ZH7LPhd6cqt7ySwvtcTN77g09M2-XGbRrc8t2Sk-shIhugyJ4oYg6I2MVRqYJ4DKybtWRcfOAuUnAjmW7pVsuIaLXoAheKKJOy7xCy5oALi33qrbsmAfsmATsWtl_9HItlxDRb1AELxRRp2WnQsuaAC4t96u27JoH7JoE3LFKd1xCwqAxCbxQQp2G3QoNa-xfGh408ZPgg_vnIo7kNhaGyn0KInwVeVCx3KmVeFZyldHkj7MMl70IRZzkX3n-MN5mn7L-34NZHTBHwc4NuH0PdlCwizO7uGyGU3dQdA-n7tYB91BwH5fdr5PYAAUzppkJPjItHJ8Z47hxhg9N45zhS2MdDRzfmhaOj411Ndbxuems43tjAw0cX5wWjm-Ot3HrHN_cvXX_9OlfAAAA___q9jn6 +distribution: full +vectorized: true +· +• sort +│ order: +x +│ +└── • union all + │ + ├── • scan + │ missing stats + │ table: xyz@primary + │ spans: FULL SCAN + │ + └── • scan + missing stats + table: xyz@primary + spans: FULL SCAN +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJysVluL2kwYvv9-xfBerXwT4kziKVduuxYEq1u10FJykZphEVwnnYngAf97MUGssnlncrgzh2eeI5IT6D8bCGD043XyPJ6Sp5fxYrn4NmmRp8VoMvq8JHvyZT77SvaHI5nNX0Zz8uknObTI9-l4NiXPkwn64rF1-70HClsZi2n0LjQEv4ABBQ4UPKDgA4UOhBQSJVdCa6kur5wywDjeQ9CmsN4mu_RyO6SwkkpAcIJ0nW4EBLCMfm_EXESxUG4bKMQijdabjGZ_OA4TtX6P1AEoLJJoqwPiuBfm2S4NyJBBeKYgd-nteJ1GbwICdqbVJHQak8ALJdyYpYqFEvE9J4TnD0ROpSMTl91HVMTdLmN_IVUqlMserA_Z_4XevKre8kML7XE7e_4dPbNvl1m063LH9UpPrISIboMieKGIOiNjFUZmCOA6sm7VkXH7gLlNwJ7j-qVbLiGi16AIXiiiTsu8QsuGAK4t96q27NkH7NkE7DvZP3q5lkuI6DcogheKqNOyV6FlQwDXlvtVW_btA_ZtAu44pTsuIWHQmAReKKFOw36Fhg32rw0Pmvgk-OD8udCJ3GphqTykIOI3kQel5U6txKuSq4wmv5xluOxGLHSaP-X5xXibPcr6_xfM6oA5CvbuwO1HsIeCfZzZx2UznLqDons4dbcOuIeC-7jsfp3EBiiYMcNM8JEZ4fjMGMeNM3xoBucMXxrrGOD41oxwfGysa7COz81kHd8bGxjg-OKMcHxzvI1b5_jmHq2H5__-BgAA__96tDSb query T -SELECT url FROM [EXPLAIN (DISTSQL) (SELECT x FROM xyz ORDER BY y) UNION (SELECT x FROM xyz ORDER BY z) ORDER BY x] +EXPLAIN (DISTSQL) (SELECT x FROM xyz ORDER BY y) UNION (SELECT x FROM xyz ORDER BY z) ORDER BY x ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJyslk2P2jwUhffvr7DuatBrFOwkfGQ1baESEoUpUKnVKIuUWKNITEJtR-JD_PeKpFIKnbmxQ3aQ-Pg8Pvco8gnUry0EsJrMJp_WJJdb8nm5-EKeJ9-fZh-mc_Iwnq7Wq6-zDnn4s2ZfrtgfjmSxHE-W5OMPcuiQb_PpYo4uOnaq3_sQKKRZLObRq1AQPAMDChwouEDBAwo-hBR2MtsIpTJ5WXIqBNN4D0GPQpLucn15HFLYZFJAcAKd6K2AANbRz61YiigW0ukBhVjoKNkWNvvD8XEnk9dIHoDCahelKiBd5-K8yHVAHhmEZwpZrqvtlY5eBATsTJsh-K0hcBuEcaJ0km60w24yQAzcZga-sYH3rkG1b55mMhZSxFe7hmcMgZuf0bc54yqTWkiHs9vt_393__7V_sy8J8ygJw7vOq51WS0g-i1CcBuIqk3_ZG1YV2ODfsO6cvMYuUmMbtfxrGdpATFoEYLbQFRR84azNDYYNJylax6jaxKj1y2-83aztIAYtgjBbSCqqN2GszQ2GDacpWceo2cSo9-1nqQFwqg1BG6DUMXsNZyjscGohevAGwZLoXZZqsTNteDtnXuX64KIX0R5t1BZLjfiSWabwqb8uyh0xYNYKF2-dcs_07R8dQH8W8xQMcfFHBV7V2J2K3bvEXuo2MexffzMNYfuo-oRLh6g4iEuHt6T2OgeMcM7xupKhreM1STO7uoZu6toDG8aG9Sg411j_Ro5XrY6drxtdWq8bpzVoOOF472aTwveuBp2jhfuVh2e__sdAAD__5v9Q28= +distribution: full +vectorized: true +· +• sort +│ order: +x +│ +└── • union + │ + ├── • scan + │ missing stats + │ table: xyz@primary + │ spans: FULL SCAN + │ + └── • scan + missing stats + table: xyz@primary + spans: FULL SCAN +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJyslkuP2jAUhff9FdZdDapRsJPwyGraQiUkClOgUquKRUqsUSQmobaReIj_XhEWKczMtZ1kxyPnns_nHkU-gfq7gQhGP58mn8ZT8jAcL5aL75MWeViMJqMvS7InX-ezb2R_OJLZfDiak8-_yKFFfkzHsyn60LFVft4DhSxPxDR-EQqi38CAAgcKPlAIgEIIKwpbma-FUrm8PHIqBONkD1GHQpptd_ry84rCOpcCohPoVG8ERLCM_2zEXMSJkF4HKCRCx-mmsNkfjo9bmb7E8gAUFts4UxFpexfn2U5H5JHB6kwh3-lyvNLxs4CInWk1hLAxBO6CMEyVTrO19thdBoiBX80gtDYI3jUo5-6yXCZCiuRm6uqMIXD7M4YuZ1zkUgvpcXY__uO787s385l9T5hFTzze9nznsjpAdBuE4C4QZZteZW1ZV2uDbsW6cvsYuU2MftsLnHfpANFrEIK7QJRR84q7tDboVdylbx-jbxNj0C7e8267dIDoNwjBXSDKqP2Ku7Q26FfcZWAfY2ATY9h23qQDwqAxBO6CUMYcVNyjtcGggevAGwZzobZ5psTdteDtyZ3LdUEkz-J6t1D5Tq7Fk8zXhc3166zQFT8kQunrv_71yzi7_nUB_F_MUDHHxRwVBzdidi_264gDVBzi2CF-ZsOhu6h6gIt7qLiPi_t1EhvUETO8Y8xUMrxlzJA4q9UzVqtoDG8a6xnQ8a6xrkGOl83EjrfNpMbrxpkBHS8c7xheLXjjDOwcL9y9enX-8C8AAP__pOo-EA== # UNION ALL with conflicting numbers of ORDER BY columns. query T -SELECT url FROM [EXPLAIN (DISTSQL) (SELECT x FROM xyz ORDER BY y) UNION ALL (SELECT x FROM xyz ORDER BY y, z) ORDER BY x] +EXPLAIN (DISTSQL) (SELECT x FROM xyz ORDER BY y) UNION ALL (SELECT x FROM xyz ORDER BY y, z) ORDER BY x ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJysVk2L2kAYvvdXDO9ppRPiTOJXTm67FgSrW7XQsuSQmmERXCedRIiK_72YVFxl887k45hknnk-EY8Q_92AB4vRZPR1SXZqQ77NZ9_Jy-jX8-RxPCUPT-PFcvFj0iIP_8-k-Yl0fyCz-dNoTr78JvsW-Tkdz6bkcTLBD1JyaF0fUx8obGUopsGbiMF7AQYUOFBwgIILFDrgU4iUXIk4lup85JgBxmEKXpvCehvtkvNrn8JKKgHeEZJ1shHgwTL4sxFzEYRC2W2gEIokWG8ymnR_GEZq_RaoPVBYRME29ohln5lnu8QjQwb-iYLcJdfr4yR4FeCxE60modOYBF4o4cosVSiUCG85wT99IHIqLRnZ7DaiIu52GfsLqRKhbHZnfcg-F3pzqnrLLy20x83suTf0zLxdZtCuzS3bKT2xEiK6DYrghSLqjIxVGJkmgMvIulVHxs0D5iYBO5btlm65hIhegyJ4oYg6LfMKLWsCuLTcq9qyYx6wYxKwa2W_6OVaLiGi36AIXiiiTstOhZY1AVxa7ldt2TUP2DUJuGOV7riEhEFjEnihhDoNuxUa1ti_NDxo4i_BB_fPRRzJbSwMlfsURPgq8qBiuVMr8azkKqPJH2cZLnsRijjJv_L8YbzNPmX9vwezOmCOgp0bcPse7KBgF2d2cdkMp-6g6B5O3a0D7qHgPi67XyexAQpmTDMTfGRaOD4zxnHjDB-axjnDl8Y6Gji-NS0cHxvraqzjc9NZx_fGBho4vjgtHN8cb-PWOb65e-v-6dO_AAAA__9enTq_ +distribution: full +vectorized: true +· +• sort +│ order: +x +│ +└── • union all + │ + ├── • scan + │ missing stats + │ table: xyz@primary + │ spans: FULL SCAN + │ + └── • scan + missing stats + table: xyz@primary + spans: FULL SCAN +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJysVluL2kwYvv9-xfBerXwT4kziKVduuxYEq1u10FJykZphEVwnnYngAf97MUGssnlncricJM88R8QT6D8bCGD043XyPJ6Sp5fxYrn4NmmRp8VoMvq8JHvyZT77SvaHI5nNX0Zz8uknObTI9-l4NiXPkwn-ISXH1u24BwpbGYtp9C40BL-AAQUOFDyg4AOFDoQUEiVXQmupLp-cMsA43kPQprDeJrv08jiksJJKQHCCdJ1uBASwjH5vxFxEsVBuGyjEIo3Wm4xmfzgOE7V-j9QBKCySaKsD4rgX5tkuDciQQXimIHfp7XqdRm8CAnam1SR0GpPACyXcmKWKhRLxPSeE5w9ETqUjE5fdR1TE3S5jfyFVKpTLHqwP2f-F3ryq3vJLC-1xO3v-HT2zb5dZtOtyx_VKT6yEiG6DInihiDojYxVGZgjgOrJu1ZFx-4C5TcCe4_qlWy4hotegCF4ook7LvELLhgCuLfeqtuzZB-zZBOw72S96uZZLiOg3KIIXiqjTslehZUMA15b7VVv27QP2bQLuOKU7LiFh0JgEXiihTsN-hYYN9q8ND5r4S_DB_XOhE7nVwlJ5SEHEbyIPSsudWolXJVcZTX6cZbjsQSx0mr_l-WG8zV5l_f8LZnXAHAV7d-D2I9hDwT7O7OOyGU7dQdE9nLpbB9xDwX1cdr9OYgMUzJhhJvjIjHB8Zozjxhk-NINzhi-NdQxwfGtGOD421jVYx-dmso7vjQ0McHxxRji-Od7GrXN8c4_Ww_N_fwMAAP__3oE1YA== # Only one distinct processor should be used in the single node UNION case. query T -SELECT url FROM [EXPLAIN (DISTSQL) VALUES (1), (2) UNION VALUES (2), (3)] +EXPLAIN (DISTSQL) VALUES (1), (2) UNION VALUES (2), (3) ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJykkc9q8zAQxO_fU4g9xSCI5dx0-kLjgsF10jgpheCDkZZgUKVUf0oh-N2LZWia0pS0PWp2fzsz6AjuWQGHOi_zmw0JVpHb9fKO7PLHVTkvKjJZFPWmvi8T8jAvt3lNJiyhZJIlZFsVy-pdzQZ1ljRAQRuJVfuEDvgOGDQUDtYIdM7YQTrGhUK-Ak8pdPoQ_CA3FISxCPwIvvMKgYMyolXkpVUBHUmnKVCQ6NtOxf2eggn-RDvf7hE46-kvHdiUXeWQXXQ4HQ7aWIkW5aeLX2RYdM53WvhpdrYL_xlcSjD7Scc1uoPRDq_qlg4JUe5xrONMsAJX1ohoMz6XkYuCROfHaTY-Ch1H8RM-wuwvcPYtPDuD077p_70FAAD__6Ke6m8= +distribution: full +vectorized: true +· +• union +│ +├── • values +│ size: 1 column, 2 rows +│ +└── • values + size: 1 column, 2 rows +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJysj0FLAzEQhe_-ijCnXQh0N_WUk5X2sFC21doiSA5LMtTFNamZBISy_12aBWvFCkWP82bevO_tgd46kDB7XM4nVc2yabV6WN3Nc7aZzNezFcvKnLNM5GxdV4v6UxUHdZwDB-sM1s0rEsgnKEFx2Hmnkcj5g7RPB5V5B1lwaO0uhoOsOGjnEeQeQhs6BAmbpotIowI4GAxN26WP1-yWZYLp52hfKAfVc3AxHL9QaLYIsuj5xUnlPycdA6J13qBHc5Kg-h9Ypi2F1uowEqc0N-VZgvKSrvdIO2cJv5Gc66Y4oNniUIdc9BqX3ukUM4yL5EuCQQrDVgxDZdMqAX41l38xi1_N4xNz0av-6iMAAP__nsboJg== subtest Intersect # Basic INTERSECT ALL and INTERSECT case -- should return every row. query T -SELECT url FROM [EXPLAIN (DISTSQL) (SELECT y FROM xyz) INTERSECT ALL (SELECT y FROM xyz) ORDER BY y] +EXPLAIN (DISTSQL) (SELECT y FROM xyz) INTERSECT ALL (SELECT y FROM xyz) ORDER BY y ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJy8ls1u2kAQgO99CmtOibrI3rXNj6VKpA1VkSikmEOryAcHbwMSwe7aSHEi3r3ChKa2YceLE98C7Dc7nvkm42eI_6zAAXcwGnyZaRux0r5OJ9-128HPm9HVcKxdXA_dmftjdKldvJxJ9yce06dLbTieDabu7tur0ejoicn0ejDVPv_SUg8IrMOAj_0HHoNzCxQIMCBgAgELCNjgEYhEOOdxHIrdkecMGAaP4BgElutok-y-9gjMQ8HBeYZkmaw4ODDz71Z8yv2AC90AAgFP_OUqu-YxfepHYvngixQIuJG_jh2tpe9unmwSR-sz8LYEwk3yEv416l2qLfx4kY_Xp-BtPQJx4t9zcOiWnJem3Wia7GSar3E261AEXPAgF8nbkdiRI8_6zY8XLk8mkU4LHZmlEXfy7gCBFf-dXPTp5SexvF9kf_17dFp49NfHMlWq74Yi4UKndrFSH0_GtyqU7VhFXoIeSWIctsJIZ0axxkevt3PX0-py0Qpy6aylm-8yBQqJthtOlJ1MtIE5oA3NAVL_wxy0z50DVr2_rEp_zZZuvYuICol2Gk6UnUy0ARFZQyIi9T-I2DlXRLN6f80q_bVa2Vp-exEVEu02nCg7mWgDIpoNiYjU_yBi91wRrer9tar01269i4YKafYaTZOdTLMBCa2GJESqf5Cw9xavp0fiT3kcheuYV3rzNHY148E93_cgDjdizm9EOM-u2X-cZFz2uhHwONn_yvYfhuvsp6yv1eFOHZjSWrRdi-7JaapQM6oGd-rAhZqp0nYtuienWZE2_qfNHGwUYVMKW_KbLSnMqPxqu858yGFkPuQwNh8IjcwHQiPz0a4zH3IYmQ85jM0HQiPzgdDIfHSklnblknbrzEevjuFyGDFcDmOGIzRiOEJjG0BlbZb_k6rsTVUaXQJKm1MZRzSnpS2SU5UyuehUvkYQ02lpj6iojtCI6wiNyY7hiO0Yjule2qFKustpTHc5jeqO4JjuCI7pXlqked3biO6lnaKke2mnKOkupzHd5TSqO4JjuiM4pntpnyrpLqcx3eU0qjuCY7ojOKZ7aavm37UNue6stFukunvbD38DAAD__4DQfNY= +distribution: full +vectorized: true +· +• sort +│ order: +y +│ +└── • intersect all + │ + ├── • scan + │ missing stats + │ table: xyz@primary + │ spans: FULL SCAN + │ + └── • scan + missing stats + table: xyz@primary + spans: FULL SCAN +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJy8ll9v2jwUh-_fTxGdq1ZvUGIn4U-kSXQr05AYdISLTVMuUuIVJEoyJ0ilFd99SijrkoBPTIrvCuSxfzl-To9fIPm9AhcG3-9GN8OxdnU79Gbet9G1duUNRoNPM22rfZ5OvmpP2-drbTieDaZe9u3NaHT0icn0djDVPv7QtqDDOgrZOHhkCbg_gYAOFHSwQAcbdHDA1yHm0ZwlScSzR15yYBg-gWvqsFzHmzT72tdhHnEG7guky3TFwIVZcL9iUxaEjBsm6BCyNFiu8m2ets_9mC8fA54l8OJgnbhay8h2nmxSV-tT8Hc6RJv0dfm3Ve-32iJIFsX1-gT8na9DkgYPDFyy08-L6SiNSU_GfFtns454yDgLCyv5GYk9cuRdvwTJwmPpJDZI6URm25i5RXVAhxX7lV71yfUHvnxY5H_9fXVSevW317Jkqu9FPGXcIE65Uv-fXN-uUbZjFXld9EiIcdSKYoOa5Rof3d4pbE_qy0VqyGXQlmFdpAskgrYVB6UngyroA6KoD5D6H_qgfW4f0PrnS-ucr9Uy7IuIKBG0ozgoPRlUgYhUkYhI_Q8ids4V0ap_vlad87Vb-Vh-fxElgnYVB6UngyoQ0VIkIlL_g4jdc0W065-vXed8ndZFNJSI2VMak56MqUBCW5GESPUPEvbe43p6ZP0pS-JonbBaN08zqxkLH9j-DJJow-fsjkfzfJv9x0nO5deNkCXp_le6_zBc5z_l51of7jSBCWlEO43onpgmEjUjcnCnCVyqmSztNKJ7YpqWafNf2irAZhm2hLAt3tkWwpSIt3aa9IcYRvpDDGP9gdBIfyA00h_tJv0hhpH-EMNYfyA00h8IjfRHR2hpVyxpt0l_9JoYLoYRw8UwZjhCI4YjNDYBZMZm9T-pzNyUpdEhIDU5pXFEc1KZIgVVCRWLTsRjBDGdVOaIjOoIjbiO0JjsGI7YjuGY7pUZKqW7mMZ0F9Oo7giO6Y7gmO6VQVrUvY3oXpkpUrpXZoqU7mIa011Mo7ojOKY7gmO6V-aplO5iGtNdTKO6IzimO4JjulemavGubYp1p5XZItTd3_33JwAA__80IHd3 query T -SELECT url FROM [EXPLAIN (DISTSQL) (SELECT y FROM xyz) INTERSECT (SELECT y FROM xyz) ORDER BY y] +EXPLAIN (DISTSQL) (SELECT y FROM xyz) INTERSECT (SELECT y FROM xyz) ORDER BY y ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJy8mF1v4kYYhe_7K6y5SlQjMzPmy1KlbBuqItGwBS5arbjwwjRBYjG1jRQ2yn-vMMk68eD3zMQ2dwnweI5f5jwa88SS_zYsYLPhePjb3NnHG-f36eRP58vw78_jT6M75-p2NJvP_hpfO1cvnzmcPvF4-H7tjO7mw-ns-Oq5dyfT2-HU-fUf57BgLttGK3UXflMJC74wzlwmmMskc5nPXNZhC5ft4mipkiSKjx95yoDR6pEFbZett7t9enx54bJlFCsWPLF0nW4UC9g8_LpRUxWuVOy1mctWKg3Xm2yZx8P3m128_hbGB-ay2S7cJoHT8o4rT_Zp4NwItnh2WbRP88snaXivWMCf3Y9F6NQWQdhEuF0n6Xq7TD1emMENLyyQM18PzkOYPJz5fB5CfixEp9YQfmmI_Dr7bRSvVKxW766UXaU0pkCzyiN0moqAJpVH6FaI4H4o5R9h8jBT6WTnycKk5oedCt70_9N4zFy2Uf-mVzf8-pd4ff-Q_fVjm5ffVs9mh82iOFWxJ7Wp_Vx6_b7B2M5N5OWiZ0LcRa1o5_nt4ozPLj94tzw3Fwk3EIknWp60tplFiG6NIYRNiFwlvEGfGYfoNugzXp9M0KzKfFZjBDSpMp_ZRajsM34hn4Ed9uozbWqmPhPmXRYmXZYtz7cWikWIXo0hhE2IvMuiQaEYh-g1KBRRX5vRrMqEUmMENKkyodhFqCwUcSGhgB32KhRtaqZCkeZdliZd9lvZI5GdUCxC9GsMIWxC5F2WDQrFOES_QaHI-tqMZlUmlBojoEmVCcUuQmWhyAsJBeywV6FoUzMVim_eZd-ky52WtU4sIgxqiyBsIuQ99huUiXGIQYMy8etrMppVmUxqjIAmVSYTuwiVZeJfSCZgh73KRJvaR36-OXP9qUp20TZRRr_MtI8zU6t7dfoOkmgfL9XnOFpmy5z-nWRc9sJKJenpXXn6Z7Q9vXUM-BbmJCxoWBRh_hb238HcDuayCi14JXpQhZY9mpYk3akCczBymhaiCi3bleg-TfvkNu3ScMcCFkW4S8I9uiA9Egb33Cdhn9NLD0iag2ZzWiocLM41rdiYAdBIDQBHbkA4kAPAkR04LRegB0AjPwAcCQLgyBAIB3XhmmHeb1k0OloxBVzTBKclw7ugMLRm0K3TnhFtsDhtGj4AuKYaq7LTNCw7jcOyAxyVncZR2YVmWZuyAxqVHeCo7ABHZUc42PECnFvR6VFTDYVrZRe0aoQPjs20atCt06YRfbA4bRoBTjRCU43VmZ-m4aGfxuGpH-Do2E_jsOyaZa3KTtOw7DQOy07jsOwARzuePstK8LVL8IDM6bJLWjUSnKQlrRpw65I2jQTHCkmbRnYArqnGpuyARmUHOCo7wkHZAQ4f8jXLWj3l0zR8zKdx-JxP4_BBH-Box9NnWYm-N_osW8D1stOq8cFJ2qdVU7z1xfNP_wcAAP__HUwL5g== +distribution: full +vectorized: true +· +• sort +│ order: +y +│ +└── • intersect + │ + ├── • scan + │ missing stats + │ table: xyz@primary + │ spans: FULL SCAN + │ + └── • scan + missing stats + table: xyz@primary + spans: FULL SCAN +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJy8mF1v4kYYhe_7K6y5SlQjMx98WaqUbUNVJBq2wEWrKhdemCZILKa2kcJG-e8V0KwTD37PTGxzlwCP5_hlzqMxzyz9d81CNvzz8_jT6M67uh3N5rM_xtfe1Ww4Hv4y9_ber9PJ797T_tu1N7qbD6ezw6vn3p1Mb4dT7-e_vD3z2SZe6rvoq05Z-DfjzGeC-Uwynynmsw6799k2iRc6TePk8JHnIzBaPrGw7bPVZrvLDi_f-2wRJ5qFzyxbZWvNQjaPvqz1VEdLnQRt5rOlzqLV-rjM0_7bzTZZfY2SQ4LZNtqkodcKDitPdlno3Qh2_-KzeJfll0-z6EGzkL_4H4vQqS2CcIlwu0qz1WaRBbwwgxteWCBnvuy9xyh9PPP5PIT8WIhOrSFUaYj8OrtNnCx1opfvrnS8SmlMgWaVR-g0FQFNKo_QrRDB_1DK36L0caazyTaQhUnN91sdvqn_p_GY-Wyt_8mubvj1T8nq4fH41_dtXn5bPZcdNouTTCeBNKb2Y-n1-xZjOzeR_y96JsRd3Iq3gWoXZ3x2-cG75bm9SLiFSALRCqSzzRxCdGsMIVxC5CrhDfrMOkS3QZ_x-mSCZlXmsxojoEmV-cwtQmWf8Qv5DOywV58ZU7P1mbDvsrDpsmwFylkoDiF6NYYQLiHyLosGhWIdotegUER9bUazKhNKjRHQpMqE4hahslDEhYQCdtirUIyp2QpF2ndZ2nRZtY6PRG5CcQjRrzGEcAmRd1k2KBTrEP0GhSLrazOaVZlQaoyAJlUmFLcIlYUiLyQUsMNehWJMzVYoyr7LyqbLnZazThwiDGqLIFwi5D1WDcrEOsSgQZmo-pqMZlUmkxojoEmVycQtQmWZqAvJBOywV5kYU_vIzzdnrj_V6TbepNrql5n2YWZ6-aBP30Ea75KF_pzEi-Myp38nR-74wlKn2eldefpntDm9dQj4FuYkLGhYFGH-FlbvYO4Gc1mFFrwSPahCyx5NS5LuVIE5GDlNC1GFlu1KdJ-mFblNuzTccYBFEe6ScI8uSI-EwT33SVhxeukBSXPQbE5LhYPFuaEVFzMAGqkB4MgNCAdyADiyA6flAvQAaOQHgCNBABwZAuGgLtwwzPsti0ZHK6aAG5rgtGR4FxSG1gy6ddozog0Wp03DBwA3VONUdpqGZadxWHaAo7LTOCq7MCzrUnZAo7IDHJUd4KjsCAc7XoBzKzo9GqqhcKPsglaNUODYTKsG3TptGtEHi9OmEeBEIwzVOJ35aRoe-mkcnvoBjo79NA7LbljWqew0DctO47DsNA7LDnC04-mzrARfuwQPyJwuu6RVI8FJWtKqAbcuadNIcKyQtGlkB-CGalzKDmhUdoCjsiMclB3g8CHfsKzTUz5Nw8d8GofP-TQOH_QBjnY8fZaV6Hujz7IF3Cw7rRoFTtKKVk3x1u9ffvgvAAD__zV_Boc= # INTERSECT ALL and INTERSECT with MergeJoiner. query T -SELECT url FROM [EXPLAIN (DISTSQL) (SELECT y FROM xyz ORDER BY y) INTERSECT ALL (SELECT y FROM xyz ORDER BY y)] +EXPLAIN (DISTSQL) (SELECT y FROM xyz ORDER BY y) INTERSECT ALL (SELECT y FROM xyz ORDER BY y) ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJzElkFv2jAYhu_7FdZ3aiWjYCfQEmkS3co0JAYdcNhU5ZASryBRktlBalrx3ydCtY4A_uJ59W6l8WO__vJIeZ9B_VxCCJPeoPdxStZyST6NR1_Ibe_bzeCqPyRn1_3JdPJ1cE7OXtYUuxWPxRMZja97Y_LhOynOSX847Y0n2wVXgwGyOAIKqzQRw_hBKAhvgQEFDhR8oBAAhRZEFDKZzoRSqdwueS6BfvIIYZPCYpWt8-2_IwqzVAoInyFf5EsBIUzju6UYizgR0msChUTk8WJZHvNYPHUzuXiIZQEUJlm8UiFpeNuTR-s8JF0O0YZCus5ftn_d9a4g81jN9_frMog2EQWVx_cCQrahfxez5TQmPxnzdZ_1KpWJkCLZ2ynaktiSI3f9HKv5ROSjzGOVNzItMhHuuwMUluJHftZl5-_l4n5e_vX76qxy9ddr-RbXOpJ5mDbSzGOt6gCOnh3snc3qv3lW4817vOH5b6KoQdC246D8ZFAHkjJHkvL68-d15u83vOBNRDEIeuE4KD8Z1IEo3JEofv35-3XmHzTKb86_F8Ug6KXjoPxkUAei-I5ECerPP6gz_1bjTTQxiNlxGpOfjOlAkuA_dKMjicZCZelKiVrNp7m9k0juxW5GKl3LmbiR6aw8ZvdzVHLlVzwRKt895bsf_VX5qJx7fbhtA3dsYGaVm7X0NDMYGTOD2zZwxwZmVrkrIzugeZVu_kn7etjXwmx_Zs0qHdgIrocRwfUwIrgexgRHaETwlo3gehgRXA8jguthTHCERgRv2wh-YaOoHkYU1cOIonoYUxShEUUvbRTVw4iiehhRVA9jiiI0omjHRlFm1RMQGpEUoRFLERrTFMOxrmBXFuzagl1dsOwLdoWBWTUGdlAZjGzV05itehqzVU-jtiI4ZqtJWTqcuklbMqUxW436kjGO2XpQHrS2Rpt3vwIAAP__qX57Jw== +distribution: full +vectorized: true +· +• intersect all +│ +├── • scan +│ missing stats +│ table: xyz@primary +│ spans: FULL SCAN +│ +└── • scan + missing stats + table: xyz@primary + spans: FULL SCAN +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJzElkFv2jAYhu_7FdZ3aiWjYCfQEmkS3co0JAYdcNg05ZASryDRJIuD1LTiv08J0zoC-Ivn4d1K48d-_eWR8r6A_LEGHwZf7kY3wzG5uB3O5rPPo0tyMRuMBu_npCAfppNP5Kl4JpPp7WBK3n0lxSUZjueD6axccDMaIYuBQpxEYhw-Cgn-N2BAgQMFFyh4QKEDAYU0SxZCyiQrl7xUwDB6Ar9NYRWnm7z8d0BhkWQC_BfIV_lagA_z8H4tpiKMROa0gUIk8nC1ro55Kp77abZ6DLMCKMzSMJY-aTnlyZNN7pM-h2BLIdnkv7Z_3fW-IMtQLvf36zMItgEFmYcPAny2pX8Xs2M1Jj8Z83WfTZxkkchEtLdTUJLYkiN3_RjK5Uzkk9RhtTcyL1Lh76sDFNbie37RZ5dvs9XDsvrr99VZ7eqv13INrnUk8zhpJanDOvUBHD3b2zubNX_zrMGbd3jLcc-iqEbQruWg_GRQC5IyS5Ly5vPnTebvthzvLKJoBL2yHJSfDGpBFG5JFLf5_N0m8_da1Tfn34uiEfTaclB-MqgFUVxLonjN5-81mX-ndRZNNGL2rMbkJ2NakMT7D93oSKKpkGkSS9Go-bTLO4noQexmJJNNthB3WbKojtn9nFRc9RWPhMx3T_nuxzCuHlVzbw53TeCeCcyMcrOOmmYaI2N6cNcE7pnAzCh3bWQHNK_T7T9pVw27Spjtz6xdpz0TwdUwIrgaRgRXw5jgCI0I3jERXA0jgqthRHA1jAmO0IjgXRPBr0wUVcOIomoYUVQNY4oiNKLotYmiahhRVA0jiqphTFGERhTtmSjKjHoCQiOSIjRiKUJjmmI41hXMyoJZWzCrC4Z9wawwMKPGwA4qg5atahqzVU1jtqpp1FYEx2zVKUuHU9dpS7o0ZqtWX9LGMVsPyoPS1mD75mcAAAD__yJddcg= query T -SELECT url FROM [EXPLAIN (DISTSQL) (SELECT y FROM xyz ORDER BY y) INTERSECT (SELECT y FROM xyz ORDER BY y)] +EXPLAIN (DISTSQL) (SELECT y FROM xyz ORDER BY y) INTERSECT (SELECT y FROM xyz ORDER BY y) ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJzEmNFu4kYUhu_7FNa5SiQjmBkbiKVK2TZURaJhC1y0WnHhxdMEicWubaSwUd69wlR1sOPze2I7vQvgz_P7ZL7DGZ4p-XtHHi0ns8nPK-sQ76xfFvPfrC-TPz7PPk3vrau76XK1_H12bV39e83xfMXT8bs1X9xNFtZPf1rHa2t6v5oslqcL-AvXZNM-DPS9_00n5H0hQTZJskmRTQ7Z5NLapigONzpJwvh0yXMGTIMn8gY2bffRIT29vbZpE8aavGdKt-lOk0cr_-tOL7Qf6Lg_IJsCnfrbXbbM0_H7bRRvv_nxkWxaRv4-8axe_7Ty_JB61q2k9YtN4SHNb5-k_oMmT7zY74vgthZBmkS42ybpdr9J-6JQg1tRWCBnvh6tRz95fOP6PIR6Xwi31RBOZYj8Pod9GAc61sHFnbK7VMaUqFZ5BLerCKhSeYRhgwj2u1L-6iePS53Oo74qVGp1jLT3yv9PsxnZtNN_pVe34vrHePvwmP313zavfqxRu5W9D3th1FdusQBvrj2-WFvUt1zUsLwve31l3GoMQgxbDCFNQuSeiw6bTe0Qww6bjWjPdFSrqmbTYgRUqapmYxahcbMRH9RsZH3XZB3XVK_vGAtvEGLUYghpEiJ3TXYofO0Qow6Fl-3ZhmpVJXyLEVClqoQ3i9BYePlBwqv6rqk6rjm9bN43E94gxLjFENIkRO6a6lD42iHGHQqv2rMN1apK-BYjoEpVCW8WobHw6oOEd-q75tRxze0Z624Q4aa1CNIkQu6Z06HstUPcdCi7055pqFZVsrcYAVWqSnazCI1ld_6H3w7eSLTQSRTuE13rl4HB6Zl08KDPNUrCQ7zRn-Nwky1zfjnPuOyNQCfp-VN1fjHdnz86BXwNCxaWPCyLsHgNOxewMIOFbETfNKHlsAmtFE8rlnabwKLR0nLQiB41oRXYLA67TcH_yzWAZREesjB46BGv5pDXa8zSQvD0DU8PQF8odRUTtwGN5EY4sBvgSG-AI79FqaWaCA5oZDjAkeIIB9sd4EhyUWqsl1sW4aUWw-El0QXfY9Cj801GjIFufJsRI4CXGo2RrTwNbQU4spXHoa08Dm0tNVkjW3ka2srj0FaAoy3L49BW_gtGCjBE8WNrAS_ZKvnBFTy65DuNdMHcy3ca6QC81GmM5maehoMzwNHkzONwdOZxZKssdVkTWwGNbAU4shXhaMvyOLJV8l8wcgxwfpIt4GVb-VEWPTrfaRQ4pSpwQAZztOKHGlB3QCNbEQ5sBTiyFeDwpMsflNFRFxzxmy0OD7sAR6dd8BsB2jX8F4xCpeNH2QJeslXxs2zx0dcvP_wTAAD__1qkDGw= +distribution: full +vectorized: true +· +• intersect +│ +├── • scan +│ missing stats +│ table: xyz@primary +│ spans: FULL SCAN +│ +└── • scan + missing stats + table: xyz@primary + spans: FULL SCAN +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJzEmMFu6kYUhvd9CuusEsnIzIwNxFKl3DZURaLhFli0qrLwxdMEiYtd20ghUd69wkh1Ysfn98R2ugvgz_P7ZL7DGZ4p_WdHPk3_-Dr_Mru1Lm5mq_Xq9_mldbGazqc_r62j9cty8Zv1eHyyFsub6dL66U_reGnNbtfT5ep0AX8h2bSPQn0bfNcp-X-RIJsk2aTIJpds8ujOpjiJNjpNo-R0yXMOzMJH8oc2bffxITu9fWfTJko0-c-UbbOdJp_WwbedXuog1IkzJJtCnQXbXb7M4_HpOk6234PkSDat4mCf-tbAOa28OGS-dS3p7sWm6JAVt0-z4F6TL17sj0XwOosgTSLcbNNsu99kjijV4FqUFiiYb0frIUgf3rm-CKE-FsLrNIRbG6K4z2EfJaFOdPjmTvldamNKVKsigtdXBFSpIsKoRQT7Qyl_DdKHlc4WsaNKlVofY-2_0v_LfE427fTf2cW1uPwx2d4_5H_9t83rH2vcbWVvo0EUO8orF-DdtSdv1hbNLRcNLHfkwFHGrcYgxKjDENIkROG56LHZNA4x6rHZiO5MR7WqazYdRkCVqms2ZhFaNxvxSc1GNndNNnFNDRzXWHiDEOMOQ0iTEIVrskfhG4cY9yi87M42VKs64TuMgCpVJ7xZhNbCy08SXjV3TTVxzR3k876Z8AYhJh2GkCYhCtdUj8I3DjHpUXjVnW2oVnXCdxgBVapOeLMIrYVXnyS829w1t4lr3sBYd4MIV51FkCYRCs_cHmVvHOKqR9nd7kxDtaqTvcMIqFJ1sptFaC27-z_8dvBOoqVO42if6ka_DAxPz6TDe32uURodko3-mkSbfJnzy0XO5W-EOs3On6rzi9n-_NEp4GtYsLDkYVmGxWvYfQMLM1jIVvRVG1qO2tBK8bRiaa8NLFotLYet6HEbWoHN4rLbFPy_PANYluERC4OHHvNqjni9JiwtBE9f8fQQ9IVKVzFxG9BIboQDuwGO9AY48ltUWqqJ4IBGhgMcKY5wsN0BjiQXlcb6dssivNJiOLwiuuB7DHp0vsmICdCNbzNiDPBKozGylaehrQBHtvI4tJXHoa2VJmtkK09DW3kc2gpwtGV5HNrKf8FIAYYofmwt4RVbJT-4gkeXfKeRHph7-U4jXYBXOo3R3MzTcHAGOJqceRyOzjyObJWVLmtiK6CRrQBHtiIcbVkeR7ZK_gtGTgDOT7IlvGorP8qiR-c7jQKnVAUOyGCOVvxQA-oOaGQrwoGtAEe2AhyedPmDMjrqgiN-u8XhYRfg6LQLfiNAu4b_glGodPwoW8Irtip-li0_-t3LD_8GAAD___KEBw0= # INTERSECT ALL and INTERSECT with no overlap. query T -SELECT url FROM [EXPLAIN (DISTSQL) (SELECT x FROM xyz WHERE x < 2) INTERSECT ALL (SELECT x FROM xyz WHERE x >= 2) ORDER BY x] +EXPLAIN (DISTSQL) (SELECT x FROM xyz WHERE x < 2) INTERSECT ALL (SELECT x FROM xyz WHERE x >= 2) ORDER BY x ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJzEmF1v2kgYhe_3V1jvVaI1MjNjvixVSndLVSQWuoC0u-py4cJsgkQxOzYSNMp_rwxNCJjM8WuIc1fAz8z0MM-ZIfcU_z-ngIbtbvv3kbMyc-fjoP-H86X99-fu-07PufrQGY6Gf3avnaufz6x3T6w3352_PrUHbWft_LuqVtXEkddOpzdqD4bpY--7XYjodynTH3xoD5zf_nHWY3JpEU11L_ymYwq-kCCXJLmkyCWfXKrR2KWliSY6jiOTPnK_BTrTNQVVl2aL5SpJ3x67NImMpuCeklky1xTQKPw61wMdTrXxquTSVCfhbL6dZr35frM0s2-h2ZBLw2W4iAOn4qUz91dJ4NwIGj-4FK2S_fBxEt5qCsSDm38JH2fzRBttvNrh_Lv303n2uQRB0OmNmkcT78f6unHuwvjucKDtQveLk5zFPc9HXC4gVSggARKaXCYg_8XF7cdZLSIz1UZPD0YapyR65MT_8FMY3w110l968ijj0Wapg0OByKW5_i-5uhHX78zs9m77rxyZ1ziZDyOTaOPJ2nFSv744fj1HbKcS-TnoiUX0okq09FT1OOOT0zcOpheMbZ1jV3uy4im2-GART_u6_hbicxK6ZESqUEQCZPQq6oty1RclqQ8yf1S_XlR9mX9nyTwbS1U8n-0eWMTTxmq8hXuMhMQlI1KFIhIgo1dxT5brnizJPZD5o3uNou6p_DtL5dlYfmV7LeW5BxbxtLGab-EeIyFxyYhUoYgEyOhV3FPluqdKcg9k_uhes6h7fv6d5efZWLUK2zywhKdt1XoL8xj5iMsFpAoFJEBCr-KdX653fknegcwfvWtd4qfmifEHOl5Gi1jn-hVZTTPT01u9-w7iaGUm-rOJJttpdi_7W277xlTHye5TsXvRWew-Shf4HBbHsHgO-wew5MFCnEU3zqGlOotu2WlpTVzZE1eMxAUPPkqcSzfOoY8S59ItO-1bE6_ZE69Z4bp95rr9uwZ6Nax00w43z3HTDiM3AQ3ctNPITUADN1v2NqyCOsyUKcdOQCM9EQ78BDgSFOHAUJGp1MPgJQje3qlAUpFpl8PJfTB5pl5Yp6CdhscgwNE5aMfhQQhwYJuwd6uog-Az7crSzU5D3QCOdLPjUDeAI93sJ4sAR4vIlCxLN3vJSlCyklOy2csXq2TZONAN4Eg3hKOLp71kJShZmSlZjm6ARrohHOgGcKQbwoFu0n7ASHDASPv9Fegm7SUrQclKTslmtxyrZNk40o1Vsmwc6WYvWQlKVnIu8NlvnXWDZ-NIN9Ydno0j3ewHjAIHjLL_SeRYt_HDLz8CAAD__zsY2Ek= +distribution: full +vectorized: true +· +• sort +│ order: +x +│ +└── • intersect all + │ + ├── • filter + │ │ filter: x < 2 + │ │ + │ └── • scan + │ missing stats + │ table: xyz@primary + │ spans: FULL SCAN + │ + └── • filter + │ filter: x >= 2 + │ + └── • scan + missing stats + table: xyz@primary + spans: FULL SCAN +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJzEmF2P2kYYhe_7K6z3alc1MjNjvixF2rQhChKFFJDaquXCgekuEsHUNhJktf-9MmSXtU3m-DWsuQsfz8zkeJ4zwz5S9N-SPOr--bn_vjewbj70xpPx7_1b62bc7Xd_nVhb6-No-Ju13X2z_vjUHXWtrfXPpl5XM0veWr3BpDsaJ1973-9DRL9LmOHoQ3dk_fKXtSWbVsFcD_yvOiLvbxJkkySbFNnkkk0Nmtq0DoOZjqIgTL7yuAd68y15dZsWq_UmTt6e2jQLQk3eI8WLeKnJo4n_ZalH2p_r0KmTTXMd-4vlfprt7tvdOlx89cMd2TRe-6vIs2pOMvNwE3vWnaDpk03BJj4OH8X-vSZPPNnFl_BxsYx1qEOnkZ7_8H4yzzEWz_N6g0k7M_FxrC8768GPHtID7Rd6XJzkLO51PuJyAalSAQmQ0OwyAbk_XNxxnM0qCOc61PPUSNOERF858T_85EcPYx0P147MZDzZrbWX9odsWup_45s7cfsuXNw_7P9VIPMGJ_NxEMY6dGQjm9TPPxy_WSC2U4l8H_TEIgZBLVg7qp7N-OT0rdT0grGtC-xqR9YcxRYfLOJlXzevIT4noUtGpEpFJEBGb6K-qFZ9UZH6IPNn9Ztl1ZfFd5YssrFUzXHZ7oFFvGys1jXcYyQkLhmRKhWRABm9iXuyWvdkRe6BzJ_da5V1TxXfWarIxnJr-2spzz2wiJeN1b6Ge4yExCUjUqUiEiCjN3FPVeueqsg9kPmze-2y7rnFd5ZbZGM1amzzwBJetlXnGuYx8hGXC0iVCkiAhN7EO7da79yKvAOZP3vXucRPzRPjj3S0DlaRLvQrsp5kpuf3-vAMomATzvTnMJjtpzm8HO65_RtzHcWHT8XhRW91-ChZ4GtYZGHxGnZTsOTBQpxFt86hpTqL7phpaUxcmRNXjMQFD84kzqVb59CZxLl0x0y7xsQb5sQbRrhpnrlpftZAr5aRbpvh9jlummHkJqCBm2YauQlo4GbH3IZ1UIe5MuXYCWikJ8KBnwBHgiIcGCpylZoOXoLgzZ0KJBW5dklP7oLJc_XCOgXNNDwGAY7OQTMOD0KAA9uEuVtFEwSfa1eWbmYa6gZwpJsZh7oBHOlmPlkEOFpErmRZuplLVoKSlZySzV--WCXLxoFuAEe6IRxdPM0lK0HJylzJcnQDNNIN4UA3gCPdEA50k-YDRoIDRprvr0A3aS5ZCUpWcko2v-VYJcvGkW6skmXjSDdzyUpQspJzgc8_ddYNno0j3Vh3eDaOdDMfMAocMMr8J5GsbtOnn_4PAAD__ygb0uo= query T -SELECT url FROM [EXPLAIN (DISTSQL) (SELECT x FROM xyz WHERE x < 2) INTERSECT (SELECT x FROM xyz WHERE x >= 2) ORDER BY x] +EXPLAIN (DISTSQL) (SELECT x FROM xyz WHERE x < 2) INTERSECT (SELECT x FROM xyz WHERE x >= 2) ORDER BY x ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJy82Ftv4kYbB_D791NYc5XoNTJzMAdLK2XbsFokCltAaqstFyxMEyQWU9tIsFG-ewVs4nDw8_cwQ-4C-O_nEPsn8BNL_52ziA1andavQ2-VzL1P_d5v3tfWn186H9td7-a-PRgOfu_cejc_j1nvj1hvfnh_fG71W97a-3tVrcqJJ269dnfY6g-2h6HD9Yft8b3-favv_fKXtx4xny3iqe6Ov-uURV8ZZz4TzGeS-Uwxn4Vs5LNlEk90msbJ9pCnXaA9XbOo6rPZYrnKtm-PfDaJE82iJ5bNsrlmERuOv811X4-nOgmqzGdTnY1n812Z9ebH3TKZfR8nG-azwXK8SCOvEmwr91ZZ5N1xNnr2WbzK8tOn2fhBs4g_--Vb-DSbZzrRSRAe1t-_v62T7yWKonZ32CgsLEwKv52duxteXjQ8B9NP8PDKpPD9LM1mi0kWiKPJTybLM9823uM4fTxzfN5EeFkTodMmaoVN5OdZLeJkqhM9PTjT7iyFbUq0q7yF-rVaQJvKW2hYtOBf1OXncfo40FlvGaijTQ03Sx29QfBjp8N8Ntf_ZDd3_PZDMnt43P1V4v5qmlxhgzjJdBKok639vxivaom9nVvJz7Oe6aIbV-JlEFaPl3y-_qGe3ACxEoYFohJIY8JBE6-K1VwTbjK9y_HlReNzML8x4qBw7ie_IuKlm6hdEXHuTlC0qyLEHbaANlWEuFkL1ojzd0IcXGEviJ9srTTiojwjoowishIoY0RBE6-K1F0jajA9dzm-vGh8DuY3RhQUzv0SV0S0dBP1KyIq3AmGdlWEqMMW0KaKEDVrwRpR8U6IgivsBdGTrZVGVJZnRJZRRFV2P_nNEAVNvCrScI2owfTc5fjyovE5mN8YUVA490teEdHSTTSuiKh0JxjaVRGiDltAmypC1KwFa0TlOyEKrrAXRE-2VhpRVZ4RVUaRsGJMKGjh1ZCma0INZufuhpcXDc_B9MaAgsK5XeqKgJZuonlFQJU7vdCuigB12ALaVBGgZi1YA6reCVBwhb0AerK1i57HninQ1-kyXqS61KPW6nZpevqg9_-ENF4lE_0liSe7MvuXvV1u98ZUp9n-U75_0V7sP9o2-DbMyXBIhwUZlnRYkmFFh9VxmL8N1w7C3CzM6zZpYZWWVmkF0iGZtgrzhk1aWKWlVVqBdI28TEG4bhAWx-EGGW7SN0iTRqFK981pU0KECq0KFyBOu8JrIE7LwgEt_OQmO4wDEzl9uQGaQBrZBOIIJxBHOoE44omf3GomPoE0AgrEkVAgjogCcWQUp53hTRCnpTmKnzjFaWtEFXyJAN9fAFWCtkYAawRtjQDWCNoaAawRtDUCff-ysgakkTUgjqwBcWQNiCNrhJU1II2sAXFkDYgja0AcWSNoawSwRtDWCGCNoK2RwBppZ42krZHAGgl-LwFrJG2NBNZI2hoJrJFW1oA0sgbEkTUgjqwBcWSNtLIGpJE1II6sAXFkDYgjayRtjQTWSNoaCayRtDUKWKPsrFG0NQpYo2hrFLBGgacz6PEMbY0C1igra0AaPt-xswbE4RMeO2uUlTUgjawBcWQNiCNrQBxZo2hrFLBG0dYoYI2irQmBNaGhNaPn__0XAAD__6XUZuQ= +distribution: full +vectorized: true +· +• sort +│ order: +x +│ +└── • intersect + │ + ├── • filter + │ │ filter: x < 2 + │ │ + │ └── • scan + │ missing stats + │ table: xyz@primary + │ spans: FULL SCAN + │ + └── • filter + │ filter: x >= 2 + │ + └── • scan + missing stats + table: xyz@primary + spans: FULL SCAN +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJy82Ftv4kYYBuD7_gprrhLVyMzBBCytlG3DapEobAGprdpcsDBNkFhMbSPBRvnvFbCJw8Hf62HGuQvg198h9iPwE0v_m7OItf_80v3Y6XlXd53haPh799q7Gra77V9H3tr7NOj_5q03370_PrcHbW_t_bOq1-XEE9depzdqD4bbw9Dh-sP2-P7grj3wfvnLWzOfLeKp7o2_6ZRFfzPOfCaYzyTzmWI-C9m9z5ZJPNFpGifbQ552gc50zaK6z2aL5Srbvn3vs0mcaBY9sWyWzTWL2Gj8da4HejzVSVBnPpvqbDyb78qsN99vl8ns2zjZMJ8Nl-NFGnm1YFu5v8oi75az-2efxassP32ajR80i_izX76FT7N5phOdBOFh_f372zr5WqIo6vRGzcLCwqTw29m5u-HlRcNzMP0ED69MCt_N0my2mGSBOJr8ZLI883XjPY7TxzPH502ElzUROm2iUdhEfp7VIk6mOtHTgzPtzlLYpkS7ylu4qaoFtKm8haZFC_5FXX4ep49DnfWXgTra1Giz1NEbAz92u8xnc_1vdnXLrz8ks4fH3V8l7q-WyRU2jJNMJ4E62drPxXjVS-zt3Ep-nPVMF724Fi-DsH685PP1D_XkBoiVMCwQtUAaEw6aeFWs4Zpwk-ldji8vGp-D-Y0RB4VzP3mFiJduolEh4tydoGhXRYg7bAFtqghxsxasEefvhDi4wl4QP9laacRFeUZEGUVkLVDGiIImXhW5cY2owfTc5fjyovE5mN8YUVA490tUiGjpJm4qRFS4EwztqghRhy2gTRUhataCNaLinRAFV9gLoidbK42oLM-ILKOIqu1-8pshCpp4VaTpGlGD6bnL8eVF43MwvzGioHDul6wQ0dJNNCtEVLoTDO2qCFGHLaBNFSFq1oI1ovKdEAVX2AuiJ1srjagqz4gqo0hYMyYUtPBqSMs1oQazc3fDy4uG52B6Y0BB4dwuVSGgpZtoVQiocqcX2lURoA5bQJsqAtSsBWtA1TsBCq6wF0BPtnbR89gzBQY6XcaLVJd61FrfLk1PH_T-n5DGq2SivyTxZFdm_7K_y-3emOo023_K9y86i_1H2wbfhjkZDumwIMOSDksyrOiwOg7zt-HGQZibhfmNTVpYpaVVWoF0SKatwrxpkxZWaWmVViDdIC9TEL4xCIvjcJMMt-gbpEWjUKf75rQpIUKFVoULEKdd4Q0Qp2XhgBZ-cpMdxoGJnL7cAE0gjWwCcYQTiCOdQBzxxE9uNROfQBoBBeJIKBBHRIE4MorTzvAWiNPSHMVPnOK0NaIOvkSA7y-AKkFbI4A1grZGAGsEbY0A1gjaGoG-f1lZA9LIGhBH1oA4sgbEkTXCyhqQRtaAOLIGxJE1II6sEbQ1AlgjaGsEsEbQ1khgjbSzRtLWSGCNBL-XgDWStkYCayRtjQTWSCtrQBpZA-LIGhBH1oA4skZaWQPSyBoQR9aAOLIGxJE1krZGAmskbY0E1kjaGgWsUXbWKNoaBaxRtDUKWKPA0xn0eIa2RgFrlJU1IA2f79hZA-LwCY-dNcrKGpBG1oA4sgbEkTUgjqxRtDUKWKNoaxSwRtHWhMCa0NCa--ef_g8AAP__HWJhhQ== # INTERSECT ALL and INTERSECT with some overlap. query T -SELECT url FROM [EXPLAIN (DISTSQL) (SELECT y FROM xyz WHERE x < 3) INTERSECT ALL (SELECT y FROM xyz WHERE x >= 1) ORDER BY y] +EXPLAIN (DISTSQL) (SELECT y FROM xyz WHERE x < 3) INTERSECT ALL (SELECT y FROM xyz WHERE x >= 1) ORDER BY y ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJzEmO9v2jgcxt_fX2F9X7W6oGA7_Io0id2NaUgc7ADp7rTjRQa-FokRzglSWdX_fQJWaBLqJw40vFtpPrb3xJ_Hpo8U_b8gn0adXuf3MVvrBfs4HPzBvnT-_tx73-2zmw_d0Xj0Z--W3fx8ZrN_4mHznf31qTPssAf277palVMmb1m3P-4MR9vH3vd6EFHvGL9lg-GHzpD99g_bTMihZThT_eCbisj_QpwcEuSQJIc8cqhGE4dWOpyqKAr19pHHHdCdPZBfdWi-XK3j7ccTh6ahVuQ_UjyPF4p8GgdfF2qogpnSbpUcmqk4mC920zxsvrdXev4t0BtyaLQKlpHPKu525sE69lmbO21BkyeHwnV8nCGKgztFPn9y8q_i43wRK620W0suYf_5dqpjNL7vd_vj5mEV6SUcR_26YfdBdJ8css1p8nRcprBZ5suw-EXTkoXS4iCuKZOXTct7dZnHcdbLUM-UVrPESJMtiR458X_9FET3IxUPVq5IBT7erJSfVIscWqj_4ps2v32n53f3u38dX8Cr6dds0h-FOlbaFbV0Ur--On49R2ynEvk56IlF9MNKuHJlNZ3xyekbiem5xR7PscVdUXFlkUoA6zhs8vp1K8EmrgvnJQvlxUFgb1wKvNxS4CWVAkj_uRTqRUtB5N9mIs8ukxXXK2IlWMdhlzWua6VFXPzCeclCeXEQ2BtbKcq1UpRkJUj_2cpGUStl_m0m8-wyr7K74VpbCdZx2GXN61ppERe_cF6yUF4cBPbGVspyrZQlWQnSf7ayWdRKL_828_LsslqliJNgFYc91rqukxZh8YumJQulxUFcb2ykV66RXklGgvSfjWxd4ivtifGHKlqFy0jl-rZa3WamZndq_w6icK2n6rMOp7tp9j8Odtzug5mK4v1v-f6H7nL_q-0CX8I8DfOXsJeAhR3M-Vl04xxayLPolpkWxsSlOXFpkTi3g1OJ29KNc-hU4rZ0y0x7xsRr5sRrRrhunrluftdAr4aRbprh5jlummHkJqCBm2YauQlo4GbL3IZVUIeZMrWxE9BIT4QDPwGOBEU4MJRnKjUZvADBmzsVSMoz7ZKc3AOTZ-rF6hQ00_AYBDg6B804PAgBDmzj5m7ldRB8pl2tdDPTUDeAI93MONQN4Eg388nCwdHCMyVrpZu5ZAUoWWFTstnLl1XJWuNAN4Aj3RCOLp7mkhWgZEWmZG10AzTSDeFAN4Aj3RAOdBPmA0aAA0aY769AN2EuWQFKVtiUbHbLWZWsNY50sypZaxzpZi5ZAUpW2Fzgs2_d6gZvjSPdrO7w1jjSzXzASHDASPOfRNK6TZ5--REAAP__Cbn3AA== +distribution: full +vectorized: true +· +• sort +│ order: +y +│ +└── • intersect all + │ + ├── • filter + │ │ filter: x < 3 + │ │ + │ └── • scan + │ missing stats + │ table: xyz@primary + │ spans: FULL SCAN + │ + └── • filter + │ filter: x >= 1 + │ + └── • scan + missing stats + table: xyz@primary + spans: FULL SCAN +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJzEmF1v4kYYhe_7K0bvVaIamZkxX5ZWYttltUgUtoDUVi0XXpgmSCx2bSOFRPnvlWEDsU3meAwxd8vH43n3eJ4zJk8U_bcil3p_fh187A_Zzaf-ZDr5fXDLbia9Qe_XKduyz-PRb-xh-8j--NIb99gD-2dTr8s5k7esP5z2xpPkax8HA4ioD4zfstH4U2_MfvmLbcmitb9QQ--7isj9mzhZJMgiSRY5ZFGDZhYFoT9XUeSHyVeedkB_8UBu3aLlOtjEydszi-Z-qMh9ongZrxS5NPW-rdRYeQsV2nWyaKFib7naLfOwfewG4fK7FyYTTAJvHbmsZicrjzaxy7rc6gqaPVvkb-LjClHs3Sly-bNVfIrPy1WsQhXajfQI-_eTpY7JuK7bH07bhymyIxyv-m3L7r3oPn3JLqfZ83FMYTLm67D4RdOSpdLiIK45k5dNy3lzzON1Nms_XKhQLVJXmiUk-sqJ_-sXL7qfqHgU2CIT-HQbKDdtFlm0Uv_GN11--yFc3t3v_nW8AW-m3zBJf-KHsQpt0cgm9fOb128WiO1UIj8uemKIoV_zA1vWsxmfXL6VWp4b7PECW9wWNVuWqQQwx2GTN69bCSZxXTgvWSovDgJ751Lg1ZYCr6gUQPovpdAsWwqi-DYTRXaZrNlOGSvBHIdd1rqulQZx8QvnJUvlxUFg72ylqNZKUZGVIP0XK1tlrZTFt5ksssuc2u4J19hKMMdhl7Wva6VBXPzCeclSeXEQ2DtbKau1UlZkJUj_xcp2WSud4tvMKbLLGrUyToIpDnusc10nDcLiF01LlkqLg7je2UinWiOdiowE6b8Y2bnET9oT1x-rKPDXkSr0a7WeZKYWd2p_DyJ_E87V19Cf75bZvxztuN0bCxXF-0_5_kV_vf8oGfA1zLMwfw07KViYwZyfRbfOoYU8i-7oaaFNXOoTlwaJczM4k7gp3TqHziRuSnf0tKNNvKFPvKGFm_qVm_p7DfRqaem2Hm6f46YeRm4CGripp5GbgAZudvRtWAd1mCtTEzsBjfREOPAT4EhQhANDea5S08ELELy-U4GkPNcu6cUdsHiuXoxOQT0Nj0GAo3NQj8ODEODANq7vVt4Ewefa1Ug3PQ11AzjSTY9D3QCOdNOfLBwcLTxXska66UtWgJIVJiWbf_gyKlljHOgGcKQbwtGDp75kBShZkStZE90AjXRDONAN4Eg3hAPdhP6AEeCAEfrnV6Cb0JesACUrTEo2v-WMStYYR7oZlawxjnTTl6wAJStMHuDzd93oCd4YR7oZPcMb40g3_QEjwQEj9X8Syeo2e_7p_wAAAP__PE7xoQ== query T -SELECT url FROM [EXPLAIN (DISTSQL) (SELECT y FROM xyz WHERE x < 3) INTERSECT (SELECT y FROM xyz WHERE x >= 1) ORDER BY y] +EXPLAIN (DISTSQL) (SELECT y FROM xyz WHERE x < 3) INTERSECT (SELECT y FROM xyz WHERE x >= 1) ORDER BY y ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJy82F1v2lYcBvD7fQrrXCWakTkv5sVSJbqFqkgMOkDapo4LF84SJIqZbaTQKN-9AhIcXvx_bB87dw3xw3n61PxE_cSi_5fMY-Nuv_v7xNqES-vTaPiH9bX795f-x97AurnrjSfjP_u31s3LNdvDFY_bH9Zfn7ujrvVo_bup1-XMkrdWbzDpjsa7y9Dl-oPFb63h6K47sn77x9pOmc1WwVwP_O86Yt5XxpnNBLOZZDZTzGYum9psHQYzHUVBuLvkaR_ozR-ZV7fZYrXexLuXpzabBaFm3hOLF_FSM49N_G9LPdL-XIdOndlsrmN_sdwf87j90VmHi-9-uGU2G6_9VeRZNWd38nATe1aH2x3Bps82CzZxckIU-_eaefzZzt7i02IZ61CHjnta4fD67qhkGs_zeoNJ69givYLIU-HtELzUJWShJTiYYmbJ7EuoPBXuFlG8WM1iR5zN0OFnBySZb1vrwY8erlyflHCLlXBLLdFILZG8z2YVhHMd6vnJO-3fJbWmRFslFZpVVUBLJRVaBhXsQi0_-9HDWMfDtaPOlpps19p7w-PHfp_ZbKn_i286_PZDuLh_2P8p-bCl_rXaee6wcRDGOnTUxWq_pptWz7DbtUle3vVKi0FQC9aOWz8f-fr5p6jyHKJlAM0RNUcWwR30OJLWqA73PFOUvIUstAUHYxjwDioksvIKec9colEh77w8W9FWabyXWAEtlcZ7vgrGvPN34h3cYa-8X6yWmXeR3RSRhRRZc1QRXkGPIynN6njNMQUveQtZaAsOxjDgFVRIZBMV8pq5RLNCXkV5tqGt0ngtsQJaKo3XfBWMeRXvxCu4w155vVgtM68yuykyCymqtn96kJtX0ONISqs6XnNMwUveQhbagoMxDHgFFRLZZIW8Zi7RqpBXWZ5taKs0XkusgJZK4zVfBWNe5TvxCu6wV14vVsvMq8puispCilsrgitocQSlXR2uOYbgpS4hCy3BwRQGtIIKiWqqQlozl2hXSKsqzzW0VRqtJVZAS6XRmq-CMa3qnWgFd9grrRerFXrue-WAkY7WwSrSmR7p1nej6fm9PvwjRMEmnOkvYTDbH3P4cbjP7V-Y6yg-_JYffuitDr_aFXwb5mTYpcOCDEs6LMmwosPqPMzfhhsnYZ4vzJsmaWGUlkZpBdIumTYK85ZJWhilpVFagXSDvE1BuJkjLM7DLTLcpj8gbRqFOt2b06a4CBVaFS5AnHaFN0CcloUDWvjFh-w0Dkzk9O0GaAJpZBOII5xAHOkE4ognfvFRy-MTSCOgQBwJBeKIKBBHRnHaGd4GcVqas_iFU5y2RtTBlwjw_QVQJWhrBLBG0NYIYI2grRHAGkFbI9D3LyNrQBpZA-LIGhBH1oA4skYYWQPSyBoQR9aAOLIGxJE1grZGAGsEbY0A1gjaGgmskWbWSNoaCayR4P9LwBpJWyOBNZK2RgJrpJE1II2sAXFkDYgja0AcWSONrAFpZA2II2tAHFkD4sgaSVsjgTWStkYCayRtjQLWKDNrFG2NAtYo2hoFrFHg6Qx6PENbo4A1ysgakIbPd8ysAXH4hMfMGmVkDUgja0AcWQPiyBoQR9Yo2hoFrFG0NQpYo2hrXGCNm9Oa6fMvPwMAAP__tpGFmw== +distribution: full +vectorized: true +· +• sort +│ order: +y +│ +└── • intersect + │ + ├── • filter + │ │ filter: x < 3 + │ │ + │ └── • scan + │ missing stats + │ table: xyz@primary + │ spans: FULL SCAN + │ + └── • filter + │ filter: x >= 1 + │ + └── • scan + missing stats + table: xyz@primary + spans: FULL SCAN +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJy82F1v2lYcBvD7fQrrXCWakTkv5sVSJbqFqkgMOkDapi0XFM4SJIqZbaTQKN99AhocXvx_jn3s3DWEh_P0qf0T9TOL_1uygHX__NL_2Bs4N3e98WT8e__WuRl3-91fJ87W-TQa_uY8bb87f3zujrrOk_PPpl6XM0feOr3BpDsa796G3q4_OPzWGY7uuiPnl7-cLXPZKpzrwfSbjlnwN-PMZYK5TDKXKeYyn927bB2FMx3HYbR7y_M-0Js_saDussVqvUl2L9-7bBZGmgXPLFkkS80CNpl-XeqRns515NWZy-Y6mS6W-2Oett8762jxbRrtGozX01UcODVvd_JwkwROh7sdwe5fXBZukvSEOJk-aBbwF9e8xafFMtGRjjz_tMLh9d1R6TJBEPQGk9axRXYFkafC2yF4qUvIQktwMMXMkeZLqDwV7hZxsljNEk-czdDhZwekma9b53EaP155f1rCL1bCL7VEI7NE-jmbVRjNdaTnJ5-0_5TMmhJtlVZoVlUBLZVWaFlUcAu1_DyNH8c6Ga49dbbUZLvWwRsdP_b7zGVL_W9y0-G3H6LFw-P-T-nNlvnXaue5wsZhlOjIUxer_ZxtWt1gt2uT_PjUKy0GYS1ce379fOTr55-iynOIZgCaJ2qeLII76HEkrVEd7nmmKHkLWWgLDsaw4B1USGXlFfJuXKJRIe-8PFvRVlm8l1gBLZXFe74K1rzzd-IdXGGvvF-sZsy7MDdFmJAia54qwivocSSlWR2vOabgJW8hC23BwRgWvIIKqWyiQl6NSzQr5FWUZxvaKovXEiugpbJ4zVfBmlfxTryCK-yV14vVjHmV5qZIE1JUbf_0IDevoMeRlFZ1vOaYgpe8hSy0BQdjWPAKKqSyyQp5NS7RqpBXWZ5taKssXkusgJbK4jVfBWte5TvxCq6wV14vVjPmVZmbokxI8WtFcAUtjqC0q8M1xxC81CVkoSU4mMKCVlAhVU1VSKtxiXaFtKryXENbZdFaYgW0VBat-SpY06reiVZwhb3SerFaoee-Vw4Y6XgdrmJt9Ei3vhtNzx_04R8hDjfRTH-Jwtn-mMOPw31u_8Jcx8nht_zwQ291-NWu4NswJ8M-HRZkWNJhSYYVHVbnYf423DgJ83xh3rRJC6u0tEorkPbJtFWYt2zSwiotrdIKpBvkZQrCzRxhcR5ukeE2fYO0aRTqdG9Om-IjVGhVuABx2hXeAHFaFg5o4Rc32WkcmMjpyw3QBNLIJhBHOIE40gnEEU_84lbL4xNII6BAHAkF4ogoEEdGcdoZ3gZxWpqz-IVTnLZG1MGXCPD9BVAlaGsEsEbQ1ghgjaCtEcAaQVsj0PcvK2tAGlkD4sgaEEfWgDiyRlhZA9LIGhBH1oA4sgbEkTWCtkYAawRtjQDWCNoaCayRdtZI2hoJrJHg_0vAGklbI4E1krZGAmuklTUgjawBcWQNiCNrQBxZI62sAWlkDYgja0AcWQPiyBpJWyOBNZK2RgJrJG2NAtYoO2sUbY0C1ijaGgWsUeDpDHo8Q1ujgDXKyhqQhs937KwBcfiEx84aZWUNSCNrQBxZA-LIGhBH1ijaGgWsUbQ1ClijaGt8YI2f05r7l5_-DwAA__9zsYA8 # INTERSECT ALL and INTERSECT with swapped column orders. query T -SELECT url FROM [EXPLAIN (DISTSQL) SELECT x, y FROM xyz INTERSECT ALL SELECT y, x from xyz] +EXPLAIN (DISTSQL) SELECT x, y FROM xyz INTERSECT ALL SELECT y, x from xyz ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJzEll1v2jwYhs_fXxE9R61kFJwPWiK9EtXGNCQGHeFgUpWDlHgFKU0yO5FIK_77lNCO8TE_8QzZYYiv-LafS-J-BfEjBg_84Xj4YW4UPDY-zaZfjIfht_vx3WhiXH0c-XP_6_jaeFuyJka5XbMuX4zRZD6c-dXvd-Px-5KSGOtfSwIgkKQRm4TPTID3ABQIWEDABgIOEHAhIJDxdMGESHm15LUGRtEavC6BVZIVefVzQGCRcgbeK-SrPGbgwTx8jNmMhRHjZhcIRCwPV3G9zbp8GWR89RzyEgj4WZgIz-iY1c7TIveMgUUGFIINgbTI33bYffixNJahWO5_ckDJwIJgExAQefjEwKMb8ndhXcWwbztrhbX-GHb3qSJJecQ4i_Y-FlQktuTEiT-HYumzfJqZ9GA68zJj3r49QCBm3_OrOvj1_3z1tHx_kF3D7ny2xvlOhJ-knTQzqXt4Eyf3dvb2ps1FoA1EMK2OaV_QW4W4PeW45zeXtmsubdtcq_k4rCbjsDumc0F7FOLeKMc9vz1Wu_ZYbdtjNx-H3WQcTqf-s7qUPQpxb5Xjnt8eu1177LbtcZqPw2kyDrdzQXcUwvYVw57fHKddc5x_2bdORJsxkaWJYI3aVLc6HIue2PayRFrwBbvn6aLeZvs4rbm6DURM5Nu31vZhlNSv6gE0h3s6cF8Hplq5qSunqcKVUTW4pwP3dWCqlfvgyo5o65Du_k7bctiWwnT_zrqHtKMjuBxGBJfDiOByGBMcoRHBXR3B5TAiuBxGBJfDmOAIjQje0xH8RkdROYwoKocRReUwpihCI4re6igqhxFF5TCiqBzGFEVoRNG-jqJUqycgNCIpQiOWIjSmKYZjXUGvLOi1Bb26oNkX9AoD1WoM9KgyKNkqpzFb5TRmq5xGbUVwzFaVsnR86yptSZXGbFXqS8o4ZutReZDaGmz--xkAAP__MRCLvQ== +distribution: full +vectorized: true +· +• intersect all +│ +├── • scan +│ missing stats +│ table: xyz@primary +│ spans: FULL SCAN +│ +└── • scan + missing stats + table: xyz@primary + spans: FULL SCAN +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJzEll2L2kAUhu_7K8K52oUJcfLhroGCS2upYHVrvCiUXGTNVAU3SWcimBX_e0ncrfWjczIdTS9j8sy8M-cB3w2In0vwofftcfDQHxo3H_vBJPg6uDWC3qD3YWKsiVEYn8ajL8a6eDH6w0lvHJS_PwwGb58UxFj__gQIJGnMhtEzE-B_BwoEbCDgAAEXCHgQEsh4OmVCpLz8ZFMB_XgNfovAIslWeflzSGCacgb-BvJFvmTgwyR6WrIxi2LGrRYQiFkeLZbVNuvipZvxxXPECyAQZFEifMO0yp1Hq9w3ujbpUgi3BNJV_rrDfuGnwphHYn64ZJeSrg3hNiQg8mjGwKdb8m9hPcWwrztrhbX_Gna_1CpJecw4iw8WC0sS--TMiT9HYh6wfJRZ9Gg6kyJj_qE8QGDJfuQ3VfDb93wxm789yK5hfz5H43xnwg9TM80s6h3fxNm93YO9aX0RaA0RLNu0nCt6qxC3rRz38ubSZs2lTZtr1x-HXWccjmm5V7RHIe6dctzL22M3a4_dtD1O_XE4dcbhmtWf1bXsUYh7rxz38vY4zdrjNG2PW38cbp1xeOYV3VEI21EMe3lz3GbNcf9n3zoTbcxEliaC1WpTrfJwLJ6x3WWJdMWn7JGn02qb3eOo4qo2EDOR797au4d-Ur2qBlAfbuvAHR2YauWmnpymCldG1eC2DtzRgalW7qMrO6HtY7r1J-3IYUcK08M7ax3Tro7gchgRXA4jgsthTHCERgT3dASXw4jgchgRXA5jgiM0InhbR_A7HUXlMKKoHEYUlcOYogiNKHqvo6gcRhSVw4iichhTFKERRTs6ilKtnoDQiKQIjViK0JimGI51Bb2yoNcW9OqCZl_QKwxUqzHQk8qgZKucxmyV05itchq1FcExW1XK0umtq7QlVRqzVakvKeOYrSflQWpruH33KwAA___e7YZe query T -SELECT url FROM [EXPLAIN (DISTSQL) SELECT x, y FROM xyz INTERSECT SELECT y, x from xyz] +EXPLAIN (DISTSQL) SELECT x, y FROM xyz INTERSECT SELECT y, x from xyz ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJzEmFFv4kYUhd_7K6z7tCsNgpmxgViqlFU3VZFosg08VFrx4IVpgsRiahsJNsp_r4C0Tmx8zwy208dgPub4xudjhidK_15RSJOb8c0vU2-brLxf7-9-977e_Pll_Gl06334PJpMJ3-MP3ovb9kJb396z27_wxvdTm_uJ4fXXy7vhbf77_KMBK3jhbmNvpuUwq8kSZAiQZoE-SQooJmgTRLPTZrGyeEtT0dgtNhR2BO0XG-22eHlmaB5nBgKnyhbZitDIU2jbytzb6KFSbo9ErQwWbRcHZfZ7X9cb5Ll9yjZk6DJJlqnodfpHla-22ahd63EtaTZs6B4m-UrpFn0YCiUz-KyFIFjCimuVWUK5ZLi8zLNlut51pWFSZxbI8e-7b3HKH08j-RR9GVRghai-JVR8o_aruNkYRKzePNhx0-pDKss5panCNpKYTGyPEW_RgpxUdDfovRxYrK7TVcX5jXdb0z4ygafxmMStDJ_ZR-ON_Hx52T58PjvH3YNGDQ75du4E2-6OihO4uzawzdrS3sHSAsHdFWnqy9xkUOOvnMOBxuBHLkCZOs2so7Sb91GsjkPWMytykYNprAYWZWN3FLUtpF8bxsp-yYqmybqTte_xAgOOQbOORyMAHLkNVStG8E6yqB1I6jmumgxtyojNJjCYmRVRnBLUdsI6r2NoO2bqG2a6HeO5wlnIzjkGDrncDACyJHXULduBOsow9aNoJvrosXcqozQYAqLkVUZwS1FbSPo9zaCb99E36aJQecSHzikuHJM4WADkCKvoN-6DayjXLVuA7-5HlrMrcoGDaawGFmVDdxS1LaB_3_-fnEm2r1JN_E6NVa_TvQON2cWD-Y0rDTeJnPzJYnnx2VOf94dueMLC5Nmp6v69Mdofbp0CPgaliyseFgVYfka9t_A0g2WqhZ9VYdW_Tq01jytWTqoA8taS6teLXpQh9bgYfHZxxT8vwIHWBXhPguDmx7w1ezz9RqytJQ8fcXTPeCFklVcug1oVG6Eg3YDHNUb4KjfsqRUl4IDGjUc4KjiCAePO8BRyWVJrG8fWYSXFMPhpaJL3jHo1nnJyCGoG68ZOQB4STRObeVp2FaAo7byOGwrj8O2liTr1Faehm3lcdhWgKNHlsdhW_kvGCXBJorfthbwUlsVv3EFt65406gA7Ht50ygf4CXTOO2beRpunAGOds48DrfOPI7aqkqWdWkroFFbAY7ainD0yPI4aqviv2DUEOD8TraAl9vKb2XRrfOm0eCUqsEBGeyjNb-pAXMHNGorwkFbAY7aCnB40uUPyuioC4749RaHh12Ao9Mu-I0APTX8F4xGo-O3sgW81FbN72WLtz57_umfAAAA___n7Cla +distribution: full +vectorized: true +· +• intersect +│ +├── • scan +│ missing stats +│ table: xyz@primary +│ spans: FULL SCAN +│ +└── • scan + missing stats + table: xyz@primary + spans: FULL SCAN +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJzEmFFv4kYUhd_7K6z7tCsNgpmxgViqlFU3VZFosg08VKry4IVpgsRiahsJNsp_rzBtndj4nhlsp4_gfMzxjc_HDM-U_rWmkG5-_zL9NLn1PnyezOaz36YfvdnN9OanubcX3sH7-f7uV29_-O5Nbuc397Pj-_9cPghv_99lErSJl-Y2-mZSCv8gSYIUCdIkyCdBAT0I2ibxwqRpnBz_5DkHJss9hQNBq812lx3ffhC0iBND4TNlq2xtKKR59HVt7k20NEl_QIKWJotW63yZ_eH79TZZfYuSAwmabaNNGnq9_nHlu10WetdKXEt6eBEU77JihTSLHg2F8kVcliJwTCHFtapNoVxSfF6l2WqzyPqyNIlzaxTY14P3FKVP55Eiir4sStBBFL82SvFRu02cLE1ilm8-LP-U2rDKYm5FiqCrFBYjK1IMG6QQFwX9JUqfZia72_Z1aV7zw9aEr2TwaTolQWvzZ_Yhv4mPPyarx6d_X9g1YNTulG_jXrzt66A8ibNrj9-sLe0dIC0c0Fe9vr7ERQ45hs45HGwEchQKkJ3byDrKsHMbyfY8YDG3Ohu1mMJiZHU2ckvR2EbyvW2k7JuobJqoe33_EiM45Bg553AwAshR1FB1bgTrKKPOjaDa66LF3OqM0GIKi5HVGcEtRWMjqPc2grZvorZpot_LzxPORnDIMXbO4WAEkKOooe7cCNZRxp0bQbfXRYu51RmhxRQWI6szgluKxkbQ720E376Jvk0Tg94lPnBIceWYwsEGIEVRQb9zG1hHuercBn57PbSYW50NWkxhMbI6G7ilaGwD___8_eJMtHuTbuNNaqx-nRgcb84sH81pWGm8SxbmSxIv8mVOL-9yLn9jadLsdFWfXkw2p0vHgK9hycKKh1UZlq9h_w0s3WCpGtFXTWg1bEJrzdOapYMmsGy0tBo0okdNaA0eFp99TMH_K3CAVRkesjC46RFfzSFfrzFLS8nTVzw9AF6oWMWl24BG5UY4aDfAUb0BjvotK0p1KTigUcMBjiqOcPC4AxyVXFbE-vaRRXhFMRxeKbrkHYNunZeMHIO68ZqRI4BXROPUVp6GbQU4aiuPw7byOGxrRbJObeVp2FYeh20FOHpkeRy2lf-CURJsovhtawmvtFXxG1dw64o3jQrAvpc3jfIBXjGN076Zp-HGGeBo58zjcOvM46itqmJZl7YCGrUV4KitCEePLI-jtir-C0aNAc7vZEt4ta38VhbdOm8aDU6pGhyQwT5a85saMHdAo7YiHLQV4KitAIcnXf6gjI664IjfbHF42AU4Ou2C3wjQU8N_wWg0On4rW8IrbdX8XrZ86w8vP_wdAAD__3KVI_s= # INTERSECT ALL and INTERSECT with different ORDER BY types. query T -SELECT url FROM [EXPLAIN (DISTSQL) (SELECT x FROM xyz ORDER BY y) INTERSECT ALL (SELECT x FROM xyz ORDER BY z) ORDER BY x] +EXPLAIN (DISTSQL) (SELECT x FROM xyz ORDER BY y) INTERSECT ALL (SELECT x FROM xyz ORDER BY z) ORDER BY x ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJy8lk1v2kwQgO_vr7DmFPQuMru2-bBUKWlDVSQKKebQKvLBwduARLC7NhIkyn-vMEHUGO94cbI3CPvMjmeeyfgFkj9LcMHrD_tfpsZaLI2vk_F3477_8254MxgZV7cDb-r9GDaMq7czm_2JzfbZGE9u-xPj8y9j2zAGo2l_4u0O3AyH0sPPjePnjQ8EVlHIR8ETT8C9BwoEGBCwgIANBBzwCcQimvEkicTuyEsGDMINuC0Ci1W8Tnd_9gnMIsHBfYF0kS45uDANHpZ8woOQC7MFBEKeBotlds1m-3wdi8VTILZAwIuDVeIaTXN383idusY1Bf-VQLRO38Ifoz5sjXmQzPPxsvM-gSQNHjm49JVclqajNU1WmuYxznoViZALHuYi-TsSO3LmWb8Fydzj6Tg26UlHptuYu3mNgMCS_06vrmnjk1g8zrNPpY9-fCxLpfpeJFIuTOqcVur_0vh2hbKdq8hb0DNJjKJmFJusdVrjs9c7uetpdbloBblM1jStD5kChUTbmhNlpYlqmAOqaQ6Q-h_moH3pHLDq_WVV-ms1TftDRFRItKM5UVaaqAYRmSYRkfofROxcKqJVvb9Wlf7azWwtv7-ICol2NSfKShPVIKKlSUSk_gcRu5eKaFfvr12lv07zQzRUSLOnNU1WmqYGCW1NEiLVP0jYe4_X0zPxJzyJo1XCK715tnY14-Ej3_cgidZixu9ENMuu2X8dZ1z2uhHyJN3_yvZfBqvsp6yv1eFOHZjSWrRTi-7JaapQM6oGd-rAJzVTpZ1adE9Os1O69S9t5eDWKWxJYVt-sy2FGZVf7dSZDzmMzIccxuYDoZH5QGhkPtp15kMOI_Mhh7H5QGhkPhAamY-O1NKuXNJunfno1TFcDiOGy2HMcIRGDEdobAOorM3if1KVvalKo0tAaXMq44jmtLBFcqpSJhedytcIYjot7BEV1REacR2hMdkxHLEdwzHdCztUSXc5jekup1HdERzTHcEx3QuLNK97G9G9sFOUdC_sFCXd5TSmu5xGdUdwTHcEx3Qv7FMl3eU0prucRnVHcEx3BMd0L2zV_Lt2S647K-wWqe7-639_AwAA___juoKq +distribution: full +vectorized: true +· +• sort +│ order: +x +│ +└── • intersect all + │ + ├── • scan + │ missing stats + │ table: xyz@primary + │ spans: FULL SCAN + │ + └── • scan + missing stats + table: xyz@primary + spans: FULL SCAN +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJy8ll9v2jAQwN_3KaJ7KppRYifhT6RJ7VamITHoCA-bJh5S4hUkSjInSNCq330iFLEQ4otJ6zco_p0vd7_r5RmSv0vwoPfzbnDTHxpXt31_4v8YNIwrvzfofZkYG-PrePTd2GyfjNH4tjc2Pv8ytg2jP5z0xv7uwM1gID381Dh-3gCBVRTyYfDIE_B-AwUCDAjYQMABAi5MCcQimvEkicTuyHMG9MMNeBaBxSpep7s_TwnMIsHBe4Z0kS45eDAJ7pd8zIOQC9MCAiFPg8Uyu2azfbqOxeIxEFsg4MfBKvGMprm7ebROPeOawvSFQLROX8Mfo95vjXmQzPPxsvNTAkkaPHDw6Au5LE1Xa5qsNM1jnPUqEiEXPMxFmu5I7MiZZ_0WJHOfp6PYpCcdmWxj7uUtAgJL_ie9uqaNT2LxMM8-lT768bFsler7kUi5MKl7WqmPpfGdCmU7V5HXoGeSGEbNKDaZdVrjs9e7uetpdbloBblM1jTtd5kChURbmhNlpYlqmAOqaQ6Q-h_moHXpHLDq_WVV-ms3TeddRFRItK05UVaaqAYRmSYRkfofRGxfKqJdvb92lf46zWwtv72ICol2NCfKShPVIKKtSUSk_gcRO5eK6FTvr1Olv27zXTRUSLOrNU1WmqYGCR1NEiLVP0jYfYvX0zPxxzyJo1XCK715Wrua8fCB73uQRGsx43cimmXX7L-OMi573Qh5ku5_Zfsv_VX2U9bX6nC7DkxpLdqtRXflNFWoGVWD23Xgk5qp0m4tuiun2Slt_U_bOdg6hW0p7MhvdqQwo_Kr3TrzIYeR-ZDD2HwgNDIfCI3MR6vOfMhhZD7kMDYfCI3MB0Ij89GWWtqRS9qpMx_dOobLYcRwOYwZjtCI4QiNbQCVtVn8T6qyN1VpdAkobU5lHNGcFrZITlXK5KJT-RpBTKeFPaKiOkIjriM0JjuGI7ZjOKZ7YYcq6S6nMd3lNKo7gmO6Izime2GR5nVvIboXdoqS7oWdoqS7nMZ0l9Oo7giO6Y7gmO6Ffaqku5zGdJfTqO4IjumO4Jjuha2af9e25Lqzwm6R6j59-fAvAAD__yMAfUs= query T -SELECT url FROM [EXPLAIN (DISTSQL) (SELECT x FROM xyz ORDER BY y) INTERSECT (SELECT x FROM xyz ORDER BY z) ORDER BY x] +EXPLAIN (DISTSQL) (SELECT x FROM xyz ORDER BY y) INTERSECT (SELECT x FROM xyz ORDER BY z) ORDER BY x ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJy8mEtv6kYYhvf9FdasEtXIzIWbpUo5baiKRMMpsGh1xMIHpgkSB1PbSJAo_70CEjlh8PfOxHZ2ufjxvP6Y99GYJ5b-t2Ihm_SH_d-m3jZZeb-PR3963_p_fx1-Gdx5V7eDyXTy1_Dau3q5Zne6Yrd_9Ebj2_7Y-_Ufb3_tDe6m_fHkcAF14eN1_vNuxny2jhf6LvqhUxZ-Y5z5TDCfSeYzxXzWYjOfbZJ4rtM0Tg6XPB2BwWLHwqbPluvNNjv8eeazeZxoFj6xbJmtNAvZNPq-0mMdLXQSNJnPFjqLlqvjMrv9480mWf6Ikj3z2WQTrdPQawSHlUfbLPRuOJs9-yzeZvnt0yy61yzkz_7HIrQqiyBcItwu02y5nmcBP5uBsUDOfN97D1H6cOH6PIT8WIhWpSFUYYj8Ptt1nCx0ohfv7nS8S2FMgWaVR2jVFQFNKo_QLhHB_1DKP6L0YaKz0SaQZ5Oa7jc6fKOCL8Mh89lK_5td3fDrX5Ll_cPxJ4tt3nHZYZM4yXQSSGNqPxfev2sxtksTebnphRB3cSPeBKp5PuOLy_feLc_tRcItRBKIRiCdbeYQol1hCOESIlcJr9Fn1iHaNfqMVycTNKsin1UYAU2qyGduEUr7jH-Sz8AOe_WZMTVbnwn7LgubLstGoJyF4hCiU2EI4RIi77KoUSjWITo1CkVU12Y0qyKhVBgBTapIKG4RSgtFfJJQwA57FYoxNVuhSPsuS5suq8bxlchNKA4huhWGEC4h8i7LGoViHaJbo1BkdW1GsyoSSoUR0KSKhOIWobRQ5CcJBeywV6EYU7MVirLvsrLpcqvhrBOHCL3KIgiXCHmPVY0ysQ7Rq1Emqromo1kVyaTCCGhSRTJxi1BaJuqTZAJ22KtMjKl95OubC_cf63QTr1Nt9c1M8zAzvbjXp88gjbfJXH9N4vlxmdOvoyN3_MNCp9npv_L0y2B9-tch4FuYk7CgYXEO87ewegdzN5jLMrTgpeheGVp2aFqSdKsMzMHIaVqIMrRslqK7NK3Ibdqm4ZYDLM7hNgl36IJ0SBg8c5eEFaeX7pE0B83mtFQ4WJwbWnExA6CRGgCO3IBwIAeAIztwWi5AD4BGfgA4EgTAkSEQDurCDcO837JodLRiznBDE5yWDG-DwtCaQY9Oe0Y0weK0aXgP4IZqnMpO07DsNA7LDnBUdhpHZReGZV3KDmhUdoCjsgMclR3hYMcLcG5Fp0dDNRRulF3QqhEKHJtp1aBHp00jumBx2jQCnGiEoRqnMz9Nw0M_jcNTP8DRsZ_GYdkNyzqVnaZh2Wkclp3GYdkBjnY8fZaV4GOX4AWZ02WXtGokOElLWjXg0SVtGgmOFZI2jWwB3FCNS9kBjcoOcFR2hIOyAxy-5BuWdXrLp2n4mk_j8D2fxuGLPsDRjqfPshJ9bvRZ9gw3y06rRoGTtKJVc_7os-ef_g8AAP__l74Rug== +distribution: full +vectorized: true +· +• sort +│ order: +x +│ +└── • intersect + │ + ├── • scan + │ missing stats + │ table: xyz@primary + │ spans: FULL SCAN + │ + └── • scan + missing stats + table: xyz@primary + spans: FULL SCAN +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJy8mE1v6kYUhvf9FdZZJaoRzIz5slQptw1VkWi4BRatqix8YZogcTG1jQSJ8t8roJETBp93Jrazy4cfz-vDvI_GPFP674pCGvz5dfRleOdd3Q6ns-kfo2vvajoYDX6ZeTvv18n4d2-3f_LGk9vBxPv5L29_7Q3vZoPJ9HABd-HTdf7zjnxaxwt9F33XKYV_kyCfJPmkyKeAfGrTvU-bJJ7rNI2TwyXPR2C42FHY8mm53myzw5_vfZrHiabwmbJlttIU0iz6ttITHS100myRTwudRcvVcZnd_ulmkyy_R8mefJpuonUaeo3mYeXxNgu9G0H3Lz7F2yy_fZpFD5pC8eJ_LEK7sgjSJcLtMs2W63nWFGczMBbImW977zFKHy9cn4dQHwvRrjREUBgiv892HScLnejFuzsd71IYU6JZ5RHadUVAk8ojdEpE8D-U8rcofZzqbLxpqrNJzfYbHb4xwZfRiHxa6X-yqxtx_VOyfHg8_mSxzbsuO2waJ5lOmsqY2o-F9-9ZjO3SRP6_6YUQd3Ej3jSD1vmMLy7ff7e8sBeJsBBJUzaaytlmDiE6FYaQLiFylYgafWYdolOjz0R1MkGzKvJZhRHQpIp85hahtM_EJ_kM7LBXnxlTs_WZtO-ytOmyajQDZ6E4hOhWGEK6hMi7LGsUinWIbo1CkdW1Gc2qSCgVRkCTKhKKW4TSQpGfJBSww16FYkzNVijKvsvKpstB4_hK5CYUhxC9CkNIlxB5l1WNQrEO0atRKKq6NqNZFQmlwghoUkVCcYtQWijqk4QCdtirUIyp2QolsO9yYNPldsNZJw4R-pVFkC4R8h4HNcrEOkS_RpkE1TUZzapIJhVGQJMqkolbhNIyCT5JJmCHvcrEmNpHvr65cP-JTjfxOtVW38y0DjPTiwd9-gzSeJvM9dcknh-XOf06PnLHPyx0mp3-q06_DNenfx0CvoUFC0selueweAsH72DhBgtVhpaiFN0vQ6suTyuWbpeBBRg5T0tZhlatUnSPpwN2m3Z4uO0Ay3O4w8JdviBdFgbP3GPhQPBL91lagGYLXioCLC4MrbiYAdBIDQBHbkA4kAPAkR0ELxegB0AjPwAcCQLgyBAIB3URhmHeb1k0Ol4xZ7ihCcFLRnRAYXjNoEfnPSNbYHHeNKIPcEM1TmXnaVh2HodlBzgqO4-jskvDsi5lBzQqO8BR2QGOyo5wsOMlOLei06OhGg43yi551cgAHJt51aBH500je2Bx3jQSnGikoRqnMz9Pw0M_j8NTP8DRsZ_HYdkNyzqVnadh2Xkclp3HYdkBjnY8f5ZV4GNX4AVZ8GVXvGoUOEkrXjXg0RVvGgWOFYo3jWoD3FCNS9kBjcoOcFR2hIOyAxy-5BuWdXrL52n4ms_j8D2fx-GLPsDRjufPsgp9bvxZ9gw3y86rJgAn6YBXzfmj37_88F8AAAD__zvnDFs= # INTERSECT ALL and INTERSECT with different numbers of ORDER BY columns. query T -SELECT url FROM [EXPLAIN (DISTSQL) (SELECT x FROM xyz ORDER BY y) INTERSECT ALL (SELECT x FROM xyz ORDER BY y, z) ORDER BY x] +EXPLAIN (DISTSQL) (SELECT x FROM xyz ORDER BY y) INTERSECT ALL (SELECT x FROM xyz ORDER BY y, z) ORDER BY x ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJy8lt9v2j4QwN-_f0V0T0Vfo2An4UekSe1WpiEx6AgPm6o8pMQrSJRkTpCgVf_3iVDEQogvJq3fmsYf-3L3Oc4vkPxZggtef9j_MjXWYml8nYy_G_f9n3fDm8HIuLodeFPvx7BhXL2t2exXbLbPxnhy258Yn38Z24YxGE37E2-34GY4lC8mxnPj-LjxgcAqCvkoeOIJuPdAgQADAhYQsIGAAz6BWEQzniSR2C15yYBBuAG3RWCxitfp7t8-gVkkOLgvkC7SJQcXpsHDkk94EHJhtoBAyNNgscyO2Wyfr2OxeArEFgh4cbBKXKNp7k4er1PXuKbgvxKI1unb9sddH7bGPEjm-f2y9T6BJA0eObj0lVwWpqM1TFYa5nGf9SoSIRc8zO3k70hsyZlv_RYkc4-n49ikJxWZbmPu5k0CAkv-O726po1PYvE4z_4q_fTjZ1kq2fcikXJhUuc0U_-X7m9XSNu5jLxteiaIUdSMYpO1TnN89ngndzytLhetIJfJmqb1IV2gEGhbc6CsNFANfUA19QGS_0MftC_tA1a9vqxKfa2maX-IiAqBdjQHykoD1SAi0yQikv-DiJ1LRbSq19eqUl-7mY3l9xdRIdCu5kBZaaAaRLQ0iYjk_yBi91IR7er1tavU12l-iIYKYfa0hslKw9Qgoa1JQiT7Bwl773E9PbP_hCdxtEp4pZtna5czHj7yfQ2SaC1m_E5Es-yY_eM447LrRsiTdP-W7R8Gq-xVVtfqcKcOTGkt2qlF9-Q0VcgZVYM7deCTnKnSTi26J6fZKd36l7ZycOsUtqSwLT_ZlsKMyo926vSHHEb6Qw5j_YHQSH8gNNIf7Tr9IYeR_pDDWH8gNNIfCI30R0dqaVcuabdOf_TqGC6HEcPlMGY4QiOGIzQ2AVTGZvGXVGVuqtLoEFCanMo4ojktTJGcqpTJRafyMYKYTgtzREV1hEZcR2hMdgxHbMdwTPfCDFXSXU5justpVHcEx3RHcEz3wiDN695GdC_MFCXdCzNFSXc5jekup1HdERzTHcEx3QvzVEl3OY3pLqdR3REc0x3BMd0LUzV_127JdWeF2SLV3X_9728AAAD__0Yeg28= +distribution: full +vectorized: true +· +• sort +│ order: +x +│ +└── • intersect all + │ + ├── • scan + │ missing stats + │ table: xyz@primary + │ spans: FULL SCAN + │ + └── • scan + missing stats + table: xyz@primary + spans: FULL SCAN +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJy8ll9v2jAQwN_3KaJ7KppRYifhT6RJ7VamITHoCA-bJh5S4hUkSjInSNCq330iFLEQ4otJ67em8c--3P2O8zMkf5fgQe_n3eCmPzSubvv-xP8xaBhXfm_Q-zIxNsbX8ei7sdk-GaPxbW9sfP5lbBtGfzjpjf3dgpvBQL6YGE-N4-MGCKyikA-DR56A9xsoEGBAwAYCDhBwYUogFtGMJ0kkdkueM6AfbsCzCCxW8Trd_XtKYBYJDt4zpIt0ycGDSXC_5GMehFyYFhAIeRosltkxm-3TdSwWj4HYAgE_DlaJZzTN3cmjdeoZ1xSmLwSidfq6_XHX-60xD5J5fr9s_ZRAkgYPHDz6Qi4L09UaJisN87jPehWJkAse5naa7khsyZlv_RYkc5-no9ikJxWZbGPu5UUCAkv-J726po1PYvEwz_4q_fTjZ9kq2fcjkXJhUvc0Ux9L93cqpO1cRl43PRPEMGpGscms0xyfPd7NHU-ry0UryGWypmm_SxcoBNrSHCgrDVRDH1BNfYDk_9AHrUv7gFWvL6tSX7tpOu8iokKgbc2BstJANYjINImI5P8gYvtSEe3q9bWr1NdpZmP57UVUCLSjOVBWGqgGEW1NIiL5P4jYuVREp3p9nSr1dZvvoqFCmF2tYbLSMDVI6GiSEMn-QcLuW1xPz-w_5kkcrRJe6eZp7XLGwwe-r0ESrcWM34lolh2zfxxlXHbdCHmS7t-y_UN_lb3K6lodbteBKa1Fu7XorpymCjmjanC7DnySM1XarUV35TQ7pa3_aTsHW6ewLYUd-cmOFGZUfrRbpz_kMNIfchjrD4RG-gOhkf5o1ekPOYz0hxzG-gOhkf5AaKQ_2lJLO3JJO3X6o1vHcDmMGC6HMcMRGjEcobEJoDI2i7-kKnNTlUaHgNLkVMYRzWlhiuRUpUwuOpWPEcR0WpgjKqojNOI6QmOyYzhiO4ZjuhdmqJLuchrTXU6juiM4pjuCY7oXBmle9xaie2GmKOlemClKustpTHc5jeqO4JjuCI7pXpinSrrLaUx3OY3qjuCY7giO6V6Yqvm7tiXXnRVmi1T36cuHfwEAAP__dYp-EA== query T -SELECT url FROM [EXPLAIN (DISTSQL) (SELECT x FROM xyz ORDER BY y) INTERSECT (SELECT x FROM xyz ORDER BY y, z) ORDER BY x] +EXPLAIN (DISTSQL) (SELECT x FROM xyz ORDER BY y) INTERSECT (SELECT x FROM xyz ORDER BY y, z) ORDER BY x ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJy8mE1v6kYYhff9FdasEtXIzAdflirltqEqEg23wKLVFQtfmCZIXExtI0Gi_PcKSOSEwe-Zie3sQuLHc_wy59E4Tyz9b8VCNukP-79NvW2y8n4fj_70vvX__jr8Mrjzrm4Hk-nkr-G1d_Vyze50xW7_6I3Gt_2x9-s_3v7aG9xN--PJ4QLyQt97vM4_7mbMZ-t4oe-iHzpl4TfGmc8E85lkPlPMZy0289kmiec6TePkcMnTERgsdixs-my53myzw69nPpvHiWbhE8uW2UqzkE2j7ys91tFCJ0GT-Wyhs2i5Oi6z2z_ebJLljyjZM59NNtE6Db1GcFh5tM1C74az2bPP4m2W3z7NonvNQv7sfyxCq7IIwiXC7TLNlut5FvCzGRgL5Mz3vfcQpQ8Xrs9DyI-FaFUaQhWGyO-zXcfJQid68e5Ox7sUxhRoVnmEVl0R0KTyCO0SEfwPpfwjSh8mOhttAnk2qel-o8M3NvgyHDKfrfS_2dUNv_4lWd4_HH-y2OYdlx02iZNMJ4E0pvZz4f27FmO7NJGXm14IcRc34k2gmuczvrh8793y3F4k3EIkgWgE0tlmDiHaFYYQLiFylfAafWYdol2jz3h1MkGzKvJZhRHQpIp85hahtM_4J_kM7LBXnxlTs_WZsO-ysOmybATKWSgOIToVhhAuIfIuixqFYh2iU6NQRHVtRrMqEkqFEdCkioTiFqG0UMQnCQXssFehGFOzFYq077K06bJqHF-J3ITiEKJbYQjhEiLvsqxRKNYhujUKRVbXZjSrIqFUGAFNqkgobhFKC0V-klDADnsVijE1W6Eo-y4rmy63Gs46cYjQqyyCcImQ91jVKBPrEL0aZaKqazKaVZFMKoyAJlUkE7cIpWWiPkkmYIe9ysSY2kf-fXPh_mOdbuJ1qq3-M9M8zEwv7vXpO0jjbTLXX5N4flzm9HF05I6_WOg0O_1Vnj4M1qc_HQK-hTkJCxoW5zB_C6t3MHeDuSxDC16K7pWhZYemJUm3ysAcjJymhShDy2YpukvTitymbRpuOcDiHG6TcIcuSIeEwTN3SVhxeukeSXPQbE5LhYPFuaEVFzMAGqkB4MgNCAdyADiyA6flAvQAaOQHgCNBABwZAuGgLtwwzPsti0ZHK-YMNzTBacnwNigMrRn06LRnRBMsTpuG9wBuqMap7DQNy07jsOwAR2WncVR2YVjWpeyARmUHOCo7wFHZEQ52vADnVnR6NFRD4UbZBa0aocCxmVYNenTaNKILFqdNI8CJRhiqcTrz0zQ89NM4PPUDHB37aRyW3bCsU9lpGpadxmHZaRyWHeBox9NnWQm-dglekDlddkmrRoKTtKRVAx5d0qaR4FghadPIFsAN1biUHdCo7ABHZUc4KDvA4Uu-YVmnt3yahq_5NA7f82kcvugDHO14-iwr0fdGn2XPcLPstGoUOEkrWjXnjz57_un_AAAA__-qkBJ_ +distribution: full +vectorized: true +· +• sort +│ order: +x +│ +└── • intersect + │ + ├── • scan + │ missing stats + │ table: xyz@primary + │ spans: FULL SCAN + │ + └── • scan + missing stats + table: xyz@primary + spans: FULL SCAN +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJy8mE9v6kYUxff9FNZdJaoRzIz5Z6lSXhuqItHwCixaVVn4wTRB4mFqGwkS5btXQCMnDL5nJrazC4l_nuPLnJ_Geab03xWFNPjz6-jL8M67uh1OZ9M_Rtfe1XQwGvwy83ber5Px795u_-SNJ7eDiffzX97-2hvezQaT6eEC9kLfe7rOP-7Ip3W80HfRd51S-DcJ8kmST4p8CsinNt37tEniuU7TODlc8nwEhosdhS2fluvNNjv8-t6neZxoCp8pW2YrTSHNom8rPdHRQifNFvm00Fm0XB2X2e2fbjbJ8nuU7Mmn6SZap6HXaB5WHm-z0LsRdP_iU7zN8tunWfSgKRQv_scitCuLIF0i3C7TbLmeZ01xNgNjgZz5tvceo_TxwvV5CPWxEO1KQwSFIfL7bNdxstCJXry70_EuhTElmlUeoV1XBDSpPEKnRAT_Qyl_i9LHqc7Gm6Y6m9Rsv9HhGxl8GY3Ip5X-J7u6Edc_JcuHx-NPFtu867LDpnGS6aSpjKn9WHj_nsXYLk3k_5teCHEXN-JNM2idz_ji8v13ywt7kQgLkTRlo6mcbeYQolNhCOkSIleJqNFn1iE6NfpMVCcTNKsin1UYAU2qyGduEUr7THySz8AOe_WZMTVbn0n7LkubLqtGM3AWikOIboUhpEuIvMuyRqFYh-jWKBRZXZvRrIqEUmEENKkiobhFKC0U-UlCATvsVSjG1GyFouy7rGy6HDSOr0RuQnEI0aswhHQJkXdZ1SgU6xC9GoWiqmszmlWRUCqMgCZVJBS3CKWFoj5JKGCHvQrFmJqtUAL7Lgc2XW43nHXiEKFfWQTpEiHvcVCjTKxD9GuUSVBdk9GsimRSYQQ0qSKZuEUoLZPgk2QCdtirTIypfeTfNxfuP9HpJl6n2uo_M63DzPTiQZ--gzTeJnP9NYnnx2VOH8dH7viLhU6z01_V6cNwffrTIeBbWLCw5GF5Dou3cPAOFm6wUGVoKUrR_TK06vK0Yul2GViAkfO0lGVo1SpF93g6YLdph4fbDrA8hzss3OUL0mVh8Mw9Fg4Ev3SfpQVotuClIsDiwtCKixkAjdQAcOQGhAM5ABzZQfByAXoANPIDwJEgAI4MgXBQF2EY5v2WRaPjFXOGG5oQvGREBxSG1wx6dN4zsgUW500j-gA3VONUdp6GZedxWHaAo7LzOCq7NCzrUnZAo7IDHJUd4KjsCAc7XoJzKzo9GqrhcKPskleNDMCxmVcNenTeNLIHFudNI8GJRhqqcTrz8zQ89PM4PPUDHB37eRyW3bCsU9l5Gpadx2HZeRyWHeBox_NnWQW-dgVekAVfdsWrRoGTtOJVAx5d8aZR4FiheNOoNsAN1biUHdCo7ABHZUc4KDvA4Uu-YVmnt3yehq_5PA7f83kcvugDHO14_iyr0PfGn2XPcLPsvGoCcJIOeNWcP_r9yw__BQAA__8-7g0g # INTERSECT ALL and INTERSECT with compatible ORDER BY columns that are not in the final result. query T -SELECT url FROM [EXPLAIN (DISTSQL) (SELECT y FROM xyz ORDER BY z) INTERSECT ALL (SELECT y FROM xyz ORDER BY z)] +EXPLAIN (DISTSQL) (SELECT y FROM xyz ORDER BY z) INTERSECT ALL (SELECT y FROM xyz ORDER BY z) ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJzElkFv2jAYhu_7FdZ3aiWjYCfQEmkS3co0JAYdcNhU5ZASryBRktlBKq3471NCtY4A_uJ59W6l8WO__vJIeZ9B_VxCCJPeoPdxStZyST6NR1_Ibe_bzeCqPyRn1_3JdPJ1cE7OXtZsdiseN09kNL7ujcmH7-TpnPSH0954Uiy4GgyQxRFQWKWJGMYPQkF4CwwocKDgA4UAKLQgopDJdCaUSmWx5LkE-skjhE0Ki1W2zot_RxRmqRQQPkO-yJcCQpjGd0sxFnEipNcEConI48WyPOZx89TN5OIhlhugMMnilQpJwytOHq3zkHQ5RFsK6Tp_2f5117sNmcdqvr9fl0G0jSioPL4XELIt_buYLacx-cmYr_usV6lMhBTJ3k5RQWJLjtz1c6zmE5GPMo9V3sh0k4lw3x2gsBQ_8rMuO38vF_fz8q_fV2eVq79ey7e41pHMw7SRZh5rVQdw9Oxg72xW_82zGm_e4w3PfxNFDYK2HQflJ4M6kJQ5kpTXnz-vM3-_4QVvIopB0AvHQfnJoA5E4Y5E8evP368z_6BRfnP-vSgGQS8dB-UngzoQxXckSlB__kGd-bcab6KJQcyO05j8ZEwHkgT_oRsdSTQWKktXStRqPs3iTiK5F7sZqXQtZ-JGprPymN3PUcmVX_FEqHz3lO9-9Fflo3Lu9eG2DdyxgZlVbtbS08xgZMwMbtvAHRuYWeWujOyA5lW6-Sft62FfC7P9mTWrdGAjuB5GBNfDiOB6GBMcoRHBWzaC62FEcD2MCK6HMcERGhG8bSP4hY2iehhRVA8jiuphTFGERhS9tFFUDyOK6mFEUT2MKYrQiKIdG0WZVU9AaERShEYsRWhMUwzHuoJdWbBrC3Z1wbIv2BUGZtUY2EFlMLJVT2O26mnMVj2N2orgmK0mZelw6iZtyZTGbDXqS8Y4ZutBedDaGm3f_QoAAP__3Gl7KQ== +distribution: full +vectorized: true +· +• intersect all +│ +├── • scan +│ missing stats +│ table: xyz@primary +│ spans: FULL SCAN +│ +└── • scan + missing stats + table: xyz@primary + spans: FULL SCAN +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJzElkFv2jAYhu_7FdZ3aiWjYCfQEmkS3co0JAYdcNg05ZASryDRJIuD1LTiv08J0zoC-Ivn4d1K48d-_eWR8r6A_LEGHwZf7kY3wzG5uB3O5rPPo0tyMRuMBu_npCAfppNP5Kl4JpPp7WBK3n0lz5dkOJ4PprNywc1ohCwGCnESiXH4KCT434ABBQ4UXKDgAYUOBBTSLFkIKZOsXPJSAcPoCfw2hVWcbvLy3wGFRZIJ8F8gX-VrAT7Mw_u1mIowEpnTBgqRyMPVujrmqXjup9nqMcwKoDBLw1j6pOWUJ082uU_6HIIthWST_9r-ddf7gixDudzfr88g2AYUZB4-CPDZlv5dzI7VmPxkzNd9NnGSRSIT0d5OQUliS47c9WMolzORT1KH1d7IvEiFv68OUFiL7_lFn12-zVYPy-qv31dntau_Xss1uNaRzOOklaQO69QHcPRsb-9s1vzNswZv3uEtxz2LohpBu5aD8pNBLUjKLEnKm8-fN5m_23K8s4iiEfTKclB-MqgFUbglUdzm83ebzN9rVd-cfy-KRtBry0H5yaAWRHEtieI1n7_XZP6d1lk00YjZsxqTn4xpQRLvP3SjI4mmQqZJLEWj5tMu7ySiB7GbkUw22ULcZcmiOmb3c1Jx1Vc8EjLfPeW7H8O4elTNvTncNYF7JjAzys06apppjIzpwV0TuGcCM6PctZEd0LxOt_-kXTXsKmG2P7N2nfZMBFfDiOBqGBFcDWOCIzQieMdEcDWMCK6GEcHVMCY4QiOCd00EvzJRVA0jiqphRFE1jCmK0Iii1yaKqmFEUTWMKKqGMUURGlG0Z6IoM-oJCI1IitCIpQiNaYrhWFcwKwtmbcGsLhj2BbPCwIwaAzuoDFq2qmnMVjWN2aqmUVsRHLNVpywdTl2nLenSmK1afUkbx2w9KA9KW4Ptm58BAAD__1VGdco= query T -SELECT url FROM [EXPLAIN (DISTSQL) (SELECT y FROM xyz ORDER BY z) INTERSECT ALL (SELECT y FROM xyz ORDER BY z)] +EXPLAIN (DISTSQL) (SELECT y FROM xyz ORDER BY z) INTERSECT ALL (SELECT y FROM xyz ORDER BY z) ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJzElkFv2jAYhu_7FdZ3aiWjYCfQEmkS3co0JAYdcNhU5ZASryBRktlBKq3471NCtY4A_uJ59W6l8WO__vJIeZ9B_VxCCJPeoPdxStZyST6NR1_Ibe_bzeCqPyRn1_3JdPJ1cE7OXtZsdiseN09kNL7ujcmH7-TpnPSH0954Uiy4GgyQxRFQWKWJGMYPQkF4CwwocKDgA4UAKLQgopDJdCaUSmWx5LkE-skjhE0Ki1W2zot_RxRmqRQQPkO-yJcCQpjGd0sxFnEipNcEConI48WyPOZx89TN5OIhlhugMMnilQpJwytOHq3zkHQ5RFsK6Tp_2f5117sNmcdqvr9fl0G0jSioPL4XELIt_buYLacx-cmYr_usV6lMhBTJ3k5RQWJLjtz1c6zmE5GPMo9V3sh0k4lw3x2gsBQ_8rMuO38vF_fz8q_fV2eVq79ey7e41pHMw7SRZh5rVQdw9Oxg72xW_82zGm_e4w3PfxNFDYK2HQflJ4M6kJQ5kpTXnz-vM3-_4QVvIopB0AvHQfnJoA5E4Y5E8evP368z_6BRfnP-vSgGQS8dB-UngzoQxXckSlB__kGd-bcab6KJQcyO05j8ZEwHkgT_oRsdSTQWKktXStRqPs3iTiK5F7sZqXQtZ-JGprPymN3PUcmVX_FEqHz3lO9-9Fflo3Lu9eG2DdyxgZlVbtbS08xgZMwMbtvAHRuYWeWujOyA5lW6-Sft62FfC7P9mTWrdGAjuB5GBNfDiOB6GBMcoRHBWzaC62FEcD2MCK6HMcERGhG8bSP4hY2iehhRVA8jiuphTFGERhS9tFFUDyOK6mFEUT2MKYrQiKIdG0WZVU9AaERShEYsRWhMUwzHuoJdWbBrC3Z1wbIv2BUGZtUY2EFlMLJVT2O26mnMVj2N2orgmK0mZelw6iZtyZTGbDXqS8Y4ZutBedDaGm3f_QoAAP__3Gl7KQ== +distribution: full +vectorized: true +· +• intersect all +│ +├── • scan +│ missing stats +│ table: xyz@primary +│ spans: FULL SCAN +│ +└── • scan + missing stats + table: xyz@primary + spans: FULL SCAN +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJzElkFv2jAYhu_7FdZ3aiWjYCfQEmkS3co0JAYdcNg05ZASryDRJIuD1LTiv08J0zoC-Ivn4d1K48d-_eWR8r6A_LEGHwZf7kY3wzG5uB3O5rPPo0tyMRuMBu_npCAfppNP5Kl4JpPp7WBK3n0lz5dkOJ4PprNywc1ohCwGCnESiXH4KCT434ABBQ4UXKDgAYUOBBTSLFkIKZOsXPJSAcPoCfw2hVWcbvLy3wGFRZIJ8F8gX-VrAT7Mw_u1mIowEpnTBgqRyMPVujrmqXjup9nqMcwKoDBLw1j6pOWUJ082uU_6HIIthWST_9r-ddf7gixDudzfr88g2AYUZB4-CPDZlv5dzI7VmPxkzNd9NnGSRSIT0d5OQUliS47c9WMolzORT1KH1d7IvEiFv68OUFiL7_lFn12-zVYPy-qv31dntau_Xss1uNaRzOOklaQO69QHcPRsb-9s1vzNswZv3uEtxz2LohpBu5aD8pNBLUjKLEnKm8-fN5m_23K8s4iiEfTKclB-MqgFUbglUdzm83ebzN9rVd-cfy-KRtBry0H5yaAWRHEtieI1n7_XZP6d1lk00YjZsxqTn4xpQRLvP3SjI4mmQqZJLEWj5tMu7ySiB7GbkUw22ULcZcmiOmb3c1Jx1Vc8EjLfPeW7H8O4elTNvTncNYF7JjAzys06apppjIzpwV0TuGcCM6PctZEd0LxOt_-kXTXsKmG2P7N2nfZMBFfDiOBqGBFcDWOCIzQieMdEcDWMCK6GEcHVMCY4QiOCd00EvzJRVA0jiqphRFE1jCmK0Iii1yaKqmFEUTWMKKqGMUURGlG0Z6IoM-oJCI1IitCIpQiNaYrhWFcwKwtmbcGsLhj2BbPCwIwaAzuoDFq2qmnMVjWN2aqmUVsRHLNVpywdTl2nLenSmK1afUkbx2w9KA9KW4Ptm58BAAD__1VGdco= # INTERSECT ALL and INTERSECT with a projection on the result. query T -SELECT url FROM [EXPLAIN (DISTSQL) SELECT x FROM ((SELECT x, y FROM xyz) INTERSECT ALL (SELECT x, y FROM xyz))] +EXPLAIN (DISTSQL) SELECT x FROM ((SELECT x, y FROM xyz) INTERSECT ALL (SELECT x, y FROM xyz)) ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJzElkFv2jAYhu_7FdF3Asko2Am0RJrUamMaEoMOOEyqckiJV5AoyewgQav-9ylJESOAv3gWyTHET_z68yPxvoH8swIPpv1h_8vM2oiV9W0y_mE99n89DO8HI6vxdTCdTX8Om9bHkm2-oNHYPxNrl_-03b02rcFo1p9M0xf3w6F1flHTBwLrKOSj4IVL8B6BAgEGBBwg4AKBDvgEYhHNuZSRSJe8ZcAg3ILXJrBcx5sk_dknMI8EB-8NkmWy4uDBLHha8QkPQi7sNhAIeRIsV9k2293rXSyWL4HYAYFpHKylZ7XsdOfxJvGsO0ruGPjvBKJN8rHD4cNPO2sRyMXxJ_eIT0AmwTMHj76T_wvbqSEsuxj28KnNOhIhFzw8-pifktiSMyf-HsjFlCfj2KaF25ntYu4dCwQEVvx30siCNz-L5fNi_3AYQ2EGh8M5Boc7k3wUtaLYpp3iGM7u7R7tTctbQEtYYLOW7VxRWo243VrisotxK9CWVqotK38XrMxdOC3bvaI6GnFvaonLLsatQB1WqTpO-btwytyF28r-o66ljkbc21risotxK1DHqVQdt_xduGXuotO6ojgaYXs1hGUXw1agjVtbxzqTa8JlHK0lL9Wg2unJePjM80nJaCPm_EFE82yb_HGccVkDCLlM8rcsfxiss1fZ9MvDXRO4ZwJTo9y0o6apxsioHtw1gXsmMDXKXRjZCc2KdPtf2lHDjhKmxzNrF2nXRHA1jAiuhhHB1TAmOEIjgndMBFfDiOBqGBFcDWOCIzQieNdE8BsTRdUwoqgaRhRVw5iiCI0oemuiqBpGFFXDiKJqGFMUoRFFeyaKUqOegNCIpAiNWIrQmKYYjnUFs7Jg1hbM6oJhXzArDNSoMdCTyqBlq5rGbFXTmK1qGrUVwTFbdcrS6dR12pIujdmq1Ze0cczWk_KgtNV___Q3AAD__6sBjWY= +distribution: full +vectorized: true +· +• intersect all +│ +├── • scan +│ missing stats +│ table: xyz@primary +│ spans: FULL SCAN +│ +└── • scan + missing stats + table: xyz@primary + spans: FULL SCAN +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJzElkGPmkAYhu_9FeQ7aTIGZwB3JWmym9amJla34qFJw4GV6WriAmUwkd3sf2_Abqyo8zGdCEeEZ-adb57E9xXE7w24MPrxMLkfT43O57G38L5PuoY3mow-LYyd8WU--2Z0Ou_PxMj3P-3yl64xni5Gc694cT-ZGOc_6gKBKA75NHjmAtyfQIEAAwIWELCBgAM-gSSNl1yIOC0-eS2BcbgDt09gHSXbrPjZJ7CMUw7uK2TrbMPBhUXwuOFzHoQ8NftAIORZsN6U2-zyl7skXT8HaQ4EvCSIhGv0zGLn2TZzjTtK7hj4bwTibfZ3h8PCj7mxCsTqeMl3xCcgsuCJg0vfyP-FdVoIyy6GPSy1jeI05CkPjxbzCxL75MyJvwZi5fFslpi0cjuLPOHusT9AYMN_ZZ0yePdjun5avT8cxlCZweFwlsbhziSfxr04MalTHcPZve2jvWl9C2gNC0zWM60rSqsQd9BKXHYxbgPa0ka1ZfXvgtW5C6tn2ldURyHuTStx2cW4DajDGlXHqn8XVp27sHvlf9S11FGIe9tKXHYxbgPqWI2qY9e_C7vOXTi9K4qjEHbYQlh2MWwD2titdawzueZcJHEkeK0G1S9OxsMnvp-UiLfpkj-k8bLcZv84K7myAYRcZPu3bP8wjspX5fTrwwMdeKgDU63c1JHTVGFkVA0e6MBDHZhq5a6M7IRmVbr_L23JYUsK0-OZ9au0rSO4HEYEl8OI4HIYExyhEcEdHcHlMCK4HEYEl8OY4AiNCD7QEfxGR1E5jCgqhxFF5TCmKEIjit7qKCqHEUXlMKKoHMYURWhE0aGOolSrJyA0IilCI5YiNKYphmNdQa8s6LUFvbqg2Rf0CgPVagz0pDIo2SqnMVvlNGarnEZtRXDMVpWydDp1lbakSmO2KvUlZRyz9aQ8SG313z78CQAA__9Al4gH query T -SELECT url FROM [EXPLAIN (DISTSQL) SELECT x FROM ((SELECT x, y FROM xyz) INTERSECT (SELECT x, y FROM xyz))] +EXPLAIN (DISTSQL) SELECT x FROM ((SELECT x, y FROM xyz) INTERSECT (SELECT x, y FROM xyz)) ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJzEmFFv4kYUhd_7K6z7lEiDYGZsIJYqZdVNVSSabAMPlVY8eGGaILGY2kYKG-W_V0AjJza-Zwbb2Ufj-TxnLnOO7_iZ0n9XFNLkZnzz29TbJivv9_u7P72vN39_GX8a3XoXn0eT6eSv8aX3_5Cn44CLi9dr4e2OPz3tflx6o9vpzf1kf-P0gMsZCVrHC3MbfTcphV9JkiBFgjQJ8klQQDNBmySemzSNk_2Q5wMwWjxR2BO0XG-22f7nmaB5nBgKnylbZitDIU2jbytzb6KFSbo9ErQwWbRcHaZ52v243iTL71GyI0GTTbROQ6_T3c98t81C71qKa0WzF0HxNstnSLPowVAoX8R5KoImVSgXFZ-XabZcz7OuLFTi1Bw59m3nPUbp42kkl6LPkxK0IMWvlJI_aruOk4VJzOLdww5PqRSrLOqWqwjaUmFRslxFv4YKcZbQP6L0cWKyu01XF-o13W1M-CYQPo3HJGhl_skuDou4_DVZPjy-XuQOqFzcoNkS38adeNPVQbEMJ-cevptb2geAtAiArup09TlB5KCj36wO5aIj979sPYqspfRbjyLZXAhY1K0qihpUYVGyqihyU1E7iuSHRpGyt6GysaHudP1z4sBBx6BZHcpFR-5B1XocWEsZtB4HqjkjWtStKg4aVGFRsqo4cFNROw7Uh8aBtrehtrGh3zkcI5zjwEHHsFkdykVH7kHdehxYSxm2Hge6OSNa1K0qDhpUYVGyqjhwU1E7DvSHxoFvb0PfxoZB55wwcFBx1aQK5aIi95_fehRYS7lqPQr85kxoUbeqKGhQhUXJqqLATUXtKPB_2jeLE7ruTbqJ16mx-iLR26_MLB7MsVJpvE3m5ksSzw_THC_vDtzhh4VJs-NdfbwYrY-39gLfwpKFFQ-rIizfwv47WLrBUtWir-rQql-H1pqnNUsHdWBZa2rVq0UP6tAabBaf3abg_wocYFWE-ywMFj3grdnn7TVkaSl5-oqneyAXSqni4m1AI3MjHLgb4MjeAEf-lqVIdTE4oJHDAY4sjnCw3QGOTC5Lwfp-yyK8FDEcXjK65DMGLZ0PGTkEduNjRg4AXgoaJ7fyNHQrwJFbeRy6lcehW0sh6-RWnoZu5XHoVoCjLcvj0K38C0ZJ0ETxbWsBL7lV8Y0rWLrik0YFoO_lk0b5AC8ljVPfzNOwcQY46px5HLbOPI7cqkop6-JWQCO3Ahy5FeFoy_I4cqviXzBqCHC-ky3gZbfyrSxaOp80GpxSNTgggz5a800NqDugkVsRDtwKcORWgMOTLn9QRkddcMSvNzk87AIcnXbBNwK0a_gXjEal41vZAl5yq-Z72eLSZy-__BcAAP__VU4rAw== +distribution: full +vectorized: true +· +• intersect +│ +├── • scan +│ missing stats +│ table: xyz@primary +│ spans: FULL SCAN +│ +└── • scan + missing stats + table: xyz@primary + spans: FULL SCAN +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJzEmFFv4kYUhd_7K6z7lEiDYGZsIJYqZdVNVSSabAMPlao8eGGaILGY2kYKG-W_VxitnNj4nhlsZx_H5vOcucw5vuMXSv9bU0g3f3-ZfprcehefJ7P57K_ppTe7md78Nveevd_v7_70Li5-jIW3P1563n-_9Ca385v72eHG6R9ckqBNvDS30TeTUvgPSRKkSJAmQT4JCuhB0DaJFyZN4-Twk5ccmCyfKRwIWm22u-xw-UHQIk4MhS-UrbK1oZDm0de1uTfR0iT9AQlamixarfNpnvffr7fJ6luU7EnQbBtt0tDr9Q8z3-2y0LuW4lrRw6ugeJcVM6RZ9GgolK_iPBVBmyqUi4rPqzRbbRZZX5YqcWqOAvu6956i9Ok0UkjR50kJOpDi10opHrXbxMnSJGb57mH5U2rFKou6FSqCrlRYlKxQMWygQpwl9I8ofZqZ7G7b16V6zfdbE77Jg0_TKQlam3-zi3wRl78mq8enH4PCAbWLG7Vb4tu4F2_7OiiX4eTc43dzS_sAkBYB0Fe9vj4niBx0DNvVoVx0FP6XnUeRtZRh51Ek2wsBi7rVRVGLKixKVhdFbioaR5H80ChS9jZUNjbUvb5_Thw46Bi1q0O56Cg8qDqPA2spo87jQLVnRIu61cVBiyosSlYXB24qGseB-tA40PY21DY29Hv5McI5Dhx0jNvVoVx0FB7UnceBtZRx53Gg2zOiRd3q4qBFFRYlq4sDNxWN40B_aBz49jb0bWwY9M4JAwcVV22qUC4qCv_5nUeBtZSrzqPAb8-EFnWri4IWVViUrC4K3FQ0jgL_p32zOKHr3qTbeJMaqy8Sg8PKzPLRHCuVxrtkYb4k8SKf5ji8y7n8wtKk2fGuPg4mm-Otg8C3sGRhxcOqDMu3sP8Olm6wVI3oqya0GjahteZpzdJBE1g2mloNGtGjJrQGm8Vntyn4vwIHWJXhIQuDRY94aw55e41ZWkqevuLpAciFSqq4eBvQyNwIB-4GOLI3wJG_ZSVSXQwOaORwgCOLIxxsd4Ajk8tKsL7fsgivRAyHV4wu-YxBS-dDRo6B3fiYkSOAV4LGya08Dd0KcORWHodu5XHo1krIOrmVp6FbeRy6FeBoy_I4dCv_glESNFF821rCK25VfOMKlq74pFEB6Hv5pFE-wCtJ49Q38zRsnAGOOmceh60zjyO3qkrKurgV0MitAEduRTjasjyO3Kr4F4waA5zvZEt41a18K4uWzieNBqdUDQ7IoI_WfFMD6g5o5FaEA7cCHLkV4PCkyx-U0VEXHPGbTQ4PuwBHp13wjQDtGv4Fo1Hp-Fa2hFfcqvletrz0h9df_g8AAP__x5IlpA== subtest Except # Basic EXCEPT ALL and EXCEPT case. query T -SELECT url FROM [EXPLAIN (DISTSQL) (SELECT y FROM xyz) EXCEPT ALL (SELECT x AS y FROM xyz) ORDER BY y] +EXPLAIN (DISTSQL) (SELECT y FROM xyz) EXCEPT ALL (SELECT x AS y FROM xyz) ORDER BY y ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJy8lt9vok4QwN-_fwWZpzbfNbAL-IPkEnutlzPxak986KXhgcpeNbHCLZhIG__3i1ivRewOK8pbKfvZHWY-4-wrxH_m4IDbG_Sux9pSzLVvo-EP7aF3fze46t9qFzd9d-z-HFxqF29r0u2KVfpyqfXur3t3Y-1qMPj3eqVdubk1w9FNb6R9_aWlHhBYhAG_9Z95DM4DUCDAgIAJBCwgYINHIBLhhMdxKDZLXjOgH6zAMQjMFtEy2fzbIzAJBQfnFZJZMufgwNh_nPMR9wMudAMIBDzxZ_PsmFX60o3E7NkXKRBwI38RO1pD35w8XCaO1mXgrQmEy-Rt-_ddH1Nt6sfT_H5dCt7aIxAn_hMHh67JcWHaimHSSmGyT8N832e5CEXABQ9yO3kbElty4Fu_-_HU5ckw0uleRcZpxJ0P9gCBOf-dXHTp5Rcxe5pmf3363e_fZKqk3g1FwoVO7f00_f_p_laJnB1Kx9umB4K4DRthpDNjP8EHj7dzx9PyZtESZumsoZtnaQGFQJvKgZ6yCWi9TUDraAIk-bsmaB7bBKx8cVmZ4poN3TqLhQqBtpQDPaWFrF4LWR0WIsnfWdg61kKzfHHNMsW1Gtk0Pr2FCoG2lQM9pYVmvRaadViIJH9nYftYC63yxbXKFNdunMVBhTA7imGe0kCrXgOtOgxEUr8zsHOKK-mB_Uc8jsJFzEvdNo1NwnjwxLcFiMOlmPA7EU6yY7aPw4zLbhkBj5PtW7Z96C-2rzYBlodbVWBKK9F2Jbojp6lCzpga3KoC7-VMlbYr0R05zfZp4yNt5mBjHzalsCWvliWFGZUfbVfpDzmM9IccxvoDoZH-QGikP5pV-kMOI_0hh7H-QGikPxAa6Y-W1NK2XNJ2lf7oVDFcDiOGy2HMcIRGDEdobAKojM3iL6nK3FSl0SGgNDmVcURzWpgiOVUpk4tO5WMEMZ0W5oiK6giNuI7QmOwYjtiO4ZjuhRmqpLucxnSX06juCI7pjuCY7oVBmte9iehemClKuhdmipLuchrTXU6juiM4pjuCY7oX5qmS7nIa011Oo7ojOKY7gmO6F6Zq_q5tyHVnhdki1d1b__c3AAD__2zTeK0= +distribution: full +vectorized: true +· +• sort +│ order: +y +│ +└── • except all + │ + ├── • scan + │ missing stats + │ table: xyz@primary + │ spans: FULL SCAN + │ + └── • scan + missing stats + table: xyz@primary + spans: FULL SCAN +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJy8lt9uokAUh-_3Kci5arNjYAbwD8kmdls3a-LWrnjRzYYLKrPVxAo7YKJtfPcNWLdF7BxGlLtS-GYOZ76fhxeI_87Bgd793eCqf6td3PTdsftzcKlduL1B73qsrbVvo-EPbbV-vtR699e9u7F2NRj8v73SrtzcM8PRTW-kff2lrYHAIgz4rf_EY3B-AwUCDAiYQMACAjZ4BCIRTngchyJ95CUD-sEKHIPAbBEtk_TfHoFJKDg4L5DMkjkHB8b-w5yPuB9woRtAIOCJP5tn26zWz91IzJ58kVbgRv4idrSGnu48XCaO1mXgbQiEy-R1-bdVH9ba1I-n-fW6FLyNRyBO_EcODt2Q48q0FcuklcpkH5b5ts5yEYqACx7kVvJSEnvkwLt-9-Opy5NhpNO9ExmvI-68kwcIzPmf5KJLL7-I2eM0--vD9357J1Ol9W4oEi50au-36fOH61slenaoHa-LHijiNmyEkc6M_QYf3N7ObU_Lm0VLmKWzhm6eJQIKhTaVCz1lCGi9IaB1hABp_i4EzWNDwMofLitzuGZDt85ioUKhLeVCT2khq9dCVoeFSPN3FraOtdAsf7hmmcO1Gtk0Pr2FCoW2lQs9pYVmvRaadViINH9nYftYC63yh2uVOVy7cRYHFcrsKJZ5SgOteg206jAQaf3OwM4pPkkPrD_icRQuYl7qa9NIG8aDR749gDhcigm_E-Ek22Z7Ocy47Csj4HGyvcu2F_3F9lZaYHm4VQWmtBJtV6I7cpoq9Iypwa0q8F7PVGm7Et2R02yfNt7TZg429mFTClvy07KkMKPyre0q-ZDDSD7kMJYPhEbygdBIPppV8iGHkXzIYSwfCI3kA6GRfLSklrblkrar5KNTxXA5jBguhzHDERoxHKGxCaAyNou_pCpzU5VGh4DS5FTGEc1pYYrkVKVMLjqVjxHEdFqYIyqqIzTiOkJjsmM4YjuGY7oXZqiS7nIa011Oo7ojOKY7gmO6FwZpXvcmonthpijpXpgpSrrLaUx3OY3qjuCY7giO6V6Yp0q6y2lMdzmN6o7gmO4IjulemKr5b21DrjsrzBap7t7m078AAAD__2ZMc04= query T -SELECT url FROM [EXPLAIN (DISTSQL) (SELECT y FROM xyz) EXCEPT (SELECT x AS y FROM xyz) ORDER BY y] +EXPLAIN (DISTSQL) (SELECT y FROM xyz) EXCEPT (SELECT x AS y FROM xyz) ORDER BY y ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJy8mF1v4kYYhe_7K6y5SlQjMzPmy1KlpBuqRqIhBS62WnHhhWmCxGJqGylslP9eAcs6ePB7ZmKbuyT48Ry_zHk0zitL_luygI37g_6nibOJl84fo-Ffzpf-58fB7f2Dc3V3P56M_x5cO1c_rtkernjZfr92-p8_9R8nPz96cW7HJ58PR3f9kfP7P852yly2iubqIfymEhZ8YZy5TDCXSeYyn7msxaYuW8fRTCVJFO8ued0D9_MXFjRdtlitN-nuz1OXzaJYseCVpYt0qVjAJuHXpRqpcK5ir8lcNldpuFjul3nZfr9Zx4tvYbxlLhuvw1USOA1vt_JwkwbOjWDTN5dFmzS7fZKGT4oF_M39WISWZQReGEHYRLhbJOliNUs9npuBtkDGfN06z2HyfOb6LIT8WIhWpSH8whDZfTarKJ6rWM1P7rS_S2FMgWaVRWjVFQFNKovQLhHB_VDKP8PkeazS4dqTuUlNtmsVHA1wOxgwly3Vv-nVDb_-LV48Pe9_MtjjHZvtNY7iVMWe1Eb2a-H9uwYzOzeOHzc9E-IhakRrz2_mB3x2-d7J8tzcItzAIp5oeNJaZRYh2tYhTGUGQmQe4TXKzDhEu0aZ8epMgmZVJLMKI6BJFcnMLkJpmfFLyAxsr6PMtJGZykyYF1mYFFk2PN_aJhYhOtYhTG0CQmRFFjXaxDhEp0abiOqqjGZVZJMKI6BJFdnELkJpm4hL2ARsr6NNtJGZ2kSaF1maFNlv7N-E7GxiEaJrHcLUJiBEVmRZo02MQ3RrtImsrspoVkU2qTACmlSRTewilLaJvIRNwPY62kQbmalNfPMi-yZFbjWsXWIRoWcZwdQkIEJWYr9GkxiH6NVoEr-6GqNZFZmkwghoUkUmsYtQ2iT-JUwCttfRJNrIPvIvmzP3H6lkHa0SZfTfmOZuYGr-pA5fQBJt4pl6jKPZfpnDr8M9t__DXCXp4VNx-OV-dfhoF_A9zElY0rDIw_w97J_A3A7msgwteCm6V4aWHZqWJN0qA3MwcpoWogwtm6XoLk375DZt03DLAhZ5uE3CHbogHRIGz9wlYZ_TS_dImgOa01LhyCqaVmzMAGikBoAjNyAcyAHgyA6clgvQA6CRHwCOBAFwZAiEg7pwzTCnWxaNjlZMDtc0wWnJ8DYoDK0Z9Oi0Z3gPLE6bRjQBrqnGquw0DctO47DsAEdlp3FUdqFZ1qbsgEZlBzgqO8BR2REOdrygz60CnR411VC4VnZBq0b44NhMqwY9Om0aAY4kgjaN6AJcU43VmZ-m4aGfxuGpH-Do2E_jsOyaZa3KTtOw7DQOy07jsOwARzuePstK8LVL-iybw7WyS_CKDI7CklYNeHRJm0a2wOK0aSQ4lUhNNTZlBzQqO8BR2REOyg5w-JKvWdbqLZ-m4Ws-jcP3fBqHL_oARzuePstK9L3RZ9kcrpedVo0PjsI-rZr8o0_ffvk_AAD__5BZB70= +distribution: full +vectorized: true +· +• sort +│ order: +y +│ +└── • except + │ + ├── • scan + │ missing stats + │ table: xyz@primary + │ spans: FULL SCAN + │ + └── • scan + missing stats + table: xyz@primary + spans: FULL SCAN +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJy8mF1v4kYYhe_7K6y5SlQjMzPmy1KlpBuqRqIhBS62qnLhhWmCxGJqGylslP9eYcp68eD3zMQ2d0mcx3P8MufRmDeW_LtiARt-fhzd3j84V3f309n0z9G1czUdjoafZs7O-W0y_sN53X27doafPw0fZ98vvTq305Pr48ndcOL8-pezYy5bRwv1EH5VCQv-Zpy5TDCXSeYyn7msw55ctomjuUqSKN7_y1sG3C9eWdB22XK92ab7Pz-5bB7FigVvLF2mK8UCNgu_rNREhQsVe23msoVKw-UqW-Z19-1mEy-_hvE-wXQTrpPAaXn7lcfbNHBuBHt6d1m0TfPbJ2n4rFjA392PRehYRuClEYRNhLtlki7X89TjhRloC-TMl53zEiYvZ_4_DyE_FqJTawi_NER-n-06ihcqVouTO2V3KY0p0KzyCJ2mIqBJ5RG6FSK4H0r5e5i8TFU63niyMKnZbqOCowBuRyPmspX6J7264de_xMvnl-wngz3es9le0yhOVexJbWQ_l96_bzCzc-P4_6ZnQjxErWjj-e3igM8uPzhZnptbhBtYxBMtT1qrzCJE1zqEqcxAiNwjvEGZGYfoNigzXp9J0KzKZFZjBDSpMpnZRagsM34JmYHtdZSZNjJTmQnzIguTIsuW51vbxCJEzzqEqU1AiLzIokGbGIfoNWgTUV-V0azKbFJjBDSpMpvYRahsE3EJm4DtdbSJNjJTm0jzIkuTIvut7E3IziYWIfrWIUxtAkLkRZYN2sQ4RL9Bm8j6qoxmVWaTGiOgSZXZxC5CZZvIS9gEbK-jTbSRmdrENy-yb1LkTsvaJRYRBpYRTE0CIuQl9hs0iXGIQYMm8eurMZpVmUlqjIAmVWYSuwiVTeJfwiRgex1Noo3sI1_ZnLn_RCWbaJ0oo29j2vuBqcWzOnwASbSN5-oxjubZModfxxmX_WGhkvRwVRx-uV8fLu0D_ghzEpY0LIow_xH2T2BuB3NZhRa8Ej2oQsseTUuS7lSBORg5TQtRhZbtSnSfpn1ym3ZpuGMBiyLcJeEeXZAeCYNn7pOwz-mlByTNAc1pqXBkFU0rNmYANFIDwJEbEA7kAHBkB07LBegB0MgPAEeCADgyBMJBXbhmmNMti0ZHK6aAa5rgtGR4FxSG1gx6dNozfAAWp00j2gDXVGNVdpqGZadxWHaAo7LTOCq70CxrU3ZAo7IDHJUd4KjsCAc7XtDnVoFOj5pqKFwru6BVI3xwbKZVgx6dNo0ARxJBm0b0Aa6pxurMT9Pw0E_j8NQPcHTsp3FYds2yVmWnaVh2Godlp3FYdoCjHU-fZSX42CV9li3gWtkleEUGR2FJqwY8uqRNIztgcdo0EpxKpKYam7IDGpUd4KjsCAdlBzh8ydcsa_WWT9PwNZ_G4Xs-jcMXfYCjHU-fZSX63OizbAHXy06rxgdHYZ9WTfHRn95_-i8AAP__7rUCXg== # EXCEPT ALL and EXCEPT with MergeJoiner. query T -SELECT url FROM [EXPLAIN (DISTSQL) (SELECT y FROM xyz ORDER BY y) EXCEPT ALL (SELECT y FROM xyz ORDER BY y)] +EXPLAIN (DISTSQL) (SELECT y FROM xyz ORDER BY y) EXCEPT ALL (SELECT y FROM xyz ORDER BY y) ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJy8lkFv2jAYhu_7FdZ3aiWjYCfQEmkSXcs0JFY64NCpyiElXkGiJLOD1LTiv0-Eai0B_MXz6lspfuzXnx-J9wXU7wWEMO4NepcTspIL8nU0_E7uerc3g4v-NTm56o8n4x-DU3LyuqbYrngqnslwdNUbkS8_SXFKereXvZsJuRgMkJURUFimibiOH4WC8A4YUOBAwQcKAVBoQUQhk-lUKJXKzZKXEugnTxA2KcyX2Srf_DuiME2lgPAF8nm-EBDCJL5fiJGIEyG9JlBIRB7PF-UxT8VzN5Pzx1gWQGGcxUsVkoa3OXm4ykPS5RCtKaSr_HX7t13vCzKL1Wx3vy6DaB1RUHn8ICBka_pvMVtOY_KjMd_2WS1TmQgpkp2dog2JLTlw12-xmo1FPsw8VnmRSZGJ8J04QGEhfuUnXXb6Wc4fZuVff-_NKvd-u5NvcacDga_TRpp5rFW9_cGzg52zWf1nZzWe3eMNz_8QPw2Cth0H5UeDOjCUuTCU1x8-rzN8v-EFH2KJQdAzx0H50aAOLOEuLPHrD9-vM_ygUf7U_H9LDIKeOw7KjwZ1YInvwpKg_vCDOsNvNT7EEYOYHacx-dGYDgwJXPehA3FGQmXpUolabae5uZBIHsR2QCpdyam4kem0PGb7cVhy5S93IlS-_ZZvP_SX2682AevDbRu4YwMzq9yspaeZwci4Gdy2gTs2MLPKXRnZHs2rdPM97evn7WthtjuzZpUObATXw4jgehgRXA9jgiM0InjLRnA9jAiuhxHB9TAmOEIjgrdtBD-zUVQPI4rqYURRPYwpitCIouc2iuphRFE9jCiqhzFFERpRtGOjKLPqCQiNSIrQiKUIjWmK4VhXsCsLdm3Bri5Y9gW7wsCsGgPbqwxGtuppzFY9jdmqp1FbERyz1aQs7b-ZSVsypTFbjfqSMY7ZulcetLZG609_AgAA__-lH3W3 +distribution: full +vectorized: true +· +• except all +│ +├── • scan +│ missing stats +│ table: xyz@primary +│ spans: FULL SCAN +│ +└── • scan + missing stats + table: xyz@primary + spans: FULL SCAN +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJy8lkFv2jAYhu_7FdZ3aiWjYCfQEmkSXcs0JFY64NBpyiElXkGiSRYHqWnFf58SprUE8BfPw7fS5LFff36kvK8gf63Ah8H93ehqeEvObobT2fTb6JycTQejwfWMFOTzZPyVPBcvZDy5GUzIp--kOCeD--vB3YxcjUbIm0AhTiJxGz4JCf4PYECBAwUXKHhAoQMBhTRL5kLKJCtfea2AYfQMfpvCMk7XefnvgMI8yQT4r5Av85UAH2bhw0pMRBiJzGkDhUjk4XJVbfNcvPTTbPkUZgVQmKZhLH3Scsqdx-vcJ30OwYZCss7_LP-26kNBFqFc7K7XZxBsAgoyDx8F-GxD_y1mx2pMfjTm2zrrOMkikYloZ6WgJLFXDpz1SygXU5GPU4fVbmRWpMJ_5w1QWImf-VmfnX_Mlo-L6q-_52a1c7-dyTU404HAt0krSR3WqZ_-4N7ezt6s-bWzBtfu8JbjnsRPjaBdy0H50aAWDGU2DOXNh8-bDN9tOd5JLNEIemE5KD8a1IIl3IYlbvPhu02G77WqT83_t0Qj6KXloPxoUAuWuDYs8ZoP32sy_E7rJI5oxOxZjcmPxrRgiGe7Dx2IMxEyTWIpGrWddnkgET2K7YBkss7m4i5L5tU225_jiqu-3JGQ-fYp3_4YxttHZcDmcNcE7pnAzCg366hppjEyrgd3TeCeCcyMctdGtkfzOt1-T7vqebtKmO3OrF2nPRPB1TAiuBpGBFfDmOAIjQjeMRFcDSOCq2FEcDWMCY7QiOBdE8EvTBRVw4iiahhRVA1jiiI0ouiliaJqGFFUDSOKqmFMUYRGFO2ZKMqMegJCI5IiNGIpQmOaYjjWFczKgllbMKsLhn3BrDAwo8bA9iqDlq1qGrNVTWO2qmnUVgTHbNUpS_t3ptOWdGnMVq2-pI1jtu6VB6WtwebD7wAAAP__fn1wWA== query T -SELECT url FROM [EXPLAIN (DISTSQL) (SELECT y FROM xyz ORDER BY y) EXCEPT (SELECT y FROM xyz ORDER BY y)] +EXPLAIN (DISTSQL) (SELECT y FROM xyz ORDER BY y) EXCEPT (SELECT y FROM xyz ORDER BY y) ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJy8mNFu4kYUhu_7FNa5SiQjmBkbiKVK2W6oGomGFLjYasWFF08TJBa7tpHCRnn3CtPWiR2f3xPb3AXw5_nnZL7DMc-U_L0ljxaT6eTz0trHW-vX-ex36-vky_300-2ddXFzu1gu_pheWhf_XnM4XfF0-GHN5jeTufXLn9bh0pp8-Ty5X4KrVmTTLgz0nf9dJ-R9JUE2SbJJkU0O2eTSyqYoDtc6ScL4eMlzBtwGT-QNbNrson16fHtl0zqMNXnPlG7SrSaPlv63rZ5rP9Bxf0A2BTr1N9tsmafDj-so3nz34wPZtIj8XeJZvf5x5dk-9axrSasXm8J9mt8-Sf0HTZ54sT8WwW0tgjSJcLNJ0s1unfZFoQbXorBAznw7WI9-8vjO9XkI9bEQbqshnMoQ-X32uzAOdKyDN3fK7lIZU6Ja5RHcriKgSuURhg0i2B9K-ZufPC50Oov6qlCp5SHS3n_yf5pOyaat_iu9uBaXP8ebh8fsr__PePWeRu2W9S7shVFfucXdv7v2-M3aor7ioobifdnrK-M-YxBi2GIIaRIil1x02Glqhxh22GlEe5qjWlV1mhYjoEpVdRqzCI07jThHp5H1RZN1RFO9vmNsu0GIUYshpEmIXDTZoe21Q4w6tF22pxqqVZXtLUZAlaqy3SxCY9vlOWxX9UVTdURzetmYb2a7QYhxiyGkSYhcNNWh7bVDjDu0XbWnGqpVle0tRkCVqrLdLEJj29U5bHfqi-bUEc3tGbtuEOGqtQjSJEIumdOh6bVDXHVoutOeZqhWVaa3GAFVqsp0swiNTXfO_XvBO3HmOonCXaJr_RowOG5IBw_6VKAk3MdrfR-H62yZ08tZxmVvBDpJT5_K04vb3emjY8DXsGBhxcOyCIvXsPMGFmawkI3oqya0HDahleJpxdJuE1g0WloOGtGjJrQCh8Vhjyn4f7kGsCzCQxYGmx7xdg15vcYsLQY8fcXTAvSFUlcxcRvQSG6EA7sBjvQGOPJblFqqieCARoYDHCmOcHDcAY4kF6XG-vbIIrzUYji8JLrgewzaOt9kxAjoxrcZMQZ4qdEY2crT0FaAI1t5HNrK49DWUpM1spWnoa08Dm0FODqyPA5t5b9gpABDFBhbBW-r5AdXsHXJdxrpgLmX7zTSBXip0xjNzTwNB2eAo8mZx-HozOPIVlnqsia2AhrZCnBkK8LRkeVxZKvkv2DkGOD8JFvAy7byoyzaOt9pFBhlFd9pFHhCVvxQA-oOaGQrwoGtAEe2Ahw-6fIPyuhRFzziN1scPuwCHD3tgt8I0Knhv2AUKh0_yhbwkq2Kn2WLW1-9_PRPAAAA___Flwb8 +distribution: full +vectorized: true +· +• except +│ +├── • scan +│ missing stats +│ table: xyz@primary +│ spans: FULL SCAN +│ +└── • scan + missing stats + table: xyz@primary + spans: FULL SCAN +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJy8mNFu4kYUhu_7FNa5SiQjMzM2EEuVst1QNRINKXCxVZULL54mSCx2bSOFjfLuFUatN3Z8fk9sc7cBPs8_Z-c7nOGF0n-25NP0y_3s0-2ddXFzu1wt_5hdWhfL6Wz6eWUdrF8X89-t58N3a764mS6sX_60DpfW9Mvn6f0KfIps2kWhvgu-6ZT8v0iQTZJsUmSTSzZ59GBTnERrnaZRcvzISw7chs_kD23a7OJ9dnz5waZ1lGjyXyjbZFtNPq2Cr1u90EGoE2dINoU6CzbbfJnnw_frONl8C5ID2bSMg13qWwPnuPJ8n_nWtaSHV5uifVY8Ps2CR02-eLU_FsHrLII0iXCzSbPNbp05olSDa1FaoGC-HqynIH165_NFCPWxEF6nIdzaEMVz9rsoCXWiwzdPyp9SG1OiWhURvL4ioEoVEUYtItgfSvlbkD4tdTaPHVWq1OoQa_8_9z_NZmTTVv-dXVyLy5-TzeNT_q__z3j9nsbdlvUuGkSxo7zy7t9de_JmbdFccdFAcUcOHGXcZwxCjDoMIU1CFJKLHjtN4xCjHjuN6E5zVKu6TtNhBFSpuk5jFqF1pxHn6DSyuWiyiWhq4LjGthuEGHcYQpqEKESTPdreOMS4R9tld6qhWtXZ3mEEVKk6280itLZdnsN21Vw01UQ0d5CP-Wa2G4SYdBhCmoQoRFM92t44xKRH21V3qqFa1dneYQRUqTrbzSK0tl2dw3a3uWhuE9G8gbHrBhGuOosgTSIUkrk9mt44xFWPprvdaYZqVWd6hxFQpepMN4vQ2nT33L8XvBNnodM42qW60a8Bw-OGdPioTwVKo32y1vdJtM6XOf05z7n8hVCn2eldefrjdnd66xjwR1iwsOJhWYbFj7D7BhZmsJCt6Ks2tBy1oZXiacXSXhtYtFpaDlvR4za0AofFZY8p-P_yDGBZhkcsDDY95u0a8XpNWFoMefqKpwXoC5WuYuI2oJHcCAd2AxzpDXDkt6i0VBPBAY0MBzhSHOHguAMcSS4qjfXtkUV4pcVweEV0wfcYtHW-yYgx0I1vM2IC8EqjMbKVp6GtAEe28ji0lcehrZUma2QrT0NbeRzaCnB0ZHkc2sp_wUgBhigwtgreVskPrmDrku800gVzL99ppAfwSqcxmpt5Gg7OAEeTM4_D0ZnHka2y0mVNbAU0shXgyFaEoyPL48hWyX_ByAnA-Um2hFdt5UdZtHW-0ygwyiq-0yhwQ1b8UAPqDmhkK8KBrQBHtgIc3nT5izK66oIrfrvF4WUX4Oi2C34jQKeG_4JRqHT8KFvCK7YqfpYtb_3h9ad_AwAA__--BQGd # EXCEPT ALL and EXCEPT with no overlap. query T -SELECT url FROM [EXPLAIN (DISTSQL) (SELECT x FROM xyz WHERE x < 2) EXCEPT ALL (SELECT x FROM xyz WHERE x >= 2) ORDER BY x] +EXPLAIN (DISTSQL) (SELECT x FROM xyz WHERE x < 2) EXCEPT ALL (SELECT x FROM xyz WHERE x >= 2) ORDER BY x ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJzEmF1v2kgUhu_3V4zOVaI1MjNjvixVSrelKhIbsoC0XXW5cGE2QaKYHRsJGuW_V4aGBEzm9QFC7gr4mTl9Oc-ZIfeU_D-hkHrNdvNDX8ztRHzqdv4UX5tfbtrvW9fi4mOr1-_91b4UF7-eWayfWCx_iL8_N7tNsRD_zstlPRTqUjS_fGje9MX7dhs-b95lQKf7sdkVf_wjFgPyaBqPzHX03SQUfiVJHinySJNHAXlUoYFHMxsPTZLENnvkfgW0RgsKyx6Np7N5mr098GgYW0PhPaXjdGIopH70bWK6JhoZ65fJo5FJo_Fktc1i-eNqZsffI7skj3qzaJqEouRnO3fmaSiuJA0ePIrn6dPySRrdGgrlg1e8hE_jSWqssX5le__1-9k-mxzDMGxd9-s7-z4t9W0p7qLkbnudVZ1PtSlObc_jkafLRx-UjwQBZY1zioSCF6t7Wmc-je3IWDPaWmmQkeiRPf_Fz1Fy1zNpZ-arnZD7y5kJn9lDHk3Mf-nFlbx8Z8e3d6t_FUi8wkm8F9vUWF9VdmP6_cX1qwUy2xfHr0X3FHEdl-KZr8u7Ae_dvra1vWQ0dYGe9lXJ12zrQRGbrq6-gfWcgE6ZkD4oIQkieh3v5Xm9l-fwHiT-6H31UO9V8b5SRdpKl_yALR4oYtNWtTcQjxGQPGVC-qCEJIjodcRT5xVPnUM8kPijeLVDxdPF-0oXaaugtLqN8sQDRWzaqv4G4jECkqdMSB-UkAQRvY54-rzi6XOIBxJ_FK9-qHhB8b4KirRVpcTWDpSwaarGG2jHiEeeLh99UD4SBPQ60gXnlS44h3Qg8UfpGqf4ebln_a5JZvE0MYV-OZazwMzo1qy_gCSe26G5sfFwtc36ZWfFrd4YmSRdfyrXL1rT9UdZgc9huQvL53CwBUseLOVRdO0YWumj6IabVs7EtTtxzUhc8eCdxLl07Rh6J3Eu3XDTgTPxijvxihOuur_rqvu7BnrVnHTdDdePcdMNIzcBDdx008hNQAM3G-5pWAbjMDdMOXYCGumJcOAnwJGgCAeGytxI3Q5egeDdMxVIKnPTZXvzAGyeGy-sU9BNw2MQ4OgcdOPwIAQ4sE26Z6usguBz05Wlm5uGugEc6ebGoW4AR7q5TxYJjhaZG7Is3dxDVoEhqzhDNn_5Yg1ZNg50AzjSDeHo4ukesgoMWZUbshzdAI10QzjQDeBIN4QD3ZT7gFHggFHu-yvQTbmHrAJDVnGGbH5z1pBl40g31pBl40g395BVYMgqzgU-33KsGzwbR7qx7vBsHOnmPmA0OGC0-08iu7oNHn77GQAA___NrNLZ +distribution: full +vectorized: true +· +• sort +│ order: +x +│ +└── • except all + │ + ├── • filter + │ │ filter: x < 2 + │ │ + │ └── • scan + │ missing stats + │ table: xyz@primary + │ spans: FULL SCAN + │ + └── • filter + │ filter: x >= 2 + │ + └── • scan + missing stats + table: xyz@primary + spans: FULL SCAN +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJzEmF1v2kgUhu_3V4zOVaI1MjNjvixVSrelKhIbsoC0Xe1y4cJsgkQxaxsJGuW_rwwNCZjO62OIuSsfz8zp6_OcGfJI8X8z8qn95a77vnMrrj52BsPBH91rcTVod9sfhmIlPvV7v4vV-rv483O73xYr8c-yWtVjoa5F-8uH9t1QvO924ffNuxTo9T-2--K3v8SKHJqHE3MbfDMx-X-TJIcUOaTJIY8cqtHIoUUUjk0ch1H6lccN0JmsyK86NJ0vlkn69sihcRgZ8h8pmSYzQz4Ng68z0zfBxERulRyamCSYzjbbrNbfbxbR9FsQrcmhwSKYx76ouOnOvWXiixtJoyeHwmXysnycBPeGfPnk5C_h03SWmMhEbm1__-376T67GH3f79wOmwf7viz1dS0egvhhf51NnS-1KU5tr-OR58tHF8pHgoDSvjlHQt5Pq3tZZzkPo4mJzGRvpVFKoq8c-S9-DuKHgUl6C1cdhDxcL4z_Sh5yaGb-Ta5u5PW7aHr_sPlXjsRrnMQHYZSYyFW1w5h-_en69RyZHYvjx6JHirgNK-HC1dXDgI9u39jbXjKaOkdPu6riarb1oIhdV9cvYD0noHMmpAslJEFEb-O9LNd7WYb3IPFn7-tFvVf5-0rlaStdcT22eKCIXVs1LiAeIyB5zoR0oYQkiOhtxFPliqfKEA8k_ixeo6h4On9f6Txt5VU2t1GeeKCIXVs1LyAeIyB5zoR0oYQkiOhtxNPliqfLEA8k_ixes6h4Xv6-8vK0Va3C1g6UsGuq1gW0Y8Qjz5ePLpSPBAG9jXReudJ5ZUgHEn-WrnWOn5dH1u-beBHOY5Prl2M1DcxM7s32AcThMhqbuygcb7bZvuxtuM0bExMn20_l9kVnvv0oLfA1LA9h-Rr29mDJg6U8iW6cQit9Et2y08qauLYnrhmJKx58kDiXbpxCHyTOpVt22rMmXrMnXrPCdfuzrtufNdCrYaWbdrh5ipt2GLkJaOCmnUZuAhq42bJPwyoYh5lhyrET0EhPhAM_AY4ERTgwVGZG6n7wCgRvn6lAUpmZLvube2DzzHhhnYJ2Gh6DAEfnoB2HByHAgW3SPltlHQSfma4s3ew01A3gSDc7DnUDONLNfrJIcLTIzJBl6WYfsgoMWcUZstnLF2vIsnGgG8CRbghHF0_7kFVgyKrMkOXoBmikG8KBbgBHuiEc6KbsB4wCB4yy31-Bbso-ZBUYsoozZLObs4YsG0e6sYYsG0e62YesAkNWcS7w2ZZj3eDZONKNdYdn40g3-wGjwQGj7X8SOdRt9PTL_wEAAP__Gz3Neg== query T -SELECT url FROM [EXPLAIN (DISTSQL) (SELECT x FROM xyz WHERE x < 2) EXCEPT (SELECT x FROM xyz WHERE x >= 2) ORDER BY x] +EXPLAIN (DISTSQL) (SELECT x FROM xyz WHERE x < 2) EXCEPT (SELECT x FROM xyz WHERE x >= 2) ORDER BY x ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJy82Ftv2kgbB_D791NYc5XoNTJzMAdLldJtqIrEhiwgbVddLijMJkgUs7aRoFG--wooOBz8_D2MnbuG-O_n0PFPxC8s_nfGAtZvdVqfBs4ymjmfe93fnW-tr4-dj-0H5-a-3R_0_-jcOje_rlntrlitfzp_fmn1Ws7K-XtZrcqxI26d1tdPrccBvFZ_2Fzc7d23es5vfzmrIXPZPJzoh9EPHbPgG-PMZYK5TDKXKeYynw1dtojCsY7jMNpc8rINtCcrFlRdNp0vlsnm46HLxmGkWfDCkmky0yxgg9H3me7p0URHXpW5bKKT0XS2LbNa_7xbRNMfo2jNXNZfjOZx4FS8TeXuMgmcO86Gry4Ll0l6-zgZPWkW8Fc3fwufp7NERzry_OP6u883dQ47DIKg_TBoZNYVJnXfjs6Lm11eNTsHw28OBZpemVS-n8bJdD5OPHEy-tloaeb72nkexc8Xrk-b8K9rwi-0iVpmE-l9lvMwmuhIT47utL1LZpsS7SptoV5WC2hTaQsNixbcq7r8Moqf-zrpLjx1sqnBeqGDvYAfOx3mspn-J7m547cfounT8_ZfOZ6upsnx6odRoiNPna3s_9lyVXMs7dI-ft31QhcPYSVceH71dMOX6x_TyQ0IyyGYJyqeNPYbNHEwrFaw3ybDFzm9vGp6DsY3FxxUTvHkJQqeu4laiYLz4vhEu8oSvMAW0KayBDdrwVpw_h6Cg-O1F_xsZbkFF_kREXkMkRVPGQsKmjgYUi9YUIPheZHTy6um52B8c0FB5RQvUaKguZuolyioKI4vtKssQQtsAW0qS1CzFqwFFe8hKDhee0HPVpZbUJkfEZnHEFXZ_qVvJiho4mBIo2BBDYbnRU4vr5qeg_HNBQWVU7xkiYLmbqJRoqCyOL7QrrIELbAFtKksQc1asBZUvoeg4HjtBT1bWW5BVX5EVB5D_Iqxn6CFgyDNgv00GJ0XN7u8anYOhjfXE1RO4VIl6pm7iWaJeqri6EK7ytKzwBbQprL0NGvBWk_1HnqC47XX82xlV72DvVCgp-NFOI91rter1c3G9ORJ7_4H4nAZjfVjFI63ZXY_dre57QcTHSe73_LdD-357lebBt-GORlWdFiQYUmHJRn26bA6DfO34dpRmJuFed0mLazS0iqtQNon01Zh3rBJC6u0tEorkK6RxxSE6wZhcRpukOEm_YA0aRSqdN-cNsVHqNCqcAHitCsc2MBpWThAjZ89ZMfxGojTxw3QBNLIJhBHOIE40gnEEU_87FEz8QmkEVAgjoQCcUQUiCOjOO0Mb4I4Lc1J_MwpTlsjquBLBPj-AqgStDUCWCNoawSwRtDWCPQFirZGAGuElTUgjawBcWQNiCNrQBxZI6ysAWlkDYgja0AcWQPiyBpBWyOANYK2RgBrBG2NBNZIO2skbY0E1kjw9xKwRtLWSGCNpK2RwBppZQ1II2tAHFkD4sgaEEfWSCtrQBpZA-LIGhBH1oA4skbS1khgjaStkcAaSVujgDXKzhoF3swAaxRtjULvV2hrFLBG0dYoYI2ysgak4fsdO2tAHL7hsbNGWVkD0sgaEEfWgDiyBsSRNYq2RgFrFG2NAtYo2hofWOMbWjN8_d9_AQAA__8QPmF0 +distribution: full +vectorized: true +· +• sort +│ order: +x +│ +└── • except + │ + ├── • filter + │ │ filter: x < 2 + │ │ + │ └── • scan + │ missing stats + │ table: xyz@primary + │ spans: FULL SCAN + │ + └── • filter + │ filter: x >= 2 + │ + └── • scan + missing stats + table: xyz@primary + spans: FULL SCAN +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJy82F9v4kYUBfD3fgprnhLVyMwfE7C0UrYbVotEQwpI3arNAwvTBInF1DYSbJTvXgELDn98j4cZ8rYhHM-5d81PxC8s_W_CItb8-tD-2Lr3ru5avX7vj_a1d9Vrtpuf-t7C-9zt_O4tlj-8P780u01v4f0zr1bl0BPXXvPrp-ZDH75Xf1i9udO9a3a93_7yFsxn03ik7wffdcqivxlnPhPMZ5L5TDGfhezRZ7MkHuo0jZPVW17WgdZowaKqz8bT2Txbvfzos2GcaBa9sGycTTSLWH_wbaK7ejDSSVBlPhvpbDCerI9ZLH_czpLx90GyZD7rzQbTNPIqwerkzjyLvFvOHl99Fs-z_PJpNnjSLOKvfvkKn8eTTCc6CcL98zevr87ZrTCKotZ9v154rjA59-3o3N3s8qzZORh-dU-g6ZXJyXfjNBtPh1kgDkY_Gi3PfFt6z4P0-cT78xLheSVCpyVqhSXy68yncTLSiR7tXWl9lcKaEu0qr3BzqQpoU3mFukUF_6yWXwbpc09nnVmgDjbVX850tAXwY7vNfDbR_2ZXt_z6QzJ-el7_q8Snq2Fye_XiJNNJoI5W9muxXNUSSzu1j59XPdHiPq7EsyCsHm749Pn7dHIDwkoIFohKII39BiV2htUc-20yvMvp5VnTczC-ueDg5BxPfkHBS5eoXVBw7o5PtKsiwR1WQJsqEtysgrXg_D0EB7fXVvCjlZUWXJRHRJQxRFYCZSwoKLEz5MaxoAbDc5fTy7Om52B8c0HByTle4oKCli5xc0FBhTu-0K6KBHVYAW2qSFCzCtaCivcQFNxeW0GPVlZaUFkeEVnGEFVZ_6VvJigosTOk7lhQg-G5y-nlWdNzML65oODkHC95QUFLl6hfUFDpji-0qyJBHVZAmyoS1KyCtaDyPQQFt9dW0KOVlRZUlUdElTEkrBj7CSrsBGk49tNgdO5udnnW7BwMb64nODmHS11Qz9IlGhfUU7mjC-2qSE-HFdCmivQ0q2Ctp3oPPcHttdXzaGVnPYM9cUBXp7N4mupSj1erq43p0ZPe_A-k8TwZ6ockHq6P2fzYWefWL4x0mm1-yzc_tKabX60Kvg1zMqzosCDDkg5LMhzSYXUY5m_Dtb0wNwvzG5u0sEpLq7QC6ZBMW4V53SYtrNLSKq1AukbepiB8YxAWh-E6GW7QH5AGjUKV7s1pU0KECq0KFyBOu8KBDZyWhQPU-NGHbD9eA3H6dgM0gTSyCcQRTiCOdAJxxBM_-qiZ-ATSCCgQR0KBOCIKxJFRnHaGN0CcluYgfuQUp60RVfAlAnx_AVQJ2hoBrBG0NQJYI2hrBPoCRVsjgDXCyhqQRtaAOLIGxJE1II6sEVbWgDSyBsSRNSCOrAFxZI2grRHAGkFbI4A1grZGAmuknTWStkYCayT4ewlYI2lrJLBG0tZIYI20sgakkTUgjqwBcWQNiCNrpJU1II2sAXFkDYgja0AcWSNpaySwRtLWSGCNpK1RwBplZ40CT2aANYq2RqHnK7Q1ClijaGsUsEZZWQPS8PmOnTUgDp_w2FmjrKwBaWQNiCNrQBxZA-LIGkVbo4A1irZGAWsUbU0IrAkNrXl8_eX_AAAA___oPFwV # EXCEPT ALL and EXCEPT with some overlap. query T -SELECT url FROM [EXPLAIN (DISTSQL) (SELECT y FROM xyz WHERE x >= 1) EXCEPT ALL (SELECT y FROM xyz WHERE x < 3) ORDER BY y] +EXPLAIN (DISTSQL) (SELECT y FROM xyz WHERE x >= 1) EXCEPT ALL (SELECT y FROM xyz WHERE x < 3) ORDER BY y ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJzEmO9v2jgcxt_fX2F9X7W6oGA7_Io0id3GNCSu9ADpdtrxIgNfi8RIzglSWdX_fQJWKAn1Ewca3g3Ix_Ye_Hls-kjx_3PyadjpdT6M2FLP2adB_0_2tfPltve-e8OuPnaHo-FfvWt29euZ1faJh9UP9vfnzqDDHti_y2pVqneMX7POlw-d2xF73-tBYMLkNesPPnYG7I9_2GpMDi3CqboJvquY_K_EySFBDklyyCOHajR2KNLhRMVxqNePPG6A7vSB_KpDs0W0TNZvjx2ahFqR_0jJLJkr8mkUfJurgQqmSrtVcmiqkmA230zzsPrRjvTse6BX5NAwChaxzyrueub-MvFZmzttQeMnh8Jlsp8hToI7RT5_cvKv4tNsniittFs7XML2_fVU-yh93-_ejJq7VaSXsB_124rdB_H94ZBtTuOn_TKFzTJfhsXPmpYslBYHcU2YPG9a3qvL3I-zXIR6qrSaHow0XpPokSP_189BfD9UST9yRSrw0SpS_gutyKG5-i-5avPrd3p2d7_51z79V6Ov2UQ_DHWitCtq6Zh-f3X8eo7MjsXxa9Aji7gJK2Hkymo64KPTNw6m5xYbPMf-dkXFlUX6AKxjt8Prl-0Dm7jOnJcslBcHgb1xI_ByG4GX0Qgg-udGqBdtBJF_j4k8W0xWXK-IkmAduy3WuKySFnHxM-clC-XFQWBvrKQoV0lRhpIg-mclG0WVlPn3mMyzxbzK5mJrrSRYx26LNS-rpEVc_Mx5yUJ5cRDYGyspy1VSlqEkiP5ZyWZRJb38e8zLs8VqlSJCglXsNljrskJahMXPmpYslBYHcb2xjl65Onpl6Aiif9axdY6fsUfGH6g4ChexyvULtboOTE3v1PYLiMOlnqhbHU4202xf9jfc5o2pipPtp3z7orvYfrRe4EuYp2H-EvYOYG4Hc34S3TiFFvIkumWmhTFxaU5cWiQu7OBU4rZ04xQ6lbgt3TLTnjHxmjnxmhGum7_ruvm7Bno1jHTTDDdPcdMMIzcBDdw008hNQAM3W-Y2rII6zJSpjZ2ARnoiHPgJcCQowoGhPFOph8ELELy5U4GkPNMuh5N7YPJMvVidgmYaHoMAR-egGYcHIcCBbdzcrbwOgs-0q5VuZhrqBnCkmxmHugEc6WY-WTg4WnimZK10M5esACUrbEo2e_myKllrHOgGcKQbwtHF01yyApSsyJSsjW6ARrohHOgGcKQbwoFuwnzACHDACPP9FegmzCUrQMkKm5LNTm5VstY40s2qZK1xpJu5ZAUoWWFzgc9uOasbvDWOdLO6w1vjSDfzASPBASPNfxJJ6zZ--u1nAAAA__-_EfGQ +distribution: full +vectorized: true +· +• sort +│ order: +y +│ +└── • except all + │ + ├── • filter + │ │ filter: x >= 1 + │ │ + │ └── • scan + │ missing stats + │ table: xyz@primary + │ spans: FULL SCAN + │ + └── • filter + │ filter: x < 3 + │ + └── • scan + missing stats + table: xyz@primary + spans: FULL SCAN +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJzEmF1v4kYYhe_7K0bvVaIamZkxX5ZWYrvLapFoSAGpW7VcePE0QWKxaxspJMp_rwwbCDaZ4zHE3G0Ij-fdwzxnhjxR_N-CXOp9ux187N-wq8_98WT8x-CaXY17g96nCVuzL6Ph7-xh_cj-_Nob9dgD-2dVr0v1gfFr1vv2qXc7YR8HAwjMmLxmw9Hn3oj99hdbk0XLwFc33g8Vk_s3cbJIkEWSLHLIogZNLQqjYKbiOIjStzxtgL7_QG7dovkyXCXpy1OLZkGkyH2iZJ4sFLk08b4v1Eh5vorsOlnkq8SbLzbLPKwfu2E0_-FF6QTj0FvGLqvZ6crDVeKyLre6gqbPFgWrZL9CnHh3ilz-bBWf4st8kahIRXbjcITt6-lS-yRd1-3fTNq7KbIj7J_6fc3uvfj-8JFdTtPn_ZjCZMzXYfGzpiVLpcVBXDMmz5uW8-aY--eslkHkq0j5B0-apiR6y5H_61cvvh-rZBjaIhP4ZB0q95VVZNFC_Ztcdfn1h2h-d7_51z79N6NvmEQ_DqJERbZoZGP69c3nNwtkdiyOnw89MsRNUAtCW9azAR9dvnWwPDfY4AX2ty1qtizTB2CO3Q5vXrYPTOI6c16yVF4cBPbOjcCrbQReRSOA6F8aoVm2EUTxPSaKbDFZs50ySoI5dlusdVklDeLiZ85LlsqLg8DeWUlRrZKiCiVB9C9KtsoqKYvvMVlkizm1zcXWWEkwx26LtS-rpEFc_Mx5yVJ5cRDYOyspq1VSVqEkiP5FyXZZJZ3ie8wpssUatTJCgil2G6xzWSENwuJnTUuWSouDuN5ZR6daHZ0qdATRv-jYOcfX2CPPH6k4DJaxKvQNtZ4Gpvw7tf0A4mAVzdRtFMw2y2x_HG64zQu-ipPtb_n2h_5y-6t0wNcwz8L8NewcwNwM5vwkunUKLeRJdEdPC23iUp-4NEhcmMGZxE3p1il0JnFTuqOnHW3iDX3iDS3c1H_WTf1nDfRqaem2Hm6f4qYeRm4CGripp5GbgAZudvRtWAd1mCtTEzsBjfREOPAT4EhQhANDea5SD4MXIHh9pwJJea5dDhd3wOK5ejE6BfU0PAYBjs5BPQ4PQoAD27i-W3kTBJ9rVyPd9DTUDeBINz0OdQM40k1_snBwtPBcyRrppi9ZAUpWmJRs_vJlVLLGONAN4Eg3hKOLp75kBShZkStZE90AjXRDONAN4Eg3hAPdhP6AEeCAEfr7K9BN6EtWgJIVJiWbX9yoZI1xpJtRyRrjSDd9yQpQssLkAp_fckY3eGMc6WZ0hzfGkW76A0aCA0bq_ySS1W36_Mv_AQAA__9SNOwx query T -SELECT url FROM [EXPLAIN (DISTSQL) (SELECT y FROM xyz WHERE x >= 1) EXCEPT (SELECT y FROM xyz WHERE x < 3) ORDER BY y] +EXPLAIN (DISTSQL) (SELECT y FROM xyz WHERE x >= 1) EXCEPT (SELECT y FROM xyz WHERE x < 3) ORDER BY y ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJy82F1v2kgfBfD751NYc5XoMTLzYl4sVaLbUBWJDVlA2q66XLgwmyBRzNpGCo3y3VdAweHF_2N77Nw1xIc5PTU_Ub-w6N8F89io2-9-GlvrcGF9Hg5-t751vz70P_burZu73mg8-qN_a938umazv-J589P680t32LWerb_X9brUHyx-a3W_fuo-jOHFU0veWoPhXXdo_faXtZkwmy2Dmb73f-iIed8YZzYTzGaS2Uwxm7lsYrNVGEx1FAXh9pKXXaA3e2Ze3Wbz5Wodb1-e2GwahJp5LyyexwvNPDb2vy_0UPszHTp1ZrOZjv35YnfM8-ZnZxXOf_jhhtlstPKXkWfVnO3Jg3XsWR1udwSbvNosWMfJCVHsP2rm8Vc7e4vP80WsQx067mmF_evbo5IZPc_r3Y9bxxbpFUSeCm-H4KUuIQstwcEUU0tmX0LlqXA3j-L5cho74myGDj87IMl831hPfvR05fqkhFushFtqiUZqieR91ssgnOlQz07eafcuqTUl2iqp0KyqAloqqdAyqGAXavnFj55GOh6sHHW21Hiz0t6Bxo_9PrPZQv8T33T47Ydw_vi0-1PySUv9O7Xz3F6jIIx16KiLyf6fDlo9w2jX9vj1rlda3Ae1YOW49fOFr59_KirPwVkGzRxRc2QR2UGPo2eN6mTPM0XJW8hCW3AwhoHtoELCKq_Q9swlGhXazsuDFW2VZnuJFdBSabbnq2BsO38P28HtdbD9YrLMtovsoIgsnsiao4rYCnocPWlWZ2uOKXjJW8hCW3AwhoGtoELCmqjQ1swlmhXaKsqDDW2VZmuJFdBSabbmq2Bsq3gPW8HtdbD1YrLMtsrsoMgsnqja7qFBbltBj6MnrepszTEFL3kLWWgLDsYwsBVUSFiTFdqauUSrQltlebChrdJsLbECWirN1nwVjG2V72EruL0Otl5MltlWlR0UlcUTt1ZEVtDiqEm7OllzDMFLXUIWWoKDKQxcBRUS0lSFrmYu0a7QVVUeamirNFdLrICWSnM1XwVjV9V7uApur4OrF5MVetZ75YChjlbBMtKZHuPWt4vp2aPe_wtEwTqc6ocwmO6O2f842OV2L8x0FO9_y_c_9Jb7X20Lvg1zMqzosCDDkg5LMuzSYXUe5m_DjZMwzxfmTZO0MEpLo7QCaZdMG4V5yyQtjNLSKK1AukHepiDczBEW5-EWGW7TH5A2jUKd7s1pU1yECq0KFyBOu8KBDZyWhQPU-MWH7DTeAHH6dgM0gTSyCcQRTiCOdAJxxBO_-Kjl8QmkEVAgjoQCcUQUiCOjOO0Mb4M4Lc1Z_MIpTlsj6uBLBPj-AqgStDUCWCNoawSwRtDWCPQFirZGAGuEkTUgjawBcWQNiCNrQBxZI4ysAWlkDYgja0AcWQPiyBpBWyOANYK2RgBrBG2NBNZIM2skbY0E1kjw_yVgjaStkcAaSVsjgTXSyBqQRtaAOLIGxJE1II6skUbWgDSyBsSRNSCOrAFxZI2krZHAGklbI4E1krZGAWuUmTUKPJkB1ijaGoWer9DWKGCNoq1RwBplZA1Iw-c7ZtaAOHzCY2aNMrIGpJE1II6sAXFkDYgjaxRtjQLWKNoaBaxRtDUusMbNac3k9X__BQAA__9Q0IAr +distribution: full +vectorized: true +· +• sort +│ order: +y +│ +└── • except + │ + ├── • filter + │ │ filter: x >= 1 + │ │ + │ └── • scan + │ missing stats + │ table: xyz@primary + │ spans: FULL SCAN + │ + └── • filter + │ filter: x < 3 + │ + └── • scan + missing stats + table: xyz@primary + spans: FULL SCAN +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJy82N9v2lYcBfD3_RXWfUo0I3N_mIClSnQNVZFYyABpnbY8ULhLkChmtpFCo_zvE1Bw-OHvufa189YQDvf01P6I-oXF_81ZwDpf73sfu3fO1W13OBr-0bt2roadXufTyFk7nwf9353n9Q_nzy-dQcd5dv5Z1etSf3D4tdP5-qlzP4Jvnjjy2ukPbjsD57e_nDVz2SKc6rvxdx2z4G_GmcsEc5lkLlPMZT57cNkyCic6jsNo85aXbaA7fWZB3WWzxXKVbF5-cNkkjDQLXlgyS-aaBWw0_jbXAz2e6sirM5dNdTKezbfHPK9_tJfR7Ps42jQYLseLOHBq3ubk_ioJnDZ324I9vLosXCXpCXEyftQs4K-ueYvPs3miIx15_nGF3eubo9IVgyDo3o2ahxbZFUSeCm-H4KUuIQstwcEUE0eaL6HyVLidxclsMUk8cTJDm58ckGa-rZ2ncfx04f1pCb9YCb_UEo3MEunnrBZhNNWRnh590vZTMmtKtFVa4aaqCmiptELTooJbqOWXcfw01El_6amTpUbrpQ72Mn7s9ZjL5vrf5KrNrz9Es8en7Z_SOy3z79TKc3kNwyjRkafOJvs1G7S6wWiX9vj5qRda3IW1cOn59dOFL59_LCrPwZmBZp6oebKI7KDHwbNGdbLnmaLkLWShLTgYw8J2UCFllVdou3GJRoW28_JgRVtl2V5iBbRUlu35Kljbzt_DdnB57W0_m8zYdmEOijDxRNY8VcRW0OPgyU11tuaYgpe8hSy0BQdjWNgKKqSsiQptNS5xU6GtojzY0FZZtpZYAS2VZWu-Cta2ivewFVxee1vPJjO2VZqDIk08UbXtQ4PctoIeB0-a1dmaYwpe8hay0BYcjGFhK6iQsiYrtNW4RLNCW2V5sKGtsmwtsQJaKsvWfBWsbZXvYSu4vPa2nk1mbKsyB0WZeOLXisgKWhw0aVUna44heKlLyEJLcDCFhaugQkqaqtBV4xKtCl1V5aGGtspytcQKaKksV_NVsHZVvYer4PLau3o2WaFnvRcOGOh4GS5ibfQYt75ZTE8f9e5fIA5X0UTfR-Fke8zux_42t31hquNk91u--6G72P1qU_BtmJNhRYcFGZZ0WJJhnw6r0zB_G24chXm-ML-xSQurtLRKK5D2ybRVmDdt0sIqLa3SCqQb5GUKwjc5wuI03CTDLfoGadEo1OnenDbFR6jQqnAB4rQrHNjAaVk4QI2f3WTH8QaI05cboAmkkU0gjnACcaQTiCOe-NmtlscnkEZAgTgSCsQRUSCOjOK0M7wF4rQ0J_EzpzhtjaiDLxHg-wugStDWCGCNoK0RwBpBWyPQFyjaGgGsEVbWgDSyBsSRNSCOrAFxZI2wsgakkTUgjqwBcWQNiCNrBG2NANYI2hoBrBG0NRJYI-2skbQ1Elgjwf-XgDWStkYCayRtjQTWSCtrQBpZA-LIGhBH1oA4skZaWQPSyBoQR9aAOLIGxJE1krZGAmskbY0E1kjaGgWsUXbWKPBkBlijaGsUer5CW6OANYq2RgFrlJU1IA2f79hZA-LwCY-dNcrKGpBG1oA4sgbEkTUgjqxRtDUKWKNoaxSwRtHW-MAaP6c1D6-__B8AAP__bm96zA== # EXCEPT ALL and EXCEPT with swapped column orders. query T -SELECT url FROM [EXPLAIN (DISTSQL) SELECT x, y FROM xyz EXCEPT ALL SELECT y, x from xyz] +EXPLAIN (DISTSQL) SELECT x, y FROM xyz EXCEPT ALL SELECT y, x from xyz ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJzEll1v2jAUhu_3K6xz1UpGwU6gJdIkqo5pSKx0hYtKVS5S4hUkSjI7kUir_vcpSbuWj_nEM2SXIXns1z6PxPsM6tcSfJgMRoPLKcnkkny9GX8nd4Pb69HF8IqcfBlOppMfo1Py-smakrz6Zp0_kcHt5eB6Si5Go7f3OSXrP-8DoLCKI3EVPgoF_h0woMCBggsUPKDQgYBCIuOZUCqWxSfPJTCM1uC3KSxWSZYWPwcUZrEU4D9DukiXAnyYhvdLcSPCSEinDRQikYaLZbnNOn_qJ3LxGMocKEyScKV80nKKncdZ6pM-o30OwQuFOEtfd3hf-D4n81DNN5d8QwIKKg0fBPjshf5b2I5hWE77zDYs_2vY96WyVSwjIUW0sVhQkNgne078LVTziUjHicO2pjPNE-F_UAcoLMXP9KRMffpZLh7mbw-6gb0fzrU43J7kV3ErThzW2b6GvXt7G3uz-hawGhY4vOW4R5TWIG7XOO7htWXNassa1ZbXnwWvMwu35XhHVMcg7plx3MOrw5tVhzeqjlt_Fm6dWXit8j_qWOoYxD03jnt4ddxm1XEbVcerPwuvziw6rSOKYxC2Zxj28Np4zWrj_beOtSfXjVBJvFKiVoNqFycT0YOobkrFmZyJaxnPym2qx3HJlQ0gEiqt3vLqYbiqXhUB68NdG7hnAzOr3Kyjp5nBlXEzuGsD92xgZpV768p2aL5Ntz_Srv6-XS3MNu-svU17NoLrYURwPYwIrocxwREaEbxjI7geRgTXw4jgehgTHKERwbs2gp_ZKKqHEUX1MKKoHsYURWhE0XMbRfUwoqgeRhTVw5iiCI0o2rNRlFn1BIRGJEVoxFKExjTFcKwr2JUFu7ZgVxcs-4JdYWBWjYHtVAYjW_U0ZquexmzV06itCI7ZalKWdmdm0pZMacxWo75kjGO27pQHra3By6ffAQAA__-bNoZN +distribution: full +vectorized: true +· +• except all +│ +├── • scan +│ missing stats +│ table: xyz@primary +│ spans: FULL SCAN +│ +└── • scan + missing stats + table: xyz@primary + spans: FULL SCAN +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJzEll1v2jAUhu_3K6xz1UqOgp2ElkiTqDqmIbHSFS4qTblIiVeQaJLFQSKt-O9TwhjlYz7xDNllah77tc8j9X0D-XMOPvQe7wc3_Tty8ak_Go--DS7JqDfo3Y7JkpKCfH4YfiXL4pX0Hm9792NyMxhs1gtKln_WgUKcROIufBES_O_AgAIHCg5QcIGCBwGFNEsmQsokK3_yVgH9aAl-i8IsThd5-eeAwiTJBPhvkM_yuQAfxuHTXDyIMBKZ3QIKkcjD2bw6Zlm8dtNs9hJmBVAYpWEsfWLZ5cnDRe6TLqNdDsGKQrLIf5-w3fipINNQTne33CABBZmHzwJ8tqL_FtbTDMtpl5mG5X8Nu91qESdZJDIR7WwWlCT2kyM3_hLK6Ujkw9Rme9MZF6nw35kDFObiR35Rpb78mM2ep5sP1cC2l3MMLnck-V1iJanNvP1nOHq2u3M2q28Bq2GBzS3bOaO0GnHb2nFPry1rVlvWqLa8_ix4nVk4lu2eUR2NuFfacU-vDm9WHd6oOk79WTh1ZuFa1f-oc6mjEfdaO-7p1XGaVcdpVB23_izcOrPwrDOKoxG2oxn29Nq4zWrj_reOdSTXg5BpEktRq0G1ypuJ6FmsX0omi2wi7rNkUh2z_hxWXNUAIiHz9Spff_Tj9VIZsD7cNoE7JjAzys08Nc00nozrwW0TuGMCM6Pce092QPN9uvWedtTv7ShhtvtmrX3aNRFcDSOCq2FEcDWMCY7QiOCeieBqGBFcDSOCq2FMcIRGBG-bCH5loqgaRhRVw4iiahhTFKERRa9NFFXDiKJqGFFUDWOKIjSiaMdEUWbUExAakRShEUsRGtMUw7GuYFYWzNqCWV0w7AtmhYEZNQZ2UBm0bFXTmK1qGrNVTaO2Ijhmq05ZOpyZTlvSpTFbtfqSNo7ZelAelLYGqw-_AgAA__-poYDu query T -SELECT url FROM [EXPLAIN (DISTSQL) SELECT x, y FROM xyz EXCEPT SELECT y, x from xyz] +EXPLAIN (DISTSQL) SELECT x, y FROM xyz EXCEPT SELECT y, x from xyz ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJzEmFFv4kYUhd_7K6z7tCsNgpmxgViqlNUuVSPRJA08rLTiwQvTBInF1DYSbJT_XgFNndjxPTPYTh-J-fCZG5-PGR4p_XtFIU1G49HnqbdNVt5vdzd_eN9GX2_Hn66uvQ9fribTyZ_jj96_b9kJb396z27_0xt9_Ty6nT5f2wtv99-1GQlaxwtzHf0wKYXfSJIgRYI0CfJJUEAzQZsknps0jZPDWx6PwNViR2FP0HK92WaHP88EzePEUPhI2TJbGQppGn1fmTsTLUzS7ZGghcmi5ep4m93-5-UmWf6Ikj0JmmyidRp6ne7hzjfbLPQupbhUNHsSFG-z_A5pFt0bCuWTOC9F4JhCiUtZmUK5pPiyTLPlep51ZWESb600x77vvYcofXgbyaPo86IELUTxK6PkH7Vdx8nCJGbx6sOOn1IZVlnMLU8RtJXCYmR5in6NFOKsoL9H6cPEZDebri7Ma7rfmPBZBZ_GYxK0Mn9lH44r-Phrsrx_eH5hV8JBsyO-jjvxpquD4hjevPfw1b2lvQCkhQC6qtPV54jIIUffOYeDikCOvP-ydRVZR-m3riLZnAQs5lalogZTWIysSkVuKWqrSL6ripR9DZVNDXWn65-jA4ccA-ccDjoAOfIOqtZ1YB1l0LoOVHNFtJhblQ4aTGExsioduKWorQP1rjrQ9jXUNjX0O8djhLMOHHIMnXM46ADkyDuoW9eBdZRh6zrQzRXRYm5VOmgwhcXIqnTglqK2DvS76sC3r6FvU8Ogc44MHFJcOKZwUAFIkffPb10F1lEuWleB31wJLeZWpYIGU1iMrEoFbilqq8D_336zeCPXnUk38To1Vr9I9A4rM4t7c5pUGm-TublN4vnxNqeXN0fu-IeFSbPTVXV6cbU-XToEfAlLFtY8rIqwfAn7r2DpBktVi76oQ6t-HVprntYsHdSBZa1bq14telCH1uBh8dnHFPy_AgdYFeE-C4NFD_h29fl6DVla9nj6gqcl8ELJKi7dBjQqN8JBuwGO6g1w1G9ZUqpLwQGNGg5wVHGEg8cd4KjksiTW148swkuK4fBS0SXvGLR0XjJyAOrGa0YOAV4SjVNbeRq2FeCorTwO28rjsK0lyTq1ladhW3kcthXg6JHlcdhW_gtGSbCJAttWybdV8RtXsHTFm0b5YN_Lm0YFAC-ZxmnfzNNw4wxwtHPmcbh15nHUVlWyrEtbAY3aCnDUVoSjR5bHUVsV_wWjhgDnd7IFvNxWfiuLls6bRoOtrOZNo8EJWfObGjB3QKO2Ihy0FeCorQCHJ13-oIyOuuCIX-_m8LALcHTaBb8RoKeG_4LRaHT8VraAl9qq-b1scemzp1_-CQAA__-vLCPq +distribution: full +vectorized: true +· +• except +│ +├── • scan +│ missing stats +│ table: xyz@primary +│ spans: FULL SCAN +│ +└── • scan + missing stats + table: xyz@primary + spans: FULL SCAN +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJzEmFFv4kYUhd_7K6z7tCsNgpmxgViqlNUuVSPRJA08rFTlwQvTBInF1DYSbJT_XmGUemPH98xgO30k7MecuevzMcMTpf-sKaTJ19vpp6tr78OXq9l89uf0ozebTCef595eeAfvt7ubP7z94Yc3-fp5cjt_ee8gvP1_75GgTbw019F3k1L4F0kSpEiQJkE-CQroXtA2iRcmTePk-E-ecuBquadwIGi12e6y45_vBS3ixFD4RNkqWxsKaR59W5s7Ey1N0h-QoKXJotU6X2Z_-HG5TVbfo-RAgmbbaJOGXq9_XPlml4XepRSXiu6fBcW7rFghzaIHQ6F8FuelCBxTKHEpa1MolxRfVmm22iyyvixN4q2dFti3g_cYpY9vI0UUfV6UoIMofm2U4qN2mzhZmsQsX31Y_im1YZXF3IoUQVcpLEZWpBg2SCHOCvp7lD7OTHaz7evSvOaHrQlfTPBpOiVBa_N39iHfwcdfk9XD48sLuxKO2h3xddyLt30dlMfw5trjV2tLewFICwH0Va-vzxGRQ46hcw4HFYEcRf9l5yqyjjLsXEWyPQlYzK1ORS2msBhZnYrcUjRWkXxXFSn7GiqbGupe3z9HBw45Rs45HHQAchQdVJ3rwDrKqHMdqPaKaDG3Oh20mMJiZHU6cEvRWAfqXXWg7WuobWro9_JrhLMOHHKMnXM46ADkKDqoO9eBdZRx5zrQ7RXRYm51OmgxhcXI6nTglqKxDvS76sC3r6FvU8Ogd44MHFJcOKZwUAFIUfTP71wF1lEuOleB314JLeZWp4IWU1iMrE4Fbikaq8D_336zeCPXnUm38SY1Vr9IDI47M8sHc5pUGu-ShblN4kW-zOnlTc7lf1iaNDu9q04vrjant44Bf4YlC2seVmVY_gz7r2DpBkvViL5oQqthE1prntYsHTSBZaOl1aARPWpCa_Cw-OxjCv6_AgdYleEhC4NNj_h2Dfl6jVlaDnj6gqcl8ELFKi7dBjQqN8JBuwGO6g1w1G9ZUapLwQGNGg5wVHGEg8cd4KjksiLW148swiuK4fBK0SXvGLR1XjJyBOrGa0aOAV4RjVNbeRq2FeCorTwO28rjsK0VyTq1ladhW3kcthXg6JHlcdhW_gtGSXCIAsdWybdV8QdXsHXFm0b54NzLm0YFAK-YxunczNPw4AxwdHLmcXh05nHUVlWxrEtbAY3aCnDUVoSjR5bHUVsV_wWjxgDnT7IlvNpW_iiLts6bRoOjrOZNo8ENWfOHGjB3QKO2Ihy0FeCorQCHN13-ooyuuuCK32xxeNkFOLrtgt8I0FPDf8FoNDr-KFvCK23V_Fm2vPX751_-DQAA__-aVB6L # EXCEPT ALL and EXCEPT with different ORDER BY types. query T -SELECT url FROM [EXPLAIN (DISTSQL) (SELECT x FROM xyz ORDER BY y) EXCEPT ALL (SELECT y AS x FROM xyz ORDER BY z) ORDER BY x] +EXPLAIN (DISTSQL) (SELECT x FROM xyz ORDER BY y) EXCEPT ALL (SELECT y AS x FROM xyz ORDER BY z) ORDER BY x ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJy8ll9v4jgQwN_vU1jzVHRGwU7Cn0gntddyOiS2dAkPXVV5SIm3IFGSdYJEWvW7rwhlaQj1xITmDYp_48nMbzp5hfjXAhxw-8P-9YSs5IL8Nx59Iw_9-7vh1eCWXNwM3In7fdggF-9n1tsT6_SFjMY3_TH59wdJG6R_f92_m5Cr4fDPyZRcuUePvzT2n9ceUFiGgbj1n0UMzgMwoMCBggkULKBgg0chkuFUxHEoN0deM2AQrMFpUZgvo1Wy-bNHYRpKAc4rJPNkIcCBif-4EGPhB0IaLaAQiMSfL7Jr1unLZSTnz75MgYIb-cvYIU1jc_NolTjkkoH3RiFcJe_h91EfUzLz41k-XnbeoxAn_pMAh73R09K0NdPkldLkn6a5j7NahjIQUgS5SN6GxI4cedb__XjmimQUGeygI5M0Es4HkYDCQvxMLi5Z4x85f5plnz5tz_6ZTJ3Su6FMhDSYfVimvz-Nb5Wo2bFyvAc9ksRt2Awjg7cOC3z0ejt3PStvFithlsGbhvklI6CRaFs70XMOAat3CFgdQ4AUfzcE7VOHgJdvLi_TXLNpWF9ioUaiHe1Ez2khr9dCXoeFSPF3FnZOtdAs31yzTHOtZraNz2-hRqJd7UTPaaFZr4VmHRYixd9Z2D3VQqt8c60yzbWbX-KgRpo9zTTPaaBVr4FWHQYipd8Z2DvHK-mR-GMRR-EyFqXeNlubgongSWwbEIcrORV3Mpxm12y_jjIue8sIRJxsf-XbL4Pl9qdNguXhThWYsUq0XYnuqWmmUTOuB3eqwAc106XtSnRPTfNDuvWRNnNw6xA2lbCl7palhDlTX21XmQ81jMyHGsbmA6GR-UBoZD7aVeZDDSPzoYax-UBoZD4QGpmPjtLSrlrSbpX56FUxXA0jhqthzHCERgxHaGwD6KzN4n9Snb2pS6NLQGtzauOI5qywRXKqMq4WnanXCGI6K-wRHdURGnEdoTHZMRyxHcMx3Qs7VEt3NY3prqZR3REc0x3BMd0LizSvexvRvbBTtHQv7BQt3dU0pruaRnVHcEx3BMd0L-xTLd3VNKa7mkZ1R3BMdwTHdC9s1fy7dkutOy_sFqXu3ttfvwMAAP__eLR-jA== +distribution: full +vectorized: true +· +• sort +│ order: +x +│ +└── • except all + │ + ├── • scan + │ missing stats + │ table: xyz@primary + │ spans: FULL SCAN + │ + └── • scan + missing stats + table: xyz@primary + spans: FULL SCAN +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJy8lk9v2koQwO_vU6zmFPQW2bu2-WPpSclLqIpEQ4o5pKo4OHgbkAh210bCifLdK0woMSY7Xkx8g7C_2fHMbzJ-gfj3Alzo3d8Nrvq35OKm742974MGufB6g971mKzJl9HwG1mnz2Q4uumNyP8_SNogvfvr3t2YXA0Gf0-m5Mo7evy5sf-8BgrLMBC3_pOIwf0JDChwoGABBRsoODChEMlwKuI4lJsjLxnQD9bgmhTmy2iVbP48oTANpQD3BZJ5shDgwth_WIiR8AMhDRMoBCLx54vsmnX6fBnJ-ZMvU6DgRf4ydknT2Nw8XCUuuWQweaUQrpK38PuoDymZ-fEsHy87P6EQJ_6jAJe90tPSdDTT5JXS5B-muY-zWoYyEFIEuUiTDYkdOfKsX_145olkGBnsoCPjNBLuO4-AwkL8Si4uWeM_OX-cZZ8-bM_-mSyd0nuhTIQ0mHNYpn8_jG-XqNmxcrwFPZLEbdgMI4ObhwU-er2Tu56VN4uVMMvgTcP6lBHQSLSlneg5h4DVOwSsjiFAir8bgtapQ8DLN5eXaa7VNOxPsVAj0bZ2oue0kNdrIa_DQqT4Owvbp1polW-uVaa5djPbxue3UCPRjnai57TQqtdCqw4LkeLvLOycaqFdvrl2meY6zU9xUCPNrmaa5zTQrtdAuw4DkdLvDOye45X0SPyRiKNwGYtSb5vmpmAieBTbBsThSk7FnQyn2TXbr8OMy94yAhEn21_59kt_uf1pk2B5uF0FZqwS7VSiu2qaadSM68HtKvBBzXRppxLdVdP8kDbf01YONg9hSwnb6m7ZSpgz9dVOlflQw8h8qGFsPhAamQ-ERuajVWU-1DAyH2oYmw-ERuYDoZH5aCst7agl7VSZj24Vw9UwYrgaxgxHaMRwhMY2gM7aLP4n1dmbujS6BLQ2pzaOaM4KWySnKuNq0Zl6jSCms8Ie0VEdoRHXERqTHcMR2zEc072wQ7V0V9OY7moa1R3BMd0RHNO9sEjzurcQ3Qs7RUv3wk7R0l1NY7qraVR3BMd0R3BM98I-1dJdTWO6q2lUdwTHdEdwTPfCVs2_a5tq3Xlhtyh1n7z-8ycAAP___hN5LQ== query T -SELECT url FROM [EXPLAIN (DISTSQL) (SELECT x FROM xyz ORDER BY y) EXCEPT (SELECT y AS x FROM xyz ORDER BY z) ORDER BY x] +EXPLAIN (DISTSQL) (SELECT x FROM xyz ORDER BY y) EXCEPT (SELECT y AS x FROM xyz ORDER BY z) ORDER BY x ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJy8mF1v4kYYhe_7K6y5SlQjMzPmy1KlpBuqRqIhBS62WnHhhWmCxGJqGwkS5b9XwLLeePB7ZmKbu3z48Ry_zHk05pUl_y1ZwMb9Qf_TxNnES-eP0fAv50v_8-Pg9v7Bubq7H0_Gfw-unavv12yPV2x3L85wdNcfOb__4-yunf7nT_3HyY-rds7t-OylL9fZz9spc9kqmquH8JtKWPCFceYywVwmmct85rIWm7psHUczlSRRvL_k9QDcz7csaLpssVpv0v2fpy6bRbFiwStLF-lSsYBNwq9LNVLhXMVek7lsrtJwsTwss9293Kzjxbcw3jGXjdfhKgmchrdfebhJA-eGs-mby6JNmt0-ScMnxQL-5n4sQssygiiMIGwi3C2SdLGapR7PzUB7xoz5unOew-T5zPVZCPmxEK1KQ_iFIbL7bFZRPFexmr-70-EuhTEFmlUWoVVXBDSpLEK7RAT3Qyn_DJPnsUqHa0_mJjXZrVVwksHtYMBctlT_plc3_Pq3ePH0fPjJoGYdm-01juJUxZ7URvZr4f27BjM7N47vNz0T4iFqRGvPb-YHfHb53rvlublFuIFFPNHwpLXKLEK0rUOYygyEyDzCa5SZcYh2jTLj1ZkEzapIZhVGQJMqkpldhNIy45eQGdheJ5lpIzOVmTAvsjApsmx4vrVNLEJ0rEOY2gSEyIosarSJcYhOjTYR1VUZzarIJhVGQJMqsoldhNI2EZewCdheJ5toIzO1iTQvsjQpst84vAnZ2cQiRNc6hKlNQIisyLJGmxiH6NZoE1ldldGsimxSYQQ0qSKb2EUobRN5CZuA7XWyiTYyU5v45kX2TYrcali7xCJCzzKCqUlAhKzEfo0mMQ7Rq9EkfnU1RrMqMkmFEdCkikxiF6G0SfxLmARsr5NJtJF95CubM_cfqWQdrRJl9G1Mcz8wNX9Sxw8giTbxTD3G0eywzPHX4YE7_GGukvT4X3H85X51_Nc-4M8wJ2FJwyIP859h_x3M7WAuy9CCl6J7ZWjZoWlJ0q0yMAcjp2khytCyWYru0rRPbtM2DbcsYJGH2yTcoQvSIWHwzF0S9jm9dI-kOaA5LRWOrKJpxcYMgEZqADhyA8KBHACO7MBpuQA9ABr5AeBIEABHhkA4qAvXDPN-y6LR0YrJ4ZomOC0Z3gaFoTWDHp32DO-BxWnTiCbANdVYlZ2mYdlpHJYd4KjsNI7KLjTL2pQd0KjsAEdlBzgqO8LBjhf0uVWg06OmGgrXyi5o1QgfHJtp1aBHp00jwJFE0KYRXYBrqrE689M0PPTTODz1Axwd-2kcll2zrFXZaRqWncZh2Wkclh3gaMfTZ1kJPnZJn2VzuFZ2CV6RwVFY0qoBjy5p08gWWJw2jQSnEqmpxqbsgEZlBzgqO8JB2QEOX_I1y1q95dM0fM2ncfieT-PwRR_gaMfTZ1mJPjf6LJvD9bLTqvHBUdinVZN_9OnbL_8HAAD__yqGDZw= +distribution: full +vectorized: true +· +• sort +│ order: +x +│ +└── • except + │ + ├── • scan + │ missing stats + │ table: xyz@primary + │ spans: FULL SCAN + │ + └── • scan + missing stats + table: xyz@primary + spans: FULL SCAN +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJy8mE1v6kYYhff9FdasEtXIzIz5slQp6Q1VI9GQAotbVVn4wjRB4mJqGwkS5b9XmHKdePB7ZmI7u3z48Ry_zHk05oUl_65YwIZf70fXt3fOxc3tdDb9c3TpXEyHo-GXmbNzfpuM_3B2-2dnPLkZTpxf_3L2l87w65fh_ezHVXvnenr20ufL_Ocdc9k6Wqi78LtKWPA348xlgrlMMpf5zGUd9uCyTRzNVZJE8eGSlwy4XexY0HbZcr3Zpoc_P7hsHsWKBS8sXaYrxQI2C7-t1ESFCxV7beayhUrD5SpbZrd_vtrEy-9hvGcum27CdRI4Le-w8nibBs4VZw-vLou2aX77JA0fFQv4q_uxCB3LCKI0grCJcLNM0uV6nnq8MAPtGXPm2955CpOnM9fnIeTHQnRqDeGXhsjvs11H8ULFavHuTtldSmMKNKs8QqepCGhSeYRuhQjuh1L-HiZPU5WON54sTGq236jg5ILr0Yi5bKX-SS-u-OUv8fLxKfvJoGY9m-01jeJUxZ7URvZz6f37BjM7N47_b3omxF3Uijae3y4O-Ozyg3fLc3OLcAOLeKLlSWuVWYToWocwlRkIkXuENygz4xDdBmXG6zMJmlWZzGqMgCZVJjO7CJVlxj9DZmB7nWSmjcxUZsK8yMKkyLLl-dY2sQjRsw5hahMQIi-yaNAmxiF6DdpE1FdlNKsym9QYAU2qzCZ2ESrbRHyGTcD2OtlEG5mpTaR5kaVJkf1W9iZkZxOLEH3rEKY2ASHyIssGbWIcot-gTWR9VUazKrNJjRHQpMpsYhehsk3kZ9gEbK-TTbSRmdrENy-yb1LkTsvaJRYRBpYRTE0CIuQl9hs0iXGIQYMm8eurMZpVmUlqjIAmVWYSuwiVTeJ_hknA9jqZRBvZR76yOXP_iUo20TpRRt_GtA8DU4tHdfwAkmgbz9V9HM2zZY6_jjMu-8NCJenxv-L4y-36-K9DwLcwJ2FJw6II87ew_w7mdjCXVWjBK9GDKrTs0bQk6U4VmIOR07QQVWjZrkT3adont2mXhjsWsCjCXRLu0QXpkTB45j4J-5xeekDSHNCclgpHVtG0YmMGQCM1ABy5AeFADgBHduC0XIAeAI38AHAkCIAjQyAc1IVrhnm_ZdHoaMUUcE0TnJYM74LC0JpBj057hg_A4rRpRBvgmmqsyk7TsOw0DssOcFR2GkdlF5plbcoOaFR2gKOyAxyVHeFgxwv63CrQ6VFTDYVrZRe0aoQPjs20atCj06YR4EgiaNOIPsA11Vid-WkaHvppHJ76AY6O_TQOy65Z1qrsNA3LTuOw7DQOyw5wtOPps6wEH7ukz7IFXCu7BK_I4CgsadWAR5e0aWQHLE6bRoJTidRUY1N2QKOyAxyVHeGg7ACHL_maZa3e8mkavubTOHzPp3H4og9wtOPps6xEnxt9li3getlp1fjgKOzTqik--sPrT_8FAAD__xTXCD0= # EXCEPT ALL and EXCEPT with different numbers of ORDER BY columns. query T -SELECT url FROM [EXPLAIN (DISTSQL) (SELECT x FROM xyz ORDER BY y) EXCEPT ALL (SELECT x FROM xyz ORDER BY y, z) ORDER BY x] +EXPLAIN (DISTSQL) (SELECT x FROM xyz ORDER BY y) EXCEPT ALL (SELECT x FROM xyz ORDER BY y, z) ORDER BY x ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJy8lk9v4joQwO_vU1hzKnpGiZ2EP5Ge1L6W1SKxpQscuqpySIm3IFGSdYIErfrdV4QiGkI8MWlzaxr_7MnMbxi_QvxnAS6Me4Pe9YSs5IJ8Gw1_kIfe_d3gqn9LLm7648n456BBLt7XrHcr1psXMhzd9Ebk_19k0yC9--ve3YRcDQbqlZS8NA6Paw8oLMNA3PrPIgb3ARhQ4EDBAgo2UHDAoxDJcCriOJTbJa8p0A_W4JoU5stolWz_7VGYhlKA-wrJPFkIcGHiPy7ESPiBkIYJFAKR-PNFesx683IZyfmzLzdAYRz5y9glTWN78nCVuOSSgfdGIVwl79sfdn3ckJkfz7L7pes9CnHiPwlw2Rs9L0yn1jB5YZiHfVbLUAZCiiCzk7clsSUnvvW7H8_GIhlGBjuqyGQTCfeDRkBhIX4nF5es8Z-cP83Svwq_-_BNlk7qx6FMhDSYc5ymfwv3t0vk7FQ63jc9EcRt2Awjg5vHCT55vJM5npU3i5Uwy-BNw_qSFtAItFVzoLww0BqagNXRBEjy903QOrcJePni8jLFtZqG_SUWagTarjlQXhhoDRbyOixEkr-3sH2uhVb54lplims302n8-RZqBNqpOVBeGGgNFlp1WIgkf29h51wL7fLFtcsU12l-iYMaYXZrDZMXhlmDgXYdBiKp3xvY_Ywr6Yn9RyKOwmUsSt02zW3CRPAkdgWIw5WcijsZTtNjdo_DlEtvGYGIk91bvnvoL3evtgGWh9tVYMYq0U4luqummUbOuB7crgIf5UyXdirRXTXNj2nzI21lYPMYtpSwra6WrYQ5Ux_tVOkPNYz0hxrG-gOhkf5AaKQ_WlX6Qw0j_aGGsf5AaKQ_EBrpj7bS0o5a0k6V_uhWMVwNI4arYcxwhEYMR2hsAuiMzfwvqc7c1KXRIaA1ObVxRHOWmyIZVRlXi87UYwQxneXmiI7qCI24jtCY7BiO2I7hmO65Gaqlu5rGdFfTqO4IjumO4JjuuUGa1b2F6J6bKVq652aKlu5qGtNdTaO6IzimO4JjuufmqZbuahrTXU2juiM4pjuCY7rnpmr2rm2qdee52aLU3Xv7528AAAD__6Wvff8= +distribution: full +vectorized: true +· +• sort +│ order: +x +│ +└── • except all + │ + ├── • scan + │ missing stats + │ table: xyz@primary + │ spans: FULL SCAN + │ + └── • scan + missing stats + table: xyz@primary + spans: FULL SCAN +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJy8ll9v2jwUh-_fT2Gdq6LXKNhJ-BNpUruWaUisdMBFp4mLlHgFiZLMCRK06nefCEU0hPjEpPVd0-Sxfzl-DicvEP9dgAfd-7v-Ve-WXNz0RuPRz36NXIy6_e71mKzJt-HgB1lvnslgeNMdkq-_yKZGuvfX3bsxuer31U9S8lw7XK6BwjIMxK3_JGLwfgMDChwo2EDBAQouTChEMpyKOA7l9pGXFOgFa_AaFObLaJVs_z2hMA2lAO8FknmyEODB2H9YiKHwAyGtBlAIROLPF-k2683zZSTnT77cAIVR5C9jj9St7c6DVeKRSwaTVwrhKnlb_rDqw4bM_HiWXS99fkIhTvxHAR57pefFdI3G5IUxD-uslqEMhBRBZqXJlsQeOfGu3_14NhLJILLY0YmMN5Hw3lkEFBbiT3JxyWpf5Pxxlv5V-N6Hd7J1Sj8KZSKkxdzjMv1fuL5TomanyvG26IkQt2E9jCzeOC7wye3dzPasvFmshFkWr1v2p7SARtCm4aC8MKiBJmAmmgAp_r4Jmuc2AS9_uLzM4dp1y_kUCzWCtgwH5YVBDVjITViIFH9vYetcC-3yh2uXOVynnk7jj7dQI2jbcFBeGNSAhbYJC5Hi7y1sn2uhU_5wnTKH69Y_xUGNmB2jMXlhTAMGOiYMREq_N7DzEZ-kJ9YfijgKl7Eo9bXZ2BZMBI9idwBxuJJTcSfDabrN7nKQculXRiDiZHeX7y56y92tbcDycKsKzFgl2q1Ed9Q006gZ14NbVeCjmunSbiW6o6b5Md14T9sZuHEM20rYUZ-Wo4Q5U2_tVukPNYz0hxrG-gOhkf5AaKQ_mlX6Qw0j_aGGsf5AaKQ_EBrpj5bS0rZa0naV_uhUMVwNI4arYcxwhEYMR2hsAuiMzfwvqc7c1KXRIaA1ObVxRHOWmyIZVRlXi87UYwQxneXmiI7qCI24jtCY7BiO2I7hmO65Gaqlu5rGdFfTqO4IjumO4JjuuUGa1b2J6J6bKVq652aKlu5qGtNdTaO6IzimO4JjuufmqZbuahrTXU2juiM4pjuCY7rnpmr2W7uh1p3nZotS98nrf_8CAAD__zWpeKA= query T -SELECT url FROM [EXPLAIN (DISTSQL) (SELECT x FROM xyz ORDER BY y) EXCEPT (SELECT x FROM xyz ORDER BY y, z) ORDER BY x] +EXPLAIN (DISTSQL) (SELECT x FROM xyz ORDER BY y) EXCEPT (SELECT x FROM xyz ORDER BY y, z) ORDER BY x ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJy8mF1v4kYYhe_7K6y5SlQjMzPmy1KlbDdUjURDClxsteLCC9MEicXUNhIkyn-vMIu88eD3zMR27kLix3P8MufROC8s-W_NAjYdjoafZ84uXjt_TMZ_OV-HXx5Gn-7unavbu-ls-vfo2rn6cc3-dMX-8OyMJ7fDifP7P87h2hl--Tx8mNFXuc7zdf5xP2cu20RLdR9-VwkLvjLOXCaYyyRzmc9c1mFzl23jaKGSJIqPl7xkwN1yz4K2y1ab7S49_nruskUUKxa8sHSVrhUL2Cz8tlYTFS5V7LWZy5YqDVfrbJn94flmG6--h_GBuWy6DTdJ4LS848rjXRo4N5zNX10W7dL89kkaPioW8Ff3fRE6tUUQNhFuV0m62ixSjxdmoC2QM98OzlOYPF24Pg8h3xeiU2sIvzREfp_dJoqXKlbLN3fK7lIaU6BZ5RE6TUVAk8ojdCtEcN-V8s8weZqqdLz1ZGFSs8NWBWcVfBqNmMvW6t_06oZf_xavHp-ynwz2eM9me02jOFWxJ7WR_Vp6_77BzC6N48dNL4S4j1rR1vPbxQFfXH7wZnlubhFuYBFPtDxprTKLEN0aQwibELlHeIMyMw7RbVBmvD6ToFmVyazGCGhSZTKzi1BZZvwjZAa211lm2shMZSbMiyxMiixbnm9tE4sQvRpDCJsQeZFFgzYxDtFr0CaiviqjWZXZpMYIaFJlNrGLUNkm4iNsArbX2SbayExtIs2LLE2K7LeyNyE7m1iE6NcYQtiEyIssG7SJcYh-gzaR9VUZzarMJjVGQJMqs4ldhMo2kR9hE7C9zjbRRmZqE9-8yL5JkTsta5dYRBjUFkHYRMhL7DdoEuMQgwZN4tdXYzSrMpPUGAFNqswkdhEqm8T_CJOA7XU2iTay9_zL5sL9JyrZRptEGf03pn0cmFo-qtMXkES7eKEe4miRLXP6OM647BdLlaSnv4rTh7vN6U_HgD_DnIQlDYsizH-G_Tcwt4O5rEILXokeVKFlj6YlSXeqwByMnKaFqELLdiW6T9M-uU27NNyxgEUR7pJwjy5Ij4TBM_dJ2Of00gOS5oDmtFQ4soqmFRszABqpAeDIDQgHcgA4sgOn5QL0AGjkB4AjQQAcGQLhoC5cM8zbLYtGRyumgGua4LRkeBcUhtYMenTaM3wAFqdNI9oA11RjVXaahmWncVh2gKOy0zgqu9Asa1N2QKOyAxyVHeCo7AgHO17Q51aBTo-aaihcK7ugVSN8cGymVYMenTaNAEcSQZtG9AGuqcbqzE_T8NBP4_DUD3B07KdxWHbNslZlp2lYdhqHZadxWHaAox1Pn2Ul-NolfZYt4FrZJXhFBkdhSasGPLqkTSM7YHHaNBKcSqSmGpuyAxqVHeCo7AgHZQc4fMnXLGv1lk_T8DWfxuF7Po3DF32Aox1Pn2Ul-t7os2wB18tOq8YHR2GfVk3x0eevv_wfAAD__8HcDQ8= +distribution: full +vectorized: true +· +• sort +│ order: +x +│ +└── • except + │ + ├── • scan + │ missing stats + │ table: xyz@primary + │ spans: FULL SCAN + │ + └── • scan + missing stats + table: xyz@primary + spans: FULL SCAN +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJy8mF9v6jYYxu_3KSJftVpQsB3-RZrUs1OmVWKlAy7ONPUiB7wWiUNYEiRo1e8-EYbSxuR97CbhrhR-8ZMXPz85vLLk3xUL2PDbw-jL3b1zdXs3nU3_HF07V9PhaPh15uyc3ybjP5zd_sUZT26HE-fXv5z9tTP89nX4MKM_5Tov1_nLHXPZOlqo-_CHSljwN-PMZYK5TDKX-cxlHfbosk0czVWSRPHhI68ZcLfYsaDtsuV6s00P_3502TyKFQteWbpMV4oFbBZ-X6mJChcq9trMZQuVhstVtsxu_3KziZc_wnjPXDbdhOskcFreYeXxNg2cG84e31wWbdP88kkaPikW8Df3cxE6tUUQNhFul0m6XM9TjxdmoC2QM9_3znOYPJ_5fB5Cfi5Ep9YQfmmI_DrbdRQvVKwWH66UXaU0pkCzyiN0moqAJpVH6FaI4H4q5e9h8jxV6XjjycKkZvuNCk4m-DIaMZet1D_p1Q2__iVePj1nfxns8Z7N9ppGcapiT2oj-7n0-n2DmZ0bx_8XPRPiPmpFG89vFwd8dvnBh-W5uUW4gUU80fKktcosQnRrDCFsQuQe4Q3KzDhEt0GZ8fpMgmZVJrMaI6BJlcnMLkJlmfFLyAxsr5PMtJGZykyYF1mYFFm2PN_aJhYhejWGEDYh8iKLBm1iHKLXoE1EfVVGsyqzSY0R0KTKbGIXobJNxCVsArbXySbayExtIs2LLE2K7LeyJyE7m1iE6NcYQtiEyIssG7SJcYh-gzaR9VUZzarMJjVGQJMqs4ldhMo2kZewCdheJ5toIzO1iW9eZN-kyJ2WtUssIgxqiyBsIuQl9hs0iXGIQYMm8eurMZpVmUlqjIAmVWYSuwiVTeJfwiRge51Moo3sMz_ZnLn-RCWbaJ0oo19j2oeBqcWTOn4BSbSN5-ohjubZMseX44zL_rFQSXp8Vxxf3K2Pbx0Cvoc5CUsaFkWYv4f9DzC3g7msQgteiR5UoWWPpiVJd6rAHIycpoWoQst2JbpP0z65Tbs03LGARRHuknCPLkiPhME990nY5_TSA5LmgOa0VDiyiqYVGzMAGqkB4MgNCAdyADiyA6flAvQAaOQHgCNBABwZAuGgLlwzzMcti0ZHK6aAa5rgtGR4FxSG1gy6ddozfAAWp00j2gDXVGNVdpqGZadxWHaAo7LTOCq70CxrU3ZAo7IDHJUd4KjsCAc7XtDnVoFOj5pqKFwru6BVI3xwbKZVg26dNo0ARxJBm0b0Aa6pxurMT9Pw0E_j8NQPcHTsp3FYds2yVmWnaVh2Godlp3FYdoCjHU-fZSX42iV9li3gWtkleEQGR2FJqwbcuqRNIztgcdo0EpxKpKYam7IDGpUd4KjsCAdlBzh8yNcsa_WUT9PwMZ_G4XM-jcMHfYCjHU-fZSX63uizbAHXy06rxgdHYZ9WTfHWH99--i8AAP__trkHsA== # EXCEPT ALL and EXCEPT with compatible ORDER BY columns that are not in the final result. query T -SELECT url FROM [EXPLAIN (DISTSQL) (SELECT y FROM xyz ORDER BY z) EXCEPT ALL (SELECT y FROM xyz ORDER BY z)] +EXPLAIN (DISTSQL) (SELECT y FROM xyz ORDER BY z) EXCEPT ALL (SELECT y FROM xyz ORDER BY z) ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJy8lkFv2jAYhu_7FdZ3aiWjYCfQEmkSXcs0JFY64NCpyiElXkGiJLODVFrx3yeSai0B_MXz6lspfuzXnx-J9wXU7wWEMO4NepcTspIL8nU0_E7uerc3g4v-NTm56o8n4x-DU3LyumZdrnhaP5Ph6Ko3Il9-kudT0ru97N1MyMVggKyMgMIyTcR1_CgUhHfAgAIHCj5QCIBCCyIKmUynQqlUbpe8FEA_eYKwSWG-zFb59t8RhWkqBYQvkM_zhYAQJvH9QoxEnAjpNYFCIvJ4viiOeVo_dzM5f4zlGiiMs3ipQtLwticPV3lIuhyiDYV0lb9u_7br_ZrMYjXb3a_LINpEFFQePwgI2Yb-W8yW05j8aMy3fVbLVCZCimRnp2hLYksO3PVbrGZjkQ8zj1VeZLLORPhOHKCwEL_yky47_SznD7Pir7_3ZpV7v93Jt7jTgcDXaSPNPNaq3v7g2cHO2az-s7Maz-7xhud_iJ8GQduOg_KjQR0YylwYyusPn9cZvt_wgg-xxCDomeOg_GhQB5ZwF5b49Yfv1xl-0Ch-av6_JQZBzx0H5UeDOrDEd2FJUH_4QZ3htxof4ohBzI7TmPxoTAeGBK770IE4I6GydKlErbbT3F5IJA-iHJBKV3IqbmQ6LY4pPw4LrvjlToTKy295-aG_LL_aBqwPt23gjg3MrHKzlp5mBiPjZnDbBu7YwMwqd2VkezSv0s33tK-ft6-F2e7MmlU6sBFcDyOC62FEcD2MCY7QiOAtG8H1MCK4HkYE18OY4AiNCN62EfzMRlE9jCiqhxFF9TCmKEIjip7bKKqHEUX1MKKoHsYURWhE0Y6NosyqJyA0IilCI5YiNKYphmNdwa4s2LUFu7pg2RfsCgOzagxsrzIY2aqnMVv1NGarnkZtRXDMVpOytP9mJm3JlMZsNepLxjhm61550NoabT79CQAA___X6XW5 +distribution: full +vectorized: true +· +• except all +│ +├── • scan +│ missing stats +│ table: xyz@primary +│ spans: FULL SCAN +│ +└── • scan + missing stats + table: xyz@primary + spans: FULL SCAN +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJy8lkFv2jAYhu_7FdZ3aiWjYCfQEmkSXcs0JFY64NBpyiElXkGiSRYHqWnFf58SprUE8BfPw7fS5LFff36kvK8gf63Ah8H93ehqeEvObobT2fTb6JycTQejwfWMFOTzZPyVPBcvZDy5GUzIp-_k5ZwM7q8HdzNyNRohbwKFOInEbfgkJPg_gAEFDhRcoOABhQ4EFNIsmQspk6x85bUChtEz-G0Kyzhd5-W_AwrzJBPgv0K-zFcCfJiFDysxEWEkMqcNFCKRh8tVtc1z8dJPs-VTmBVAYZqGsfRJyyl3Hq9zn_Q5BBsKyTr_s_zbqg8FWYRysbten0GwCSjIPHwU4LMN_beYHasx-dGYb-us4ySLRCainZWCksReOXDWL6FcTEU-Th1Wu5FZkQr_nTdAYSV-5md9dv4xWz4uqr_-npvVzv12JtfgTAcC3yatJHVYp376g3t7O3uz5tfOGly7w1uOexI_NYJ2LQflR4NaMJTZMJQ3Hz5vMny35XgnsUQj6IXloPxoUAuWcBuWuM2H7zYZvteqPjX_3xKNoJeWg_KjQS1Y4tqwxGs-fK_J8DutkziiEbNnNSY_GtOCIZ7tPnQgzkTINImlaNR22uWBRPQotgOSyTqbi7ssmVfbbH-OK676ckdC5tunfPtjGG8flQGbw10TuGcCM6PcrKOmmcbIuB7cNYF7JjAzyl0b2R7N63T7Pe2q5-0qYbY7s3ad9kwEV8OI4GoYEVwNY4IjNCJ4x0RwNYwIroYRwdUwJjhCI4J3TQS_MFFUDSOKqmFEUTWMKYrQiKKXJoqqYURRNYwoqoYxRREaUbRnoigz6gkIjUiK0IilCI1piuFYVzArC2ZtwawuGPYFs8LAjBoD26sMWraqacxWNY3ZqqZRWxEcs1WnLO3fmU5b0qUxW7X6kjaO2bpXHpS2BpsPvwMAAP__sUVwWg== query T -SELECT url FROM [EXPLAIN (DISTSQL) (SELECT y FROM xyz ORDER BY z) EXCEPT (SELECT y FROM xyz ORDER BY z)] +EXPLAIN (DISTSQL) (SELECT y FROM xyz ORDER BY z) EXCEPT (SELECT y FROM xyz ORDER BY z) ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJy8mNFu4kYUhu_7FNa5SiQjmBkbiKVK2W6oGomGFLjYasWFF08TJBa7tpFCorx7hWnrjR2f3xPb3AXw5_nnZL7DMS-U_L0ljxaT6eTz0trHW-vX-ex36-vky_300-2ddXFzu1gu_pheWhf_XnM4XfF0eLZm85vJ3PrlT-v50pp8-Ty5X4KrVmTTLgz0nf9dJ-R9JUE2SbJJkU0O2eTSyqYoDtc6ScL4eMlLBtwGT-QNbNrson16fHtl0zqMNXkvlG7SrSaPlv63rZ5rP9Bxf0A2BTr1N9tsmafD83UUb7778YFsWkT-LvGsXv-48myfeta1pNWrTeE-zW-fpP6DJk-82h-L4LYWQZpEuNkk6Wa3TvuiUINrUVggZ74drEc_eXzn-jyE-lgIt9UQTmWI_D77XRgHOtbBmztld6mMKVGt8ghuVxFQpfIIwwYR7A-l_M1PHhc6nUV9VajU8hBp7z_5P02nZNNW_5VeXIvLn-PNw2P21_9nvHpPo3bLehf2wqiv3OLu3117_GZtUV9xUUPxvuz1lXGfMQgxbDGENAmRSy467DS1Qww77DSiPc1Rrao6TYsRUKWqOo1ZhMadRpyj08j6osk6oqle3zG23SDEqMUQ0iRELprs0PbaIUYd2i7bUw3Vqsr2FiOgSlXZbhahse3yHLar-qKpOqI5vWzMN7PdIMS4xRDSJEQumurQ9tohxh3artpTDdWqyvYWI6BKVdluFqGx7eoctjv1RXPqiOb2jF03iHDVWgRpEiGXzOnQ9Nohrjo03WlPM1SrKtNbjIAqVWW6WYTGpjvn_r3gnThznUThLtG1fg0YHDekgwd9KlAS7uO1vo_DdbbM6eUs47I3Ap2kp0_l6cXt7vTRMeCPsGBhxcOyCIsfYecNLMxgIRvRV01oOWxCK8XTiqXdJrBotLQcNKJHTWgFDovDHlPw_3INYFmEhywMNj3i7Rryeo1ZWgx4-oqnBegLpa5i4jagkdwIB3YDHOkNcOS3KLVUE8EBjQwHOFIc4eC4AxxJLkqN9e2RRXipxXB4SXTB9xi0db7JiBHQjW8zYgzwUqMxspWnoa0AR7byOLSVx6GtpSZrZCtPQ1t5HNoKcHRkeRzayn_BSAGGKDC2Ct5WyQ-uYOuS7zTSAXMv32mkC_BSpzGam3kaDs4AR5Mzj8PRmceRrbLUZU1sBTSyFeDIVoSjI8vjyFbJf8HIMcD5SbaAl23lR1m0db7TKDDKKr7TKPCErPihBtQd0MhWhANbAY5sBTh80uUflNGjLnjEb7Y4fNgFOHraBb8RoFPDf8EoVDp-lC3gJVsVP8sWt756_emfAAAA__8UVAb- +distribution: full +vectorized: true +· +• except +│ +├── • scan +│ missing stats +│ table: xyz@primary +│ spans: FULL SCAN +│ +└── • scan + missing stats + table: xyz@primary + spans: FULL SCAN +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJy8mNFu4kYUhu_7FNa5SiQjMzM2EEuVst1QNRINKXCxVZULL54mSCx2bSOFRHn3CqPWiR2f3xPbudsAn-efs_MdzvBM6T9b8mn67Xb25frGOru6Xq6Wf8zOrbPldDb9urIO1q-L-e_W4-HJmi-upgvrlz-tp3Nr-u3r9HYFPkU27aJQ3wQ_dEr-XyTIJkk2KbLJJZs8urMpTqK1TtMoOX7kOQeuw0fyhzZtdvE-O758Z9M6SjT5z5Rtsq0mn1bB961e6CDUiTMkm0KdBZttvszj4ekyTjY_guRANi3jYJf61sA5rjzfZ751KenuxaZonxWPT7PgXpMvXuyPRfA6iyBNIlxt0myzW2eOKNXgUpQWKJjvB-shSB_e-XwRQn0shNdpCLc2RPGc_S5KQp3o8M2T8qfUxpSoVkUEr68IqFJFhFGLCPaHUv4WpA9Lnc1jR5UqtTrE2v_P_S-zGdm01X9nZ5fi_Odkc_-Q_-v_M16_p3G3Zb2JBlHsKK-8-3fXnrxZWzRXXDRQ3JEDRxn3GYMQow5DSJMQheSix07TOMSox04jutMc1aqu03QYAVWqrtOYRWjdacRndBrZXDTZRDQ1cFxj2w1CjDsMIU1CFKLJHm1vHGLco-2yO9VQreps7zACqlSd7WYRWtsuP8N21Vw01UQ0d5CP-Wa2G4SYdBhCmoQoRFM92t44xKRH21V3qqFa1dneYQRUqTrbzSK0tl19hu1uc9HcJqJ5A2PXDSJcdBZBmkQoJHN7NL1xiIseTXe70wzVqs70DiOgStWZbhahtenuZ_9e8E6chU7jaJfqRr8GDI8b0uG9PhUojfbJWt8m0Tpf5vTnPOfyF0KdZqd35emP693prWPA17BgYcXDsgyL17D7BhZmsJCt6Is2tBy1oZXiacXSXhtYtFpaDlvR4za0AofFZY8p-P_yDGBZhkcsDDY95u0a8XpNWFoMefqCpwXoC5WuYuI2oJHcCAd2AxzpDXDkt6i0VBPBAY0MBzhSHOHguAMcSS4qjfXtkUV4pcVweEV0wfcYtHW-yYgx0I1vM2IC8EqjMbKVp6GtAEe28ji0lcehrZUma2QrT0NbeRzaCnB0ZHkc2sp_wUgBhigwtgreVskPrmDrku800gVzL99ppAfwSqcxmpt5Gg7OAEeTM4_D0ZnHka2y0mVNbAU0shXgyFaEoyPL48hWyX_ByAnA-Um2hFdt5UdZtHW-0ygwyiq-0yhwQ1b8UAPqDmhkK8KBrQBHtgIc3nT5izK66oIrfrvF4WUX4Oi2C34jQKeG_4JRqHT8KFvCK7YqfpYtb_3u5ad_AwAA__8MwAGf # EXCEPT ALL and EXCEPT with a projection on the result. query T -SELECT url FROM [EXPLAIN (DISTSQL) SELECT x FROM ((SELECT x, y FROM xyz) EXCEPT ALL (SELECT x, y FROM xyz))] +EXPLAIN (DISTSQL) SELECT x FROM ((SELECT x, y FROM xyz) EXCEPT ALL (SELECT x, y FROM xyz)) ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJzEllFr4kwUhu-_XzGcK4WROJNoa-CDlq7LCm7tVi8KJRepma2CNdmZCNrS_76YtFijzsnsYHI5Os_MO-c8kPMG6s8CfBj3h_2bCVnJBfl-P_pJHvsPd8PrwS1pfBuMJ-Nfwyb52LLONzQan2tKNvlP681rk_Qfbvp3E3I9HJLjO5oBUFjGkbgNX4QC_xEYUOBAwQUKHlDoQEAhkfFUKBXL7Za3DBhEa_DbFObLZJVufw4oTGMpwH-DdJ4uBPgwCZ8W4l6EkZBOGyhEIg3ni-ya9eb1KpHzl1BugMI4CZfKJy1ne_NolfrkitErDsE7hXiVftywO_hpQ2ahmu0f-YkEFFQaPgvw2Tv9t7CdGsLyk2F3R62WsYyEFNHeYcGWxLYcefGPUM3GIh0lDit0Z7JJhP_FHqCwEL_TRpa6-b-cP88-F7saFAqwe5lr8bIjsW_jVpw4rFOswdG7vb27WXkFWAkFHN5y3DMaaxC3W0tcfjJuBc6y6pzl5RvByzTCbTneGb0xiHtRS1x-Mm4F3vDqvHHLN8It0wivlX2azuWNQdzLWuLyk3Er8MatzhuvfCO8Mo3otM5ojUHYXg1h-cmwFTjj1TNXHQl1L1QSL5UoNTW1t88S0bPIy6TilZyKOxlPs2vy5Sjjsq9-JFSa_8vzxWCZ_7UNWB7u2sA9G5hZ5WYdPc0MSsbN4K4N3LOBmVXuQskOaF6k219pV19vVwuz_Zq1i7RnI7geRgTXw4jgehgTHKERwTs2guthRHA9jAiuhzHBERoRvGsj-IWNonoYUVQPI4rqYUxRhEYUvbRRVA8jiuphRFE9jCmK0IiiPRtFmdWcgNCIpAiNWIrQmKYYjs0KdsOC3bRgNy5Yzgt2AwOzmhjYwchgZKuexmzV05itehq1FcExW02GpcOemUxLpjRmq9G8ZIxjth4MD1pbg_f__gYAAP__B2KH9g== +distribution: full +vectorized: true +· +• except all +│ +├── • scan +│ missing stats +│ table: xyz@primary +│ spans: FULL SCAN +│ +└── • scan + missing stats + table: xyz@primary + spans: FULL SCAN +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJzEllFr4kwUhu-_XzGcK4WROJNoa-CDlq7LCm7tVi8Kixepma2CTbKZCKal_31JsmKNOiezg8nlJHlm3jnngZx3kL_X4MLw6WF8O7onrS-j6Wz6Y9wm0-F4eDcjW_L1cfKdtFq7NSVp8WibvrXJ8Olu-DAjt-MxOf1FGygEoS_uvVchwf0JDChwoGADBQco9GBOIYrDhZAyjLNP3nNg5G_B7VJYBdEmyR7PKSzCWID7DskqWQtwYeY9r8Wj8HwRW12g4IvEW63zY7bp200Ur169OAUK08gLpEs6VnbyZJO45IbRGw7zDwrhJvl7wn7j55QsPbk83HKHzCnIxHsR4LIP-m9hew2E5WfD7rfaBGHsi1j4B5vNMxL75MSNv3lyORXJJLJYqTuzNBLuJ3mAwlr8Slp56vb_8epluVvsa1AqwP5mtsHNTsS-DzthZLFeuQYnz3YOzmbVFWAVFLB4x7IvaKxG3H4jcfnZuDU4y-pzlldvBK_SCLtjORf0RiPuVSNx-dm4NXjD6_PGrt4Iu0ojnE7-a7qUNxpxrxuJy8_GrcEbuz5vnOqNcKo0ote5oDUaYQcNhOVnw9bgjNPMXHUi1KOQURhIUWlq6mbXEv6LKMokw028EA9xuMiPKZaTnMv_-r6QSfGWF4tRULzKAlaH-ybwwARmRrlZT00zjZJxPbhvAg9MYGaUu1SyI5qX6e5n2lbX21bC7LBm3TLtmAiuhhHB1TAiuBrGBEdoRPCeieBqGBFcDSOCq2FMcIRGBO-bCH5loqgaRhRVw4iiahhTFKERRa9NFFXDiKJqGFFUDWOKIjSi6MBEUWY0JyA0IilCI5YiNKYphmOzgtmwYDYtmI0LhvOC2cDAjCYGdjQyaNmqpjFb1TRmq5pGbUVwzFadYem4ZzrTki6N2ao1L2njmK1Hw4PS1vnHf38CAAD___1ogpc= query T -SELECT url FROM [EXPLAIN (DISTSQL) SELECT x FROM ((SELECT x, y FROM xyz) EXCEPT (SELECT x, y FROM xyz))] +EXPLAIN (DISTSQL) SELECT x FROM ((SELECT x, y FROM xyz) EXCEPT (SELECT x, y FROM xyz)) ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJzEmFFv4jgUhd_3V0T3qZWMwHYCNNJKHc2w2kps2y08jDTiIQPeFokhbBKkMlX_-wrYKoWQe2ySdB5N8sXHF5-T67xQ-u-CQhoNhoPPY2-dLLw_Hu7-8r4Nvt4PP93cehdfbkbj0d_DS-__W573N1xcvI2Ft9n_9Lz5eekNvn4e3I-901cvJyRoGc_MbfTDpBR-I0mCFAnSJMgnQQFNBK2SeGrSNE62t7zsgJvZM4UdQfPlap1tf54ImsaJofCFsnm2MBTSOPq-MA8mmpmk3SFBM5NF88VumufNz-tVMv8RJRsSNFpFyzT0Wu3tzHfrLPSupbhWNHkVFK-zfIY0ix4NhfJVnKciqFOFclHxZZ5m8-U0a8ujSpyaI8e-b7ynKH06jeRS9HlSggak-KVS8ketl3EyM4mZHTxs95RSscqibrmKoCkVFiXLVXQrqBBnCf0zSp9GJrtbtfVRvcablQnf0uDTcEiCFuaf7GK3gsvfk_nj09sg3_6lK-vVW9_buBWv2jo4rsHJufsHc0t790sL97dVq63PSSEHHd16dSgXHbn5ZeM5ZC2l23gOyfoSwKJuZTlUowqLkpXlkJuKyjkkPy6HlL0HlY0Hdavtn5MFDjp69epQLjpyA6rGs8BaSq_xLFD1udCibmVZUKMKi5KVZYGbispZoD4uC7S9B7WNB_3W7vTgnAUOOvr16lAuOnID6sazwFpKv_Es0PW50KJuZVlQowqLkpVlgZuKylmgPy4LfHsP-jYeDFrnJIGDiqs6VSgXFbn5_MZzwFrKVeM54NfnQIu6leVAjSosSlaWA24qKueA_2u-U5wQ9WDSVbxMjdVXiM52WWb2aPZlSuN1MjX3STzdTbMf3u243Q8zk2b7q2o_uFnuL20FvoclC2seVsewfA_7B7B0g6WqRF9VoVW3Cq01T2uWDqrAstLUqlOJ7lWhNdgsPrtNwf8VOMDqGO6yMFh0j3dXl7dXn6Vlh6eveFqCXCikiou3AY3MjXDgboAjewMc-VsWItXF4IBGDgc4sjjCwXYHODK5LATr4ZZFeCFiOLxgdMlnDFo6HzKyB-zGx4zsA7wQNE5u5WnoVoAjt_I4dCuPQ7cWQtbJrTwN3crj0K0AR1uWx6Fb-ReMkqCJAm2r5N2q-MYVLF3xSaN80PfySaMCgBeSxqlv5mnYOAMcdc48DltnHkduVYWUdXEroJFbAY7cinC0ZXkcuVXxLxjVBzjfyR7hRbfyrSxaOp80GrSymk8aDU7Imm9qQN0BjdyKcOBWgCO3AhyedPmDMjrqgiN-tcnhYRfg6LQLvhGgXcO_YDQqHd_KHuEFt2q-lz1e-uT1t_8CAAD__w66JZM= +distribution: full +vectorized: true +· +• except +│ +├── • scan +│ missing stats +│ table: xyz@primary +│ spans: FULL SCAN +│ +└── • scan + missing stats + table: xyz@primary + spans: FULL SCAN +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJzEmFFv4kYUhd_7K6z7lEiDYGZsIJYqZbVL1Ug0SQMPK1V58MI0QWIxtY0UNsp_rwBFXmx8zwy2s4_G-XzP3Mw5vuNXSv9bUkijr_fjTze33sWXm8l08vf40puMxqPPU-_F--Ph7i_v4uL9Wnjbw08v2x-X3ujr59H91Dt995IEreK5uY2-m5TCf0iSIEWCNAnySVBAj4LWSTwzaRonuz953QM38xcKe4IWq_Um2_38KGgWJ4bCV8oW2dJQSNPo29I8mGhukm6PBM1NFi2W-zIv2x_X62TxPUq2JGiyjlZp6HW6u8p3myz0rqW4VvT4JijeZHmFNIueDIXyTZynImhShXJR8WWRZovVLOvKQidO1cixb1vvOUqfTyO5FH2elKAFKX6llPxRm1WczE1i5kcP2z-lUqyy6FuuImhLhUXLchX9GirEWUL_jNLnicnu1l1d6Nd0uzbhexh8Go9J0NL8m13sV3D5e7J4en6_yLd_5coGzfb3Nu7E664Oij04WXt4VFvau19auL-rOl19Tgo56Og3q0O56MjNL1vPIWsp_dZzSDaXABZ9q8qhBlVYtKwqh9xU1M4h-XE5pOw9qGw8qDtd_5wscNAxaFaHctGRG1C1ngXWUgatZ4FqzoUWfavKggZVWLSsKgvcVNTOAvVxWaDtPahtPOh39qcH5yxw0DFsVody0ZEbULeeBdZShq1ngW7OhRZ9q8qCBlVYtKwqC9xU1M4C_XFZ4Nt70LfxYNA5JwkcVFw1qUK5qMjN57eeA9ZSrlrPAb85B1r0rSoHGlRh0bKqHHBTUTsH_F_zneKEqAeTruNVaqy-QvR2yzLzJ3NoUxpvkpm5T-LZvszh8m7P7X-YmzQ73FWHi5vV4dZO4M-wZGHNw6oIy59h_wiWbrBUteirOrTq16G15mnN0kEdWNYqrXq16EEdWoPN4rPbFPy_AgdYFeE-C4NFD3h39Xl7DVla9nj6iqclyIVSqrh4G9DI3AgH7gY4sjfAkb9lKVJdDA5o5HCAI4sjHGx3gCOTy1KwHm9ZhJcihsNLRpd8xqCl8yEjB8BufMzIIcBLQePkVp6GbgU4ciuPQ7fyOHRrKWSd3MrT0K08Dt0KcLRleRy6lX_BKAmGKDC2St6tih9cwdIVnzTKB3MvnzQqAHgpaZzmZp6GgzPA0eTM43B05nHkVlVKWRe3Ahq5FeDIrQhHW5bHkVsV_4JRQ4Dzk2wBL7uVH2XR0vmk0WCU1XzSaHBC1vxQA_oOaORWhAO3Ahy5FeDwpMsflNFRFxzx6xWHh12Ao9Mu-EaAdg3_gtGodfwoW8BLbtX8LFtc-uPbb_8HAAD__-F9IDQ= diff --git a/pkg/sql/opt/exec/execbuilder/testdata/geospatial b/pkg/sql/opt/exec/execbuilder/testdata/geospatial index ad72a1ae2211..4570104135fe 100644 --- a/pkg/sql/opt/exec/execbuilder/testdata/geospatial +++ b/pkg/sql/opt/exec/execbuilder/testdata/geospatial @@ -77,5 +77,5 @@ CREATE TABLE rtable( ) statement ok -SELECT url FROM [EXPLAIN (DISTSQL) -SELECT ltable.k, rtable.k FROM ltable JOIN rtable@geom_index ON ST_Intersects(ltable.geom, rtable.geom)] +EXPLAIN (DISTSQL) +SELECT ltable.k, rtable.k FROM ltable JOIN rtable@geom_index ON ST_Intersects(ltable.geom, rtable.geom) diff --git a/pkg/sql/opt/exec/execbuilder/testdata/inverted_filter_geospatial b/pkg/sql/opt/exec/execbuilder/testdata/inverted_filter_geospatial index c7ecf59c45f2..19590968716c 100644 --- a/pkg/sql/opt/exec/execbuilder/testdata/inverted_filter_geospatial +++ b/pkg/sql/opt/exec/execbuilder/testdata/inverted_filter_geospatial @@ -12,14 +12,50 @@ CREATE TABLE geo_table2( ) query T -SELECT url FROM [EXPLAIN (DISTSQL) SELECT k FROM geo_table2 WHERE ST_Intersects('POINT(3.0 3.0)'::geometry, geom)] +EXPLAIN (DISTSQL) SELECT k FROM geo_table2 WHERE ST_Intersects('POINT(3.0 3.0)'::geometry, geom) ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJyUk99v0zAQx9_5K6x7WSuZ1U6KQH4KPzII6trSVgI0R1WojxKR2sF2UVDV_x0lGXTd1G7JgyXf3cf39Te-HbhfBQiYx6P47YJsbUGuZpNrchN_mY5eJ2PSe5fMF_NPoz65LfnZFqzRLH32rcCAfP4Qz2Li_DLXHq3DlXe9i-kkGS964SUj4SXrXwjxPp5cx4vZV1qjm34KFLRROM426EDcAIeUQmnNCp0ztg7tmoJEVSAYhVyXW1-HUworYxHEDnzuCwQBi1rIDDOFdsCAgkKf5UVz7EFnVPdd5lphBRTmZaadIAMJb6SsvispK86krNhjCzzvynAJJNOKhIwY_wOtAwqTrRck4jQKaRRAuqdgtv5wQeezNYLge_p0ExL9G61HdZUXHi3aAT924l8-rkpLjCZRIIirXSDOZ9aL5lbhyxdSsoBJydhjCxDUqitWm3HajdNWBF2s-GhyffscgpPPobT5JrN_ntY-7NL-_x8Ij5u3cXF_VBhnnD38Xg0f7C_E3TmKgv5B_Enlwy7KZ-hKox0e6T51MtunFFCtsR1WZ7Z2hVNrVk2bdjtpuCag0Pk2y9tNottULfAuzM_CwXk4OAuH5-HwLDy8B6f7Z38DAAD__-v9pS4= +distribution: local +vectorized: false +· +• filter +│ filter: st_intersects('010100000000000000000008400000000000000840', geom) +│ +└── • index join + │ table: geo_table2@primary + │ + └── • inverted filter + │ inverted column: geom_inverted_key + │ num spans: 31 + │ + └── • scan + missing stats + table: geo_table2@geom_index + spans: 31 spans +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJyUk8-O0zAQxu88hTWXtpLZ2kkRyKfwJwtB3ba0lQDhqgr1UCJaO9guCqr67igJ0O2ukt3kYGlm8vN8_uw5gvu5AwHxp9n4ZTIh_TfJYrn4MB6QRTyOXy_JD3I9n96QLZq1T7_uMCAf38XzmDi_zrRH63DjXb83myaTZT-8YiS8YoOeEG_j6U28nH-mJbofAAVtFE7SPToQX4DDikJuzQadM7ZMHasfElWAYBQynR98mV5R2BiLII7gM79DELAsdcwxVWiHDCgo9Gm2q7Y9y4zKtutMKyyAwiJPtRNkKOGVlMU3JWXBmZQFe2iBp10ZLoGkWpGQEeO_o3VAYXrwgkScRiGNAlidKJiDPx_Q-XSLIPiJPt6ERP9C61FdZzuPFu2QXzrxrx4XuSVGkygQxJUuEOdT60V1qvD5MylZwKRk7KEFCGrVFSvNaHaj2YqgixXvTab_Poeg8TnkNtun9vfj2odd2v-_gfCyeZ0XdyeFccbZ_e_F6F7cE7fHKAoGZ_GNykddlM_R5UY7vNDdtDM7rSig2mI9rM4c7AZn1myqNnU4rbgqodD5usrrINF1qRR4G-atcNAOB61w2A6HrfDoDrw6PfkTAAD___DFn88= query T -SELECT url FROM [EXPLAIN (DISTSQL) SELECT k, k_plus_one FROM geo_table2 WHERE ST_Intersects('POINT(3.0 3.0)'::geometry, geom)] +EXPLAIN (DISTSQL) SELECT k, k_plus_one FROM geo_table2 WHERE ST_Intersects('POINT(3.0 3.0)'::geometry, geom) ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJyUk99v0zAQx9_5K6x7aSuZ1UmKQH4KPzII6trSVgI0R1WojxIttYPtoKCq_ztKMti6KR3JgyWf7-P7-pu7A9ifOXBYRdPo7ZqUJieXy_kVuY6-LKav4xkZvotX69Wn6YjcptxQcrMp8tJutMI2eYd649JvOfrk84doGRHrNplyaCxunR0OFvN4th4GF4wEF2w04Px9NL-K1suvtEb3owQoKC1xlu7RAr8GDxIKhdFbtFabOnRoEmJZAWcUMlWUrg4nFLbaIPADuMzlCBzWtZAlphLNmAEFiS7N8ubaO51hXXeTKYkVUFgVqbKcjAW8EaL6LoWoPCZExZ5a4HlfxhNAUiVJwIh2P9BYoDAvHSehR8OAhj4kRwq6dHcPtC7dIXDvSP_fhFj9QuNQXma5Q4Nm7J068fc8qgpDtCKhz4mtXSDWpcbx5lXByxdCMJ8JwdhTCxBUsi9Wm9HtRrcVfh8rPupM3baD39kOhcn2qfl9Up6GQaeCoI-Cfz8hOK3fxvnDaWEe89jj79Xk0X7A749S6I9OmqlT_KSP-CXaQiuLJ9K7bmbHhALKHbYja3VptrgwetuUabfzhmsCEq1rT712E6v2qBZ4H_bOwv552D8LB-fh4Cw8eQAnx2d_AgAA__8CMKrn +distribution: local +vectorized: false +· +• filter +│ filter: st_intersects('010100000000000000000008400000000000000840', geom) +│ +└── • index join + │ table: geo_table2@primary + │ + └── • inverted filter + │ inverted column: geom_inverted_key + │ num spans: 31 + │ + └── • scan + missing stats + table: geo_table2@geom_index + spans: 31 spans +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJyUk9-PEjEQx9_9K5p5OUjq0W4xmj6tP_Z0DQcIJGosISsdcXNLu7bFrCH872Z31Tvuspzw0GRm-HS-_e7MHvyPAiQkn6ajl-mY9N6k88X8w6hP5skoeb0gN5TcrMpi51fWILmaTa7JBu0qZF8LjMjHd8ksIT6schPQeVwH37uYTtLxoicuGRGXrH8h5dtkcp0sZp9pjW77QMFYjeNsix7kF-CwpFA6u0bvratT--YPqa5AMgq5KXehTi8prK1DkHsIeSgQJCxqHTPMNLoBAwoaQ5YXzbW3MuO67So3GiugMC8z4yUZKHilVPVNK1VxplTFHjvg6bkMV0Ayo4lgxIbv6DxQmOyCJDGnsaBxBMsDBbsLtw_0IdsgSH6g_29Can6iC6iv8iKgQzfgx078rSdV6Yg1JI4k8bULxIfMBdm8Sjx_phSLmFKMPXYAQaPPxWozut3otiI6x4r3Njd_xiHqHIfS5dvM_TpqT2PRqUCco-DfRxDH_du8vL8sjDPOHv5eDB_EF_LuJsVR_2iYOsUPzxE_Q19a4_FIetfN7LCkgHqD7cp6u3NrnDq7btq04aThmoRGH9oqb4PUtKVa4F2Yn4Sj03B0EhanYXESHt6Dl4cnvwMAAP__phyliA== query T EXPLAIN SELECT k, k_plus_one FROM geo_table2 WHERE ST_Intersects('POINT(3.0 3.0)'::geometry, geom) diff --git a/pkg/sql/opt/exec/execbuilder/testdata/inverted_join_geospatial b/pkg/sql/opt/exec/execbuilder/testdata/inverted_join_geospatial index d712561870b6..01f29608dc13 100644 --- a/pkg/sql/opt/exec/execbuilder/testdata/inverted_join_geospatial +++ b/pkg/sql/opt/exec/execbuilder/testdata/inverted_join_geospatial @@ -19,10 +19,27 @@ CREATE TABLE rtable( ) query T -SELECT url FROM [EXPLAIN (DISTSQL) -SELECT lk, rk1 FROM ltable JOIN rtable@geom_index ON ST_Intersects(ltable.geom1, rtable.geom)] +EXPLAIN (DISTSQL) +SELECT lk, rk1 FROM ltable JOIN rtable@geom_index ON ST_Intersects(ltable.geom1, rtable.geom) ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJyUksGO0zAQhu88xWhOW2lgm3Th4FMQFCmr0ixtD0iraBWSUWWa2sF2UFHVd0e2K5YUWm1vmfH_jT9NvEf7o0WBy-ls-mEFvWnh06L4DI_Trw-z9_kcbj7my9Xyy2wEx0i7ITCbJMZaV31rGe6LfA4mfGdr1tsnqRreQTEH656kcmws187exPgbH0noCIRqVCKh0g3Pqy1bFI-YYEnYGV2ztdr41j4E8maHYkwoVdc73y4Ja20YxR6ddC2jwJWfu-CqYXM7RsKGXSXbMDYaZJ2R28r8QsJlVykr4DUSFr0TkCWUpVgeCHXvnq-wrloziuRAL9fI1U82jpt7LRWb22Ro8s-6kP4Q011nTlaXpQTZ3WigSdmEsrdnZdNrZL3kcWXpf0WfVzbTetN38F1LBVoJ8BZ3Xuz0dwfndwPnyVnbyTW2C7adVpYHpucmjw8lITdrjq_I6t7U_GB0Ha6JZRG40GjYuniaxCJX8cgL_g0nF-H0MpxehCcncHl49TsAAP__Nmgycw== +distribution: local +vectorized: true +· +• lookup join +│ table: rtable@primary +│ equality: (rk1, rk2) = (rk1,rk2) +│ equality cols are key +│ pred: st_intersects(geom1, geom) +│ +└── • inverted join + │ table: rtable@geom_index + │ + └── • scan + missing stats + table: ltable@primary + spans: FULL SCAN +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJyUksGO0zAQhu88xWhOW2lgm3Th4JMRFCmr0ixtD0goWoV4VJmmdrAdVFT13ZGdFUsLregtM55v_OmP9-i_tyhw-vlh9raYw837YrlafpqNYDmdTd-toN0QuE0GHxblR2hD_bVluC-LObj0Lddst4_aKN5BOQcfHrUJ7Dw3wd8M46_iSEZPQKpGSGis4nm9ZY_iC2ZYEXbONuy9dbG1TwOF2qEYE2rT9SG2K8LGOkaxx6BDyyhwFdcuuFbsbsdIqDjUuk1rBwHZOb2t3U8kXHa18QJeImHZBwEyI5ljdSC0fXi-wod6zSiyA_2_RmF-sAus7q027G6zY5O_0kL6TUx3nTtJTuYE8m50pElyQvL1Wdn8Gtko-RRZ_k_R58hm1m76Dr5ZbcAaAdHiLoqd_u3k_ObIeXLWdnKN7YJ9Z43nI9Nzm8eHipDVmodX5G3vGn5wtknXDGWZuNRQ7MNwmg1FYYajKPgnnF2E88twfhGenMDV4cWvAAAA__-3vS0U query T EXPLAIN SELECT lk, rk1, rk2, rtable.geom diff --git a/pkg/sql/opt/exec/execbuilder/testdata/lookup_join b/pkg/sql/opt/exec/execbuilder/testdata/lookup_join index 416e56724628..851399af44d6 100644 --- a/pkg/sql/opt/exec/execbuilder/testdata/lookup_join +++ b/pkg/sql/opt/exec/execbuilder/testdata/lookup_join @@ -213,12 +213,29 @@ vectorized: true spans: FULL SCAN query T -SELECT url FROM [EXPLAIN (DISTSQL) +EXPLAIN (DISTSQL) SELECT * FROM (SELECT * FROM data WHERE c = 1) AS l -NATURAL JOIN (SELECT * FROM data WHERE c > 0) AS r] +NATURAL JOIN (SELECT * FROM data WHERE c > 0) AS r ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJzEld9r2z4Uxd-_f8XlPrVfZGz5R5sKBg5bylIyp0syNuj84MWi8-ZanmzDRsn_Pmx3aVwSyUtC9ijlnpxz_TmgRyx-pMhwPpqMXi-gkilcz6bv4G706XYyHAdw9mY8X8zfT87haeT_duCse4yjMoKPb0ezESzhFdBzGM4hhWC4-DAbTuBmWv-VQvK5siyHg9XoZIgEMxHzIHrgBbI7pEjQRoIOEnSRoIchwVyKJS8KIeuRx0Ywjn8iswgmWV6V9XVIcCkkR_aIZVKmHBkuoi8pn_Eo5tK0kGDMyyhJG5s6kp_L5CGSv5DgPI-ygoFhUoiyGCiI8iuXGK4Iiqp8dijK6J4joyvSP8V1kpZccml63QjtPQPfqT8jY2wcLAY7Le2_sbwRSfa0N1UvPhHie5XDN5FkIDIGPiW-TXyH-PXHnwbgX66J_YlIcFqV3dFdqZ2dqZ_DVpmQMZc87gQNV1v2CoQhcpN6Lya3e7sdb9q_KrRPVUxqmPYeZdHkWJfl4nhl0VhulkW9-knLYvcHZvcCZhumswcwTY41sMvjAdNYbgJTr35SYE5_YE4vYI5hunsA0-RYAxscD5jGchOYevWTAnP7A3N7AXMN09sDmCbHGtjV8YBpLDeBqVf_Z-_nltQzXuQiK3iv19Gq31ce3_P2MS5EJZf8VoplY9Mep42uuYh5Uba_0vYwztqf6oCbYqoU22qxrRQ7HTF9KXbUsS_U1q5S7anFnlKscb44ZOlLpXigdh4oxVdq8dUhsammY7qSqVtGNTWjB_WMaormaszVTaOaqlF1115mD1f__Q4AAP__Rs1urw== +distribution: full +vectorized: true +· +• lookup join +│ table: data@primary +│ equality: (a, b, c, d) = (a,b,c,d) +│ equality cols are key +│ pred: c > 0 +│ +└── • filter + │ filter: c = 1 + │ + └── • scan + estimated row count: 100,000 + table: data@primary + spans: FULL SCAN +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJzElV-P0kwYxe_fT_Hkudp9M007_bMLk5iUKBvZYFkBo4lyUelkrXY7ddomGsJ3N22VpQRmKhC8nOmcnvPM7ySzwvx7ggyHHx7Gg1EAV69Gs_ns7fgaZsPx8OUc_oe76eQNXLWXUViE8P71cDqEJbwAeg2DGSQQDObvpoMx3E-qXykkn0rLcjhYtU4iwVREPAifeI7sI1IkaCNBBwm6SNDDBcFMiiXPcyGrI6taMIp-ILMIxmlWFtX2guBSSI5shUVcJBwZzsPPCZ_yMOLStJBgxIswTmqbKpGfyfgplD-R4CwL05yBYVII0wgoiOILl7hYExRl8eyQF-EjR0bXpHuKuzgpuOTS9NoRmn0GvlPdImNsFMx7By3tv7G8F3H6e26qHnwsxLcyg68iTkGkDHxKfJv4DvGry58E4N9ugP2JSHBSFu2jh1I7B1M_hy1TISMuedQKuljvmSsQhshM6u2c3O_ttrxp96rQLlUxqWHaR5RFk2NTlpvzlUVjuV0W9egXLYvdHZjdCZhtmM4RwDQ5NsBuzwdMY7kNTD36RYE53YE5nYA5hukeAUyTYwOsdz5gGsttYOrRLwrM7Q7M7QTMNUzvCGCaHBtg_fMB01huA1OP_s_ezz2ppzzPRJrzTq-jVb2vPHrkzWOci1Iu-YMUy9qmWU5qXb0R8bxovtJmMUqbT1XAbTFVim212FaKnZaY7ooddewbtbWrVHtqsacUa5xvThn6VinuqZ17SnFfLe6fEptqOqYrmbplVFMzelLPqKZorsZc3TSqqRpVd203-2L9368AAAD__3AfaVA= statement ok CREATE TABLE books (title STRING, edition INT, shelf INT, PRIMARY KEY (title, edition)) @@ -336,9 +353,33 @@ start_key end_key replicas lease_holder NULL NULL {5} 5 query T -SELECT url FROM [EXPLAIN (DISTSQL) SELECT DISTINCT authors.name FROM books AS b1, books2 AS b2, authors WHERE b1.title = b2.title AND authors.book = b1.title AND b1.shelf <> b2.shelf] +EXPLAIN (DISTSQL) SELECT DISTINCT authors.name FROM books AS b1, books2 AS b2, authors WHERE b1.title = b2.title AND authors.book = b1.title AND b1.shelf <> b2.shelf ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJyck1Fv2jAQx9_3Kbx7SiS34CRQKVIlo8JUJhY6QNqkioeEXCFrsDPbkTYhvvuUhK4ENaH0zee739__O9s70L9T8GE-mozuFiRXKfkym34jj6OfD5PBOCDWcDxfzL9PbHIoKeJxcLcgYW42UulrEW6xgiIpnzUZzEnEaBU4ZeTQl2Ly4340GxHLiti1SUyK5JZETrW0ySAYEutFtuCL7KHQPqQjdq03mD6RzyVZru0lUBAyxiDcogb_ERhQ6MGSQqbkCrWWqtjelUXj-A_4XQqJyHJTbC8prKRC8HdQHgU-BPJKZp0-UIjRhElalu0pyNy8QtqEawT_Zk-PhFm78CKMUpxhGKPqdGvyUA6MZyrZhuovUJhnodA-uQIK09z4hDPKXWhywT7qgtVdHMZ_xofT6MNp9PF6fC6kilFhfDrf8yVvNHMf6s1XmQhUHafeS4pPxuLMvlXJemMs7ti1Hih3KfcaO3EvmWhh4DBQ941rdY7mOZHyOc_IL5kIIoVPuFe4Cgh3ijfNb_57bL5s7xJrw0SbRKxMx6sb46xRv_ch_d679fs1_TN_cYY6k0Ljuz5jt3ghGK-xenFa5mqFD0quymOqcFpy5UaM2lTZmyoYiypVGDyGWSvs1mB2CjsXwM4p7LbCXrttrxXutcO9VrjfDvdb4e4JvNx_-hcAAP__NdMdAw== +distribution: full +vectorized: true +· +• distinct +│ distinct on: name +│ +└── • lookup join + │ table: books2@primary + │ equality: (book) = (title) + │ pred: shelf != shelf + │ + └── • hash join + │ equality: (title) = (book) + │ + ├── • scan + │ estimated row count: 100 + │ table: books@primary + │ spans: FULL SCAN + │ + └── • scan + estimated row count: 100 + table: authors@primary + spans: FULL SCAN +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJyck9Fv2j4Qx99_f4V_95RIbsFJAClSJaPCVCYWOkDapImHhFwha7Az25E2If73KQldCWpC6ZvPd5-vv3e296B_peDD-PvjdDgJiDWaLJaLr1ObLMbT8f2SFPEkuF-SMDdbqfStCHdIPs1nX0gk5bMmwwWJGK0Cp4wc-lJMvj2M52NiWRG7NYlJkdyRyKmWNhkGI2K9yBZ8kT0W2sd0xG71FtMn8n9JlmsbKAgZYxDuUIP_AxhQ6MGKQqbkGrWWqtjel0WT-Df4XQqJyHJTbK8orKVC8PdQngQ-BPJGZp0-UIjRhElalh0oyNy8QtqEGwR_cKAnwqxdeBlGKc4xjFF1ujV5KOfFM5XsQvUHKCyyUGif3ACFWW58whnlLjS5YB91weoujtO_4MNp9OE0-ng9PhdSxagwPp_v5ZI3mnkI9fazTASqjlPvJcUnY3Fm36lkszUWd-xaD5S7lHuNnbjXTLQwcByo-8a1OifznEr5nGfkp0wEkcIn3CtcBYQ7xZPmg38emy_bu8baKNEmEWvT8erGOGvU731Iv_du_X5N_8JfnKPOpND4rs_YLV4IxhusXpyWuVrjo5Lr8pgqnJVcuRGjNlV2UAUTUaUKg6cwa4XdGszOYecK2DmH3VbYa7fttcK9drjXCvfb4X4r3D2DV4f__gYAAP__TEsXpA== query T EXPLAIN (VERBOSE) SELECT a.name FROM authors AS a JOIN books2 AS b2 ON a.book = b2.title ORDER BY a.name @@ -394,9 +435,24 @@ vectorized: true spans: FULL SCAN query T -SELECT url FROM [EXPLAIN (DISTSQL) SELECT * FROM authors INNER JOIN books2 ON books2.edition = 1 WHERE books2.title = authors.book] +EXPLAIN (DISTSQL) SELECT * FROM authors INNER JOIN books2 ON books2.edition = 1 WHERE books2.title = authors.book ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJyUkd9r1EAQx9_9K4Z5Upm2l5wVWShENGLKmdTcgULJQ3o71LXpTtzdgHLc_y5J7vBOuGjfMj8-33yS2aD_0aDCZbpI362gcw18KItPcJt-vVm8zXJ4_j5brpafFy9gt_JyXKi78E2chyzP0xKuiyyHO5EHH0OxfzpnbYIRC1cQwZePaZnuB8GEhuFqH3LetysktKI5rx_Zo7rFCAkvsSJsnazZe3F9ezMsZfonqhmhsW0X-nZFuBbHqDY4hKPCXM6kvYiRUHOoTTOsbQmlC38gH-p7RjXf0kFwNB28qu8aLrnW7C5mR_G4-6Ckdeaxdr-QcNnW1is4Q8KSrWanIFJKZfnqDUESESQxnrKKnmJ1LcbupKJjqfGnHzgtRB66Fr6LsSBWQTKnpGeKLihIYurrV5RcUvL6pFt85PaPU5TsW7Ge_-sWs21FyPqex3N76dyab5ysh9eMZTFwQ0OzD-N0PhaZHUe94CEcTcLxNBxPwrO_4Gr77HcAAAD__0XeE20= +distribution: full +vectorized: true +· +• lookup join +│ table: books2@primary +│ equality: (book, lookup_join_const_col_@7) = (title,edition) +│ equality cols are key +│ +└── • render + │ + └── • scan + estimated row count: 100 + table: authors@primary + spans: FULL SCAN +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJyUkd-L00AQx9_9K4Z5Upm7a1JPZOFgRSPmqMmZFhSkD3vd4VyvtxN3N6CU_u-S5Iqt0KpvmR-fbz7JbDB-X6PC4vPN7HVZwdO35Xwx_zh7BvNiVrxZwHN419QfwHTpq4QIZVUVDVzXZQW3Ivcxh3r3dM7WJSceriCDT--LptgNkktrhqtdyHnfRkIvlivzwBHVF8yQ8BKXhG2QFccooW9vhqXS_kA1IXS-7VLfXhKuJDCqDQ7ZqLCSM2kvciS0nIxbD2tbQunSbygmc8eoplvaC85OBy_M7ZobNpbDxeQgHh-_R7fBPZjwEwnnrfFRwRkSNuwtBwWZUqqsFq8IdEagczxmlf2P1bU4_yiVHUqN_3zPaSZy37XwTZwH8Qr0lHTP1F1SoHPq6xekL0m_POqWH7j95RQNx1Z85H-6xWS7JGR7x-O5o3RhxTdBVsNrxrIeuKFhOaZxOh2L0o-jXnAfzk7C-Wk4PwlP_oCX2ye_AgAA__98nw4O #################################### # LOOKUP JOIN ON SECONDARY INDEX # @@ -546,9 +602,22 @@ vectorized: true spans: FULL SCAN query T -SELECT url FROM [EXPLAIN (DISTSQL) SELECT t1.a, t2.b FROM small t1 LEFT JOIN large t2 ON t1.a = t2.a AND t2.b % 6 = 0 ORDER BY t1.a] +EXPLAIN (DISTSQL) SELECT t1.a, t2.b FROM small t1 LEFT JOIN large t2 ON t1.a = t2.a AND t2.b % 6 = 0 ORDER BY t1.a ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJzMlV9r2zwUxu_fT3E48ELClDqynTQVFNKtKaRkdud4sFF8ocai8-ZanizDSsl3H5YLdcpiG3yTu-jPk-c5vyN8XrD4nSLD7Wqz-hRCqVK4CfzPcL_6dre5Wnswul5vw-2XzRher2h6xglo--yhvlk88TSFqy1oCpvVTQi3_tqDlKtHYXZt8D0YVSq4rGR8DFfeNYxG5i_-h_kYLmE6Bj-4XgXw8bsxiJBgJmPh8SdRILtHigRtJOggQRcJzjAimCu5E0UhVXXlxQjW8R9kU4JJlpe62o4I7qQSyF5QJzoVyDDkD6kIBI-FsqZIMBaaJ6mxMcUsc5U8cfWMBLc5zwoGE4sCz2KgIPUPoZCgX2oGS4rRnqAs9ZtZofmjQEb3pH-gW5lkr3lmh3nC51ywGqv_NVwFBi4SNHgbOTdS_ipz-CmTDGRmkhGsuC-dCjFjbO2FC0P69fdbDWTpHC3DPlrGW3qpYqFEfBh8ST9gtP9HrZ6cyNyih9yP2TsH9rR_W2mvtlp0YtmDGtsRqdHY-Sk31u5P1u5H1p5YziCyHZEaZM9PmazTn6zTj6wzsdxBZDsiNcguTpms25-s24-sO7Fmg8h2RGqQvThlsh3TKhBFLrNC9PqCT6sZIOJHUc-MQpZqJ-6U3BmbeukbndmIRaHrU1ov1ll9VAVsimmr2D4Q0_diu925w9ppVbvtYndI7lmreN7uPB_ifN4qXrQ7L4Y4X7T3atrxTNof2XvvaP_f3wAAAP__d9J4OQ== +distribution: full +vectorized: true +· +• lookup join (left outer) +│ table: large@primary +│ equality: (a) = (a) +│ pred: (b % 6) = 0 +│ +└── • scan + estimated row count: 100 + table: small@primary + spans: FULL SCAN +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJzMlVFr2zAUhd_3Ky4XBglT6sh20lRQSLe64JLZnePBxsiDGovOm2t5sgIrJf99WC7UKYtt8EveLMnH59zvCt9nLP9kyND7dre68gMYXfvreP1lNYa1t_I-xaDpGSeg7bN7uInCz1A-8iyDqzVoCivvJobb0A8g4-pBmF0bwgBGlQouKxkfw1VwDaOR-cR7mI_hEqZjCKNrL4KP340BEsxlIgL-KEpkP5AiQRsJOkjQRYIz3BAslNyKspSqeuXZCPzkL7IpwTQvdrra3hDcSiWQPaNOdSaQYczvMxEJnghlTZFgIjRPM2NjalkWKn3k6gkJrguelwwmFgWeJ0BB6p9CIcFwpxksKW72BOVOv5qVmj8IZHRP-ge6lWn-kmd2mCd-KgSrqYZfYy8ybJGgodvIuZLy966AXzLNQeYmGcEK-9KpCDPG_CBeGNAvz681kKVztAz7aBmv6aVKhBLJYfAl_YCb_X9qDeREFhY95H7M3jmwp_3bSnu11aITyx7U2I5IjcbOT7mxdn-ydj-y9sRyBpHtiNQge37KZJ3-ZJ1-ZJ2J5Q4i2xGpQXZxymTd_mTdfmTdiTUbRLYjUoPsxSmT7ZhWkSgLmZei1x98Ws0AkTyIemaUcqe24k7JrbGpl6HRmY1ElLo-pfXCz-ujKmBTTFvF9oGYvhXb7c4d1k6r2m0Xu0Nyz1rF83bn-RDn81bxot15McT5or1X045r0n7J3npv9u_-BQAA__8-W3La # Left join against covering secondary index query T @@ -1037,18 +1106,44 @@ vectorized: true spans: FULL SCAN query T -SELECT url FROM [ EXPLAIN (DISTSQL) + EXPLAIN (DISTSQL) SELECT a,b from small WHERE EXISTS (SELECT a FROM data WHERE small.a=data.a) ORDER BY a -] ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJzMlF9vmzAUxd_3Ka7uU6uZEgPpH6RJ2VaqUaVJRyKtU8WDG6yOjWBmG2lVlO8-AZlKqhYs8ZA9Yp-j8-Nc625Q_c7Qx0UwDT4voZQZXEXzG7gP7m6nH8MZHF2Gi-Xi6_QYdhJG4KHRqDXLMvj2JYgCCO4qGRz9EzWKhGm2E9TiEwYf6sMTdgzz6DKI4NN3YDESzEXCZ2zNFfr3SJGggwRdJOghwTHGBAspVlwpISvJpjaEyR_0RwTTvCh1dRwTXAnJ0d-gTnXG0ccle8h4xFnCpT1CggnXLM3qmJppUsh0zeQTElwULFc-WDYFlidAQegfXCLBeal9mFAycTDeEhSlfs5Tmj1y9OmWmDNdizTfIY33kZZPBfdhGlwtYRHchHA9D2eVgmnWAp0K8ass4KdIcxB5hWYG6bwJ-cwmZMIlT_axJvQ9xttX_mQmLFHYdL_Yt-LdvXhqPjdqNDebWrYzdHI9VK3JnR5uco55dY5ZdY5lu0Or66FqVXd2uOpc8-pcs-pcy_aGVtdD1aru_HDVeebVeWbVeZY9HlpdD1Wruov_Y9W-AhlxVYhccaMtOqr2ME8eebO3lSjlit9Ksapjms957asPEq50c0ubjzBvrirAtpl2mp09M31pdrqTe6LdTrfXbfaGcI87zafdyadDks86zefdyedDki-6ZzXqeSbdj-xldrx99zcAAP__MnFS0w== +distribution: full +vectorized: true +· +• lookup join (semi) +│ table: data@primary +│ equality: (a) = (a) +│ +└── • scan + estimated row count: 100 + table: small@primary + spans: FULL SCAN +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJzMlFFvmzwUhu-_X3F0rlp9psRA0hRpUraValRp0pFI6zTlwg1Wx0Ywsx1pVZT_PgGdSqrWWOIiu8ScV-_Dc5B3qH7lGGJ0dzt9H8_g5DJeLBefp6ewiKbRxyUwAvdwlcxvQG1YnsOXT1ESQXRXjcHJ36FmImWaPQ3Uw2cM3tWHZ-wU5slllMCHr8CQYCFSPmMbrjD8hhQJekjQR4IBEhziimApxZorJWQ1sqsDcfobwwHBrCi3ujpeEVwLyTHcoc50zjHEJbvPecJZyqU7QIIp1yzL65oaaVLKbMPkIxJclKxQITguBVakQEHo71wiwflWhzChZOLhak9QbPVzn9LsgWNI98Se6VpkxRPS8BBp-VjyEKbR1RIW0U0M1_N4Vk0wzVqgUyF-bkv4IbICRFGh2UF6b0I-swmZcsnTQ6wJ_R9X-1e-ZCYcUbr0UOxb9f5BPbXfG7Xam0sd1-u7uQ6q1uZGx9ucZ6_Os1PnOa7fV10HVUvd-fHU-fbqfDt1vuMGfdV1ULXUjY-nLrBXF9ipCxx32FddB1VL3cW_cdW-AplwVYpCcatbdFDdwzx94M29rcRWrvmtFOu6pnmc17n6IOVKN29p8xAXzasKsB2mxrB3EKYvw565uaPaN6YDczjowz00hkfm5lGf5nNjeGxuHvdpvjDvatDxm5h_spfdq_1_fwIAAP__leZNdA== query T -SELECT url FROM [ EXPLAIN (DISTSQL) + EXPLAIN (DISTSQL) SELECT a,b from small WHERE a+b<20 AND EXISTS (SELECT a FROM data WHERE small.a=data.a AND small.b+data.c>15) ORDER BY a -] ---- -https://cockroachdb.github.io/distsqlplan/decode.html#eJzMllFvmz4Uxd__n-LqPiWKU2IgbYr0l9KtVKNKSZdEWqcuD06wOjaKmQFpVZXvPgFpSqrVZkKR8piLD-dwf0eKnzH9FaGDc3fiflxALiO4mk1v4N69u51ceD50Lr35Yv550oXtEUZgVZ1JH1kUwZdP7syFTodBD1Zd-JYPBtYazEEXLvxLcO8KOXRexJUyYBl7EZZvOWHwfzk9YZWus52voFfN19tXc6DDbhems0t3Bh--AlsiwVgE3GePPEXnHikSNJGghQRtJDjEJcFEijVPUyGLI8-lwAt-ozMgGMZJnhXjJcG1kBydZ8zCLOLo4IKtIj7jLODSGCDBgGcsjEqbMt84keEjk09IcJ6wOHWgb1BgcQAURPadSyQ4zTMHxpSMTVxuCIo8e_VLM_bA0aEb0jzTVRhlXHJpDPcDVXMHOmMKPRibNRaO43j-YvSuv_kv_tcijLcroW92snhKuAMT92oBc_fGg-up5xcnWMZqm5oI8TNP4IcIYxBxsZtiSz50xmYRfFgj_RK80Ratd7_iNbyQAZc82I89pj1cbv7yqb7oi8Sg-4t-z97es6fNi0UbFcugfcNsWy1Nql21Tg9ULY1_vVr0eKtlNmdrNmNr9g2rLVtNqh3bswOx1fjX2ZrHy9ZqztZqxtbqG3ZbtppUO7ajA7HV-NfZWsfL1m7O1m7G1u4bw7ZsNal2bM8PxFbjX2drHy9bzaVlxtNExClv9E8-KO4CPHjg1d0hFblc81sp1qVN9XNa6spBwNOsekqrH15cPSoC1sVUKTbVYlMptvbE9K3YUsc-VVvbSvVQLR4qxRrn0zYffaYUj9TOI6X4XC0-bxObajqmK5m6ZVRTM9qqZ1RTNFtjrm4a1VSNqrv2Nvty89-fAAAA___XIrJ- +distribution: full +vectorized: true +· +• lookup join (semi) +│ table: data@primary +│ equality: (a) = (a) +│ pred: (b + c) > 15 +│ +└── • filter + │ filter: (a + b) < 20 + │ + └── • scan + estimated row count: 100 + table: small@primary + spans: FULL SCAN +· +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJzMll9vmzAUxd_3Ka7uE1GcEvOnTZEm0a1Uo0pJl0Rapy0PTrA6NooZEGlVle8-AW1KqsVmQpHymAuHc3x_R4qfMP8do4Pe3e34wg9Au_Rn89nncQ9m3tj7OAdGYAlX08kN5A8sjuHLJ2_qgaYx6MOyB9_Xw6G5AmPYg4vgEry7Ug7ai7hWhqxgL8LqKycM3lfTE1brtOf5Evr1fPX8aQ7U7vVgMr30pvDhKzAkmIiQB-yB5-h8Q4oEDSRoIkELCdq4IJhmYsXzXGTlK0-VwA__oDMkGCXpuijHC4IrkXF0nrCIipijg3O2jPmUs5Bn-hAJhrxgUVzZVPHcNIseWPaIBGcpS3IHBjoFloRAQRQ_eIYEJ-vCAZcS18DFhqBYF69-ecHuOTp0Q9pnuorigmc80-3dQPXcAc2l0AfXaKBwHMcP5qO9_sb_-F-LKHleCX2zk_ljyh0Ye1dzmHk3PlxP_KB8gxWssamxEL_WKfwUUQIiKXdTbikAzTXK4HYD9EvwVls0957iNbzIQp7xcDe2S_u42PzjqIEYiFSnu4veZ2_t2NP2xaKtiqXTgW50rZYi1bZapweqlsK_WS16vNUy2rM12rE1BrrZla0i1Zbt2YHYKvybbI3jZWu2Z2u2Y2sOdKsrW0WqLdvRgdgq_JtszeNla7Vna7Vjaw10uytbRaot2_MDsVX4N9lax8tWcWmZ8jwVSc5b_ZMPy7sAD-95fXfIxTpb8dtMrCqb-uek0lWDkOdF_ZTWP_ykflQGbIqpVGzIxYZUbO6I6VuxKY99Kre2pGpbLralYoXzaZdDn0nFI7nzSCo-l4vPu8Smio6pSiZvGVXUjHbqGVUUzVKYy5tGFVWj8q69zb7YvPsbAAD__4PTrR8= # Regression test for #35950: Make sure that lookup joins use a batch limit. diff --git a/pkg/sql/opt/exec/execbuilder/testdata/window b/pkg/sql/opt/exec/execbuilder/testdata/window index 2bc339c00bf4..8a2b458d13c3 100644 --- a/pkg/sql/opt/exec/execbuilder/testdata/window +++ b/pkg/sql/opt/exec/execbuilder/testdata/window @@ -525,7 +525,6 @@ EXPLAIN (VERBOSE) kv ---- distribution: local -vectorized: false · • root │ columns: (avg) diff --git a/pkg/sql/opt/optbuilder/testdata/explain b/pkg/sql/opt/optbuilder/testdata/explain index 4bbb149d60b0..b915b2d30971 100644 --- a/pkg/sql/opt/optbuilder/testdata/explain +++ b/pkg/sql/opt/optbuilder/testdata/explain @@ -66,64 +66,3 @@ explain │ └── (3, 4) └── filters └── x:1 = column1:4 - -build -SELECT tree FROM [ EXPLAIN (VERBOSE) SELECT * FROM xy ] ----- -error (42703): column "tree" does not exist - -build -SELECT tree FROM [ EXPLAIN (VERBOSE) SELECT x, x, y FROM xy ORDER BY y ] ----- -error (42703): column "tree" does not exist - -build -SELECT json FROM [EXPLAIN (DISTSQL) SELECT * FROM xy] WHERE false ----- -with &1 - ├── columns: json:9 - ├── explain - │ ├── columns: automatic:4 url:5 json:6 - │ ├── mode: distsql - │ └── project - │ ├── columns: x:1!null y:2 - │ └── scan xy - │ └── columns: x:1!null y:2 crdb_internal_mvcc_timestamp:3 - └── project - ├── columns: json:9 - └── select - ├── columns: automatic:7 url:8 json:9 - ├── with-scan &1 - │ ├── columns: automatic:7 url:8 json:9 - │ └── mapping: - │ ├── automatic:4 => automatic:7 - │ ├── url:5 => url:8 - │ └── json:6 => json:9 - └── filters - └── false - -# Don't include hidden columns on a SELECT *. -build -SELECT * FROM [EXPLAIN (DISTSQL) SELECT * FROM xy] WHERE false ----- -with &1 - ├── columns: automatic:7 url:8 - ├── explain - │ ├── columns: automatic:4 url:5 json:6 - │ ├── mode: distsql - │ └── project - │ ├── columns: x:1!null y:2 - │ └── scan xy - │ └── columns: x:1!null y:2 crdb_internal_mvcc_timestamp:3 - └── project - ├── columns: automatic:7 url:8 - └── select - ├── columns: automatic:7 url:8 json:9 - ├── with-scan &1 - │ ├── columns: automatic:7 url:8 json:9 - │ └── mapping: - │ ├── automatic:4 => automatic:7 - │ ├── url:5 => url:8 - │ └── json:6 => json:9 - └── filters - └── false diff --git a/pkg/sql/rowexec/processors_test.go b/pkg/sql/rowexec/processors_test.go index fad5ef45db8b..d2a0089f2a10 100644 --- a/pkg/sql/rowexec/processors_test.go +++ b/pkg/sql/rowexec/processors_test.go @@ -738,17 +738,17 @@ func TestUncertaintyErrorIsReturned(t *testing.T) { }{ { query: "SELECT * FROM t AS t1 JOIN t AS t2 ON t1.x = t2.x", - expectedPlanURL: "https://cockroachdb.github.io/distsqlplan/decode.html#eJy8lFFv2jAUhd_3K6z71E6miR1KS6RKqbZOo2LQER4mVXlIiQeR0jizHYkK8d-nJEgsCGyyiLxhfL_rc3xuvAH5JwEX_Kfx05c5ykWCvs2mP9Dr06-X8eNogq6-jvy5_3N8jXYln6sChR59pAh6no4muwVF0wlS5GaNHpCiN-sAMKQ8YpPwnUlwX4EABgoYHAgwZIIvmJRcFFubsnAUrcG1McRplqvi7wDDggsG7gZUrBIGLszDt4TNWBgxYdmAIWIqjJOyvfIyEb-H4gMw-FmYShf1LFIUTXPlIo9gj0KwxcBztTtg3_ftA61Cuap39AgE2wCDVOGSgUu2-P-EOh0LpSeF7vvkKRcREyyqdQoK0lRyxO33UK6eeZwyYQ3q0hL2W1155PpBxMtV-avmE3sO9voHbvdOnBZOjsic8B7PrOGh5aNH92tHk_PTJsa0LWL3LHqxyWygtd-9VnpSawfDeXe54aTn3zo13zq1e5cajwZCbzsWSk8K7WA27rt5uI6ImDGZ8VSys94lu7DBoiWrrkXyXCzYi-CL8phqOS258uuKmFTVLq0Wo7TaKgSeDw_awEM9TBrIps3gQRt4qIfpIWz_Czt6z44WJnaNtg_pfpug9bAhaD1sCPq2TdB62BC0HjYEPWgT9F2bqPSwISo9bIjqvk1UetgQlR42RDVsFFWw_fQ3AAD__1FvO7Y=", + expectedPlanURL: "Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJy8lOFr4jAYxr_fXxFeOLYdcW1S52Zh0HHrse483engDkY_dDbTgmt6SQSH-L8fbQWvoolesd-MeX9vnifP2yxB_pmBCyO_5399Rkn6xtG34eAHevF_P_Xugj46vw9Gz6OfvQu0rvlSFih0N0KKoMdB0F8vKBr0kSKXC3SLFL1chOjXgz_0y6694LuPzu6TaCKid_fzGWBIecz60TuT4L4AAQwUMDgQYsgEHzMpuci3lkVhEC_AtTEkaTZX-d8hhjEXDNwlqETNGLjwHL3O2JBFMROWDRhipqJkVrRXXiaS90h8AIZRFqXSRS2L5EWDuXKRR7BHIVxh4HO1PmDT9_UDTSM5rXb0CISrEINU0YSBS1b4_4Q6DQule4Vu-sxTLmImWFzpFOakqWSH24dITh95kjJhdarSZuxNnXvk4lYkk2nxq-ITew722ltuN06cGk52yOzzFs-s7rblnUe3K0eTw9MmxrQtYrcserLJPEJru3mtdK_WBobz-nTDSQ-_dWq-dWq3TjUeRwi9algo3Su0gdm4aebh2iFiyGTGU8kOepfs3AaLJ6y8FsnnYsyeBB8Xx5TLQcEVX1fMpCp3abkI0nIrF3g43KkDd_UwOUI2PQ7u1IG7ephuw_a_sKP37GhhYldoe5tu1wlaDxuC1sOGoK_qBK2HDUHrYUPQnTpBX9eJSg8botLDhqhu6kSlhw1R6WFDVN2jogpXn_4GAAD__4WsRD0=", }, { query: "SELECT * FROM t AS t1 INNER LOOKUP JOIN t AS t2 ON t1.x = t2.y", - expectedPlanURL: "https://cockroachdb.github.io/distsqlplan/decode.html#eJy8lFGLm0AQgN_7K5Z5asvmdFfNJULBo03Bq9U0plA45LBxOWw91-6ukBDy34sauCRNNjYHedyd-TJfdmZcg_xTgAvxJJh8nKNaFOjzLPqKHiY_psGdH6K3n_x4Hn8L3qFtyvsuQaG7GCmC_DCczFAQRV--T9F95IfbCEVRiBS5WaIPSNGbVQIYSp6xMH1mEtwHIICBAgYLEgyV4AsmJRdNaN0m-tkSXBNDXla1aq4TDAsuGLhrULkqGLgwT38WbMbSjAnDBAwZU2letD-vvErkz6lYAYa4SkvpooFBmqSoVi7yCPYoJBsMvFYvBaRKnxi4ZIP7S9zzvNw6WIcO6nH1mGdLwBBw_ruu0C-el4iXjcCeCvZs7DknheiFQsPTj_KPkH0g5GDPOilknRR68ahLLjImWLYnkWyOKId8wCtjfJB4vLS9V5r0nxBydkIMYg4MetGQnPHY6Yl9nSHpL3R7nSGh_TtFz3eKmoNL2nRGYudVnOu0qb_Q6Pq7fERoxmTFS8l6rarZ7DrLnlj3YZC8Fgs2FXzRlumOUcu1FxmTqouS7uCXXagR3IWJFqZ6mGphaw8mh7Cl1zb1pW0t7ehhRwsP9fDwNX_6VguP9JVHWnish8f_pZ1s3vwNAAD__wRp0nw=", + expectedPlanURL: "Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJy8lGGL2kAQhr_3VwwD5dqyntmNehoo5OilNHdpYtXSwhGO1GwlrWbTzQYU8b-XGOHU6pp64Mdk5vF93JnNEvM_U7Rw6HjOhxEk6U8BHwfBZ3h0vve9W9eHN3fucDT84r2FTc-7qkHB7RAUBdf3nQF4QfDwtQ_3getvKgwCHxS9nsN7UOx6EcK3T87AqSI898GBq7skmshoZr2-QoKpiLkfzXiO1iNSJMiQoIkhwUyKMc9zIcvSct3oxnO0DIJJmhWqfB0SHAvJ0VqiStSUo4Wj6MeUD3gUc9k0kGDMVZRM1z-v7Ewms0gukOAwi9LcgkaTlk1BoSywKbEZhiuColDPAbmKJhwtuiL1Je5Fkm4czH0H9bR4SuI5EvSE-F1k8EskKYi0FNhRIXaL2O2jQuxMoc7xQ_lHqLUn1Ca2eVTIPCr07FGkQsZc8nhHIlwdUPZFQ2TN3l7j4ejWTjStvyH05IY0qdFosrOW5ITH1kxal1mS-kI3l1kSVn9S7PSkmNE4Z0wnJLZOpX2ZMdUX6l7-Lh8QGvA8E2nOa11Vo7zrPJ7w6sOQi0KOeV-K8TqmegzW3PpFzHNVVWn14KZVqRTchqkWZnqYaWFzB6b7sKnXNvTRLS3d1sNtLdzRw52X_OkbLdzVJ3e1cE8P9_5LO1y9-hsAAP__cuHbAw==", }, { // This test reproduces 51458 and should be enabled once that issue is // fixed. query: "SELECT * FROM t JOIN onerow ON t.x = onerow.x", - expectedPlanURL: "https://cockroachdb.github.io/distsqlplan/decode.html#eJy8lFFvmzAUhd_3K6z71E5OwYY2E1Ilpq3TqDLokjxMqnig4S5BopjZRksV5b9PQKSMiEIilLzF8f2uzzkXewPqTwoOzB4mD1_mpJAp-TYNfpDnh19Pk8-eT66-erP57OfkmuxKPtYFmjwGnk9EhlL8JYFP9M2a3O_WN-sQKGQiRj96RQXOMzCgwIGCBSGFXIoFKiVkubWpCr14DY5JIcnyQpd_hxQWQiI4G9CJThEcmEcvKU4xilEaJlCIUUdJWrXXbi6T10i-AYVZHmXKISODlUVBoR3iMupyCLcURKF3B-z7vryRVaRWzY4ug3AbUlA6WiI4bEvfEbrvU2RCxigxbnQKS7KvpMXt90itHkWSoTTsprQUf-srl13fy2S5qn41fFLXOrC6t2ENsNGi0RcjkRvjQ7-tR9uNo9nxo2a9ozaYOTL42abNLjvt2zNNmx8fOe-PnJujc-V9glCr2bZ-flregr3UQTr5uzov8F3cXeAVaFEwRZWLTOFRl9wsPWC8xDoTJQq5wCcpFtUx9TKouOpaxah0vbtbeFm9VQo8HraHwONumB3C5v8w74Z5J_ypAZuHsDUksG64J7BuuCcwe0hgt0M8d8M9nrvhHs93J8jmp8H2EHjcDY9PGlW4_fAvAAD__5MOVAA=", + expectedPlanURL: "Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJy8lOFr2kAYxr_vrzheGG3H2eROW0egkLFmNJ3TToUNSj5czVsNaC67O5lF_N9HEsFF0kQJ-s3z3t97z_O8uVuD_jMHB0Zez_s6JlH8Ksm34eAHefZ-P_W--H1yee-PxqOfvSuyrfmUFxjyOPD7RMao5F8y6BNzvSJ32_X1KiC_Hryhl3fs-d89cnEfiakSC-fjBVCIZYh9sUANzjMwoMCBQhsCComSE9RaqnRrnRX64Qocm0IUJ0uT_h1QmEiF4KzBRGaO4MBYvMxxiCJEZdlAIUQjonnW3riJihZCvQGFUSJi7ZCWxdKiwdI4xGXU5RBsKMil2R6w6_vyRmZCz4odXQbBJqCgjZgiOGxD3xG667OMpQpRYVjoFKRkXUmJ2wehZ48yilFZnaK0Ob6aS5dd3aloOst-FXxSt71ndWej3cBGica-bMnE6u77LT26UziaHT5qVjtqi9kti59s2uy807450bT54ZHz-si53TpV3kcIbRfb5k9TyVuwk9pIJ39X5xm-i9szvAIlCoaoExlrPOiS26kHDKeYZ6LlUk3wSclJdky-HGRcdq1C1Cbf3S78ON9KBR4Od5rA3WqY7cP2_zCvhnkl_LkA2_twu0lg1XBNYNVwTWCdJoHdNPFcDdd4roZrPN8eIZsfB3eawN1quHvUqILNh38BAAD___TFXIc=", overrideErrorOrigin: []errorOriginSpec{ { nodeIdx: 0, @@ -786,7 +786,7 @@ func TestUncertaintyErrorIsReturned(t *testing.T) { require.NoError(t, err) func() { // Check distsql plan. - rows, err := defaultConn.Query(fmt.Sprintf("SELECT url FROM [EXPLAIN (DISTSQL) %s]", testCase.query)) + rows, err := defaultConn.Query(fmt.Sprintf("SELECT info FROM [EXPLAIN (DISTSQL) %s] WHERE info LIKE 'Diagram:%%'", testCase.query)) require.NoError(t, err) defer rows.Close() rows.Next() diff --git a/pkg/sql/txn_restart_test.go b/pkg/sql/txn_restart_test.go index dcf2f856c0f2..93c69055ca68 100644 --- a/pkg/sql/txn_restart_test.go +++ b/pkg/sql/txn_restart_test.go @@ -1392,12 +1392,12 @@ func TestDistSQLRetryableError(t *testing.T) { } // Let's make sure that DISTSQL will actually be used. - row := txn.QueryRow(`SELECT automatic FROM [EXPLAIN (DISTSQL) SELECT count(1) FROM t]`) - var automatic bool + row := txn.QueryRow(`SELECT info FROM [EXPLAIN SELECT count(1) FROM t] WHERE info LIKE 'distribution%'`) + var automatic string if err := row.Scan(&automatic); err != nil { t.Fatal(err) } - if !automatic { + if automatic != "distribution: full" { t.Fatal("DISTSQL not used for test's query") } From bb372146437c33db7ac59f3f8817eabbbbc63d92 Mon Sep 17 00:00:00 2001 From: Radu Berinde Date: Wed, 16 Dec 2020 17:59:49 -0500 Subject: [PATCH 3/3] sql: add an EXPLAIN (DISTSQL, JSON) variant Add a JSON flag to EXPLAIN (DISTSQL); in this variant we only return the diagram JSON. This is used for a server API endpoint which used the json column before. The flag should not be documented for users. Release note: None --- pkg/server/admin.go | 2 +- pkg/sql/distsql_physical_planner_test.go | 4 ++-- pkg/sql/explain_plan.go | 23 +++++++++++------- .../execbuilder/testdata/distsql_auto_mode | 6 +++++ .../exec/execbuilder/testdata/distsql_misc | 2 +- pkg/sql/parser/parse_test.go | 2 ++ pkg/sql/parser/testdata/errors | 24 +++++++++++++++++++ pkg/sql/sem/tree/explain.go | 10 ++++++++ 8 files changed, 61 insertions(+), 12 deletions(-) diff --git a/pkg/server/admin.go b/pkg/server/admin.go index 1b3a32c711d7..90e6a659a10c 100644 --- a/pkg/server/admin.go +++ b/pkg/server/admin.go @@ -1593,7 +1593,7 @@ func (s *adminServer) QueryPlan( } explain := fmt.Sprintf( - "SELECT json FROM [EXPLAIN (DISTSQL) %s]", + "EXPLAIN (DISTSQL, JSON) %s", strings.Trim(req.Query, ";")) rows, err := s.server.sqlServer.internalExecutor.QueryEx( ctx, "admin-query-plan", nil, /* txn */ diff --git a/pkg/sql/distsql_physical_planner_test.go b/pkg/sql/distsql_physical_planner_test.go index 29127f705d9f..5c6962bbd7f8 100644 --- a/pkg/sql/distsql_physical_planner_test.go +++ b/pkg/sql/distsql_physical_planner_test.go @@ -404,7 +404,7 @@ func TestDistSQLRangeCachesIntegrationTest(t *testing.T) { // of the splits and still holds the state after the first dummy query at the // beginning of the test, which had everything on the first node. query := `SELECT count(1) FROM "left" INNER JOIN "right" USING (num)` - row := db3.QueryRow(fmt.Sprintf(`SELECT json FROM [EXPLAIN (DISTSQL) %v]`, query)) + row := db3.QueryRow(fmt.Sprintf(`EXPLAIN (DISTSQL, JSON) %v`, query)) var json string if err := row.Scan(&json); err != nil { t.Fatal(err) @@ -431,7 +431,7 @@ func TestDistSQLRangeCachesIntegrationTest(t *testing.T) { // Now assert that new plans correctly contain all the nodes. This is expected // to be a result of the caches having been updated on the gateway by the // previous query. - row = db3.QueryRow(fmt.Sprintf(`SELECT json FROM [EXPLAIN (DISTSQL) %v]`, query)) + row = db3.QueryRow(fmt.Sprintf(`EXPLAIN (DISTSQL, JSON) %v`, query)) if err := row.Scan(&json); err != nil { t.Fatal(err) } diff --git a/pkg/sql/explain_plan.go b/pkg/sql/explain_plan.go index e89671b8c3cd..93af4a9c20e5 100644 --- a/pkg/sql/explain_plan.go +++ b/pkg/sql/explain_plan.go @@ -50,7 +50,7 @@ func (e *explainPlanNode) startExec(params runParams) error { ob := explain.NewOutputBuilder(e.flags) plan := e.plan.WrappedPlan.(*planComponents) - // Determine the "distributed" and "vectorized" values, which we will emit as + // Determine the "distribution" and "vectorized" values, which we will emit as // special rows. distribution := getPlanDistribution( @@ -67,6 +67,7 @@ func (e *explainPlanNode) startExec(params runParams) error { }() physicalPlan, err := newPhysPlanForExplainPurposes(planCtx, distSQLPlanner, plan.main) var diagramURL url.URL + var diagramJSON string if err != nil { if e.options.Mode == tree.ExplainDistSQL { if len(plan.subqueryPlans) > 0 { @@ -111,21 +112,27 @@ func (e *explainPlanNode) startExec(params runParams) error { return err } - _, diagramURL, err = diagram.ToURL() + diagramJSON, diagramURL, err = diagram.ToURL() if err != nil { return err } } } - if err := emitExplain(ob, params.EvalContext(), params.p.ExecCfg().Codec, e.plan); err != nil { - return err + var rows []string + if e.options.Flags[tree.ExplainFlagJSON] { + // For the JSON flag, we only want to emit the diagram JSON. + rows = []string{diagramJSON} + } else { + if err := emitExplain(ob, params.EvalContext(), params.p.ExecCfg().Codec, e.plan); err != nil { + return err + } + rows = ob.BuildStringRows() + if e.options.Mode == tree.ExplainDistSQL { + rows = append(rows, "", fmt.Sprintf("Diagram: %s", diagramURL.String())) + } } v := params.p.newContainerValuesNode(colinfo.ExplainPlanColumns, 0) - rows := ob.BuildStringRows() - if e.options.Mode == tree.ExplainDistSQL { - rows = append(rows, "", fmt.Sprintf("Diagram: %s", diagramURL.String())) - } datums := make([]tree.DString, len(rows)) for i, row := range rows { datums[i] = tree.DString(row) diff --git a/pkg/sql/opt/exec/execbuilder/testdata/distsql_auto_mode b/pkg/sql/opt/exec/execbuilder/testdata/distsql_auto_mode index 27378a11fcd3..b77f3cc1fbb7 100644 --- a/pkg/sql/opt/exec/execbuilder/testdata/distsql_auto_mode +++ b/pkg/sql/opt/exec/execbuilder/testdata/distsql_auto_mode @@ -13,6 +13,12 @@ SET distsql=auto statement ok CREATE TABLE kv (k INT PRIMARY KEY, v INT) +# Verify the JSON variant. +query T +EXPLAIN (DISTSQL, JSON) SELECT 1 +---- +{"sql":"EXPLAIN (DISTSQL, JSON) SELECT 1","nodeNames":["1"],"processors":[{"nodeIdx":0,"inputs":[],"core":{"title":"local values 0/0","details":[]},"outputs":[],"stage":1},{"nodeIdx":0,"inputs":[],"core":{"title":"Response","details":[]},"outputs":[],"stage":0}],"edges":[{"sourceProc":0,"sourceOutput":0,"destProc":1,"destInput":0}]} + # Full table scan - distribute. query T SELECT info FROM [EXPLAIN SELECT * FROM kv] WHERE info LIKE 'distribution%' diff --git a/pkg/sql/opt/exec/execbuilder/testdata/distsql_misc b/pkg/sql/opt/exec/execbuilder/testdata/distsql_misc index a581ae5cd1f2..ee046057690a 100644 --- a/pkg/sql/opt/exec/execbuilder/testdata/distsql_misc +++ b/pkg/sql/opt/exec/execbuilder/testdata/distsql_misc @@ -20,7 +20,7 @@ subtest scrub # ON leftside.v = rightside.v AND leftside.k = rightside.k AND leftside.data = rightside.data # WHERE (leftside.k IS NULL) OR # (rightside.k IS NULL) -# ] +# ---- # https://cockroachdb.github.io/distsqlplan/decode.html#eJyckc2K2zAQgO99CjGnLBlIJDs9CAq6dCFLGpdscio-uNY0a3AkM5Khy5J3L45hNw5x2vQ4I33zzc8bOG9pXRwogP4BEnKEhn1JIXjuUv2Hpf0Neo5QuaaNXTpHKD0T6DeIVawJNGyLnzVtqLDEszkgWIpFVZ_KNlwdCn41kUIEhKyNWhiFRqJJID8i-DZ-FA6x2BNoecR_lz97jsQzOfQaOUWjpmiS6ahG3aM5n1ENXYFK7-zdUyb_MWUyPiXCoYjli6jJaaFGremo9UPWOs-WmOzAlnfk375caf0b8Z6efOWIZ-mw_-1rQ1o87lYrke22XzfiKVuuAaGmX3FyNtzDF672L8MUIDxWdSTWYmKUWD6L9W61ehDZRkzM4j1-P4fE7iIJmhTNAs3n0Q0t7rnLhkLjXaDLTV2tPO_WQ3ZP_bqDb7mk7-zLk6YPsxN3SlgKsX-VfbB0_VPX4Dksb8LpAJaXsLoJJ7fNyR1mdQmnN-HFhTk_fvoTAAD__3P7gDg= # # # Verify the foreign key check execution plan uses a merge join. diff --git a/pkg/sql/parser/parse_test.go b/pkg/sql/parser/parse_test.go index 732d1a063eaa..c63f5a975cfc 100644 --- a/pkg/sql/parser/parse_test.go +++ b/pkg/sql/parser/parse_test.go @@ -552,6 +552,8 @@ func TestParse(t *testing.T) { {`EXPLAIN SELECT 1`}, {`EXPLAIN EXPLAIN SELECT 1`}, + {`EXPLAIN (DISTSQL) SELECT 1`}, + {`EXPLAIN (DISTSQL, JSON) SELECT 1`}, {`EXPLAIN (OPT, VERBOSE) SELECT 1`}, {`EXPLAIN ANALYZE (DISTSQL) SELECT 1`}, {`EXPLAIN ANALYZE (DEBUG) SELECT 1`}, diff --git a/pkg/sql/parser/testdata/errors b/pkg/sql/parser/testdata/errors index e8d304fc71f0..6145aadf3685 100644 --- a/pkg/sql/parser/testdata/errors +++ b/pkg/sql/parser/testdata/errors @@ -565,6 +565,30 @@ DETAIL: source SQL: EXPLAIN (PLAN, DEBUG) SELECT 1 ^ +error +EXPLAIN (JSON) SELECT 1 +---- +at or near "EOF": syntax error: the JSON flag can only be used with DISTSQL +DETAIL: source SQL: +EXPLAIN (JSON) SELECT 1 + ^ + +error +EXPLAIN (PLAN, JSON) SELECT 1 +---- +at or near "EOF": syntax error: the JSON flag can only be used with DISTSQL +DETAIL: source SQL: +EXPLAIN (PLAN, JSON) SELECT 1 + ^ + +error +EXPLAIN ANALYZE (DISTSQL, JSON) SELECT 1 +---- +at or near "EOF": syntax error: the JSON flag cannot be used with ANALYZE +DETAIL: source SQL: +EXPLAIN ANALYZE (DISTSQL, JSON) SELECT 1 + ^ + error SELECT $0 ---- diff --git a/pkg/sql/sem/tree/explain.go b/pkg/sql/sem/tree/explain.go index deb5fa4ff90e..c68a66d40973 100644 --- a/pkg/sql/sem/tree/explain.go +++ b/pkg/sql/sem/tree/explain.go @@ -104,6 +104,7 @@ const ( ExplainFlagTypes ExplainFlagEnv ExplainFlagCatalog + ExplainFlagJSON numExplainFlags = iota ) @@ -112,6 +113,7 @@ var explainFlagStrings = [...]string{ ExplainFlagTypes: "TYPES", ExplainFlagEnv: "ENV", ExplainFlagCatalog: "CATALOG", + ExplainFlagJSON: "JSON", } var explainFlagStringMap = func() map[string]ExplainFlag { @@ -236,6 +238,14 @@ func MakeExplain(options []string, stmt Statement) (Statement, error) { // Default mode is ExplainPlan. opts.Mode = ExplainPlan } + if opts.Flags[ExplainFlagJSON] { + if opts.Mode != ExplainDistSQL { + return nil, pgerror.Newf(pgcode.Syntax, "the JSON flag can only be used with DISTSQL") + } + if analyze { + return nil, pgerror.Newf(pgcode.Syntax, "the JSON flag cannot be used with ANALYZE") + } + } if analyze { if opts.Mode != ExplainDistSQL && opts.Mode != ExplainDebug && opts.Mode != ExplainPlan {