# Copyright Materialize, Inc. and contributors. All rights reserved. # # Use of this software is governed by the Business Source License # included in the LICENSE file at the root of this repository. # # 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. statement ok CREATE TABLE t (f0 int, f1 int, f2 int) query T multiline EXPLAIN OPTIMIZED PLAN WITH(humanized expressions, arity, join implementations) AS VERBOSE TEXT FOR SELECT DISTINCT * FROM t GROUP BY f1, f2, f0 ---- Explained Query: Distinct project=[#0{f0}..=#2{f2}] // { arity: 3 } ReadStorage materialize.public.t // { arity: 3 } Source materialize.public.t Target cluster: quickstart EOF query T multiline EXPLAIN OPTIMIZED PLAN WITH(humanized expressions, arity, join implementations) AS VERBOSE TEXT FOR SELECT DISTINCT r0 FROM (SELECT DISTINCT f1 + 1 as r0, f0 FROM t) ---- Explained Query: Distinct project=[(#0{f1} + 1)] // { arity: 1 } Project (#1{f1}) // { arity: 1 } ReadStorage materialize.public.t // { arity: 3 } Source materialize.public.t Target cluster: quickstart EOF query T multiline EXPLAIN OPTIMIZED PLAN WITH(humanized expressions, arity, join implementations) AS VERBOSE TEXT FOR SELECT DISTINCT f1 FROM (SELECT DISTINCT f0, f1 FROM t) ---- Explained Query: Distinct project=[#0{f1}] // { arity: 1 } Project (#1{f1}) // { arity: 1 } ReadStorage materialize.public.t // { arity: 3 } Source materialize.public.t Target cluster: quickstart EOF query T multiline EXPLAIN OPTIMIZED PLAN WITH(humanized expressions, arity, join implementations) AS VERBOSE TEXT FOR SELECT DISTINCT FROM (SELECT DISTINCT f0, f1 FROM t) ---- Explained Query: Distinct project=[] // { arity: 0 } Project () // { arity: 0 } ReadStorage materialize.public.t // { arity: 3 } Source materialize.public.t Target cluster: quickstart EOF query T multiline EXPLAIN OPTIMIZED PLAN WITH(humanized expressions, arity, join implementations) AS VERBOSE TEXT FOR SELECT DISTINCT FROM (SELECT DISTINCT f0 FROM (SELECT DISTINCT f0, f1 FROM t)); ---- Explained Query: Distinct project=[] // { arity: 0 } Project () // { arity: 0 } ReadStorage materialize.public.t // { arity: 3 } Source materialize.public.t Target cluster: quickstart EOF query T multiline EXPLAIN OPTIMIZED PLAN WITH(humanized expressions, arity, join implementations) AS VERBOSE TEXT FOR SELECT f0 FROM (SELECT f0 FROM t GROUP BY f1 / 10, f0) GROUP BY f0; ---- Explained Query: Distinct project=[#0{f0}] // { arity: 1 } Project (#0{f0}) // { arity: 1 } ReadStorage materialize.public.t // { arity: 3 } Source materialize.public.t Target cluster: quickstart EOF query T multiline EXPLAIN OPTIMIZED PLAN WITH(humanized expressions, arity, join implementations) AS VERBOSE TEXT FOR SELECT f0 / 20 FROM (SELECT f0 / 10 AS f0 FROM t GROUP BY f0 / 10) GROUP BY f0 / 20; ---- Explained Query: Distinct project=[((#0{f0} / 10) / 20)] // { arity: 1 } Project (#0{f0}) // { arity: 1 } ReadStorage materialize.public.t // { arity: 3 } Source materialize.public.t Target cluster: quickstart EOF