From d5d8d51fdd51e72d89f562dcb9fbf7b04d4120ff Mon Sep 17 00:00:00 2001 From: Angela Xu Date: Mon, 25 Jan 2021 16:52:26 -0800 Subject: [PATCH] opt: create a special type for selectivity to clean up stats code Previously, the selectivity of a filter was represented by a float64 type. There were several places in the statistics code where range checks were being performed to ensure selectivity was between (0,1]. This change cleans up the statistics code and creates a Selectivity type with custom methods to replace direct numerical operations, incorporating the range check to ensure all operations on selectivity return a valid value. As a result of implementing these changes, there are slight changes to some values in the test files. The query plans and performance mostly stay the same. Resolves: #53860 Release note: None --- .../exec/execbuilder/testdata/inverted_index | 4 +- pkg/sql/opt/exec/execbuilder/testdata/join | 210 +++--- .../opt/exec/execbuilder/testdata/lookup_join | 2 +- pkg/sql/opt/memo/statistics_builder.go | 107 +-- pkg/sql/opt/memo/testdata/stats/inverted-geo | 4 +- pkg/sql/opt/memo/testdata/stats/inverted-join | 10 +- pkg/sql/opt/memo/testdata/stats/join | 36 +- pkg/sql/opt/memo/testdata/stats/lookup-join | 6 +- .../testdata/stats/multi-column-inverted-geo | 12 +- .../memo/testdata/stats/partial-index-scan | 8 +- pkg/sql/opt/memo/testdata/stats/scan | 18 +- pkg/sql/opt/memo/testdata/stats/select | 4 +- pkg/sql/opt/memo/testdata/stats_quality/tpcc | 20 +- .../opt/memo/testdata/stats_quality/tpch/q02 | 204 ++--- .../opt/memo/testdata/stats_quality/tpch/q03 | 38 +- .../opt/memo/testdata/stats_quality/tpch/q05 | 66 +- .../opt/memo/testdata/stats_quality/tpch/q06 | 8 +- .../opt/memo/testdata/stats_quality/tpch/q08 | 190 ++--- .../opt/memo/testdata/stats_quality/tpch/q09 | 599 ++++++++------- .../opt/memo/testdata/stats_quality/tpch/q10 | 102 +-- .../opt/memo/testdata/stats_quality/tpch/q11 | 54 +- .../opt/memo/testdata/stats_quality/tpch/q12 | 16 +- .../opt/memo/testdata/stats_quality/tpch/q13 | 12 +- .../opt/memo/testdata/stats_quality/tpch/q14 | 16 +- .../opt/memo/testdata/stats_quality/tpch/q15 | 32 +- .../opt/memo/testdata/stats_quality/tpch/q16 | 48 +- .../opt/memo/testdata/stats_quality/tpch/q17 | 12 +- .../opt/memo/testdata/stats_quality/tpch/q18 | 58 +- .../opt/memo/testdata/stats_quality/tpch/q19 | 4 +- .../opt/memo/testdata/stats_quality/tpch/q20 | 28 +- .../opt/memo/testdata/stats_quality/tpch/q21 | 62 +- pkg/sql/opt/props/histogram.go | 8 +- pkg/sql/opt/props/selectivity.go | 43 ++ pkg/sql/opt/props/statistics.go | 16 +- pkg/sql/opt/xform/testdata/coster/join | 12 +- pkg/sql/opt/xform/testdata/external/customer | 4 +- pkg/sql/opt/xform/testdata/external/hibernate | 47 +- .../opt/xform/testdata/external/tpce-no-stats | 62 +- pkg/sql/opt/xform/testdata/external/tpch | 213 +++--- .../opt/xform/testdata/external/tpch-no-stats | 713 +++++++++--------- pkg/sql/opt/xform/testdata/external/trading | 14 +- .../xform/testdata/external/trading-mutation | 12 +- pkg/sql/opt/xform/testdata/rules/select | 19 +- 43 files changed, 1593 insertions(+), 1560 deletions(-) create mode 100644 pkg/sql/opt/props/selectivity.go diff --git a/pkg/sql/opt/exec/execbuilder/testdata/inverted_index b/pkg/sql/opt/exec/execbuilder/testdata/inverted_index index e5880d076742..82f281cb77cf 100644 --- a/pkg/sql/opt/exec/execbuilder/testdata/inverted_index +++ b/pkg/sql/opt/exec/execbuilder/testdata/inverted_index @@ -955,7 +955,7 @@ inner-join (lookup geo_table) │ ├── columns: geo_table2.k:1 geo_table2.geom:2 geo_table.k:5 │ ├── inverted-expr │ │ └── st_intersects(geo_table2.geom:2, geo_table.geom:6) - │ ├── stats: [rows=10000, distinct(1)=999.956829, null(1)=0, distinct(5)=999.956829, null(5)=0] + │ ├── stats: [rows=10000, distinct(1)=1000, null(1)=0, distinct(5)=1000, null(5)=0] │ ├── cost: 41784.03 │ ├── key: (1,5) │ ├── fd: (1)-->(2) @@ -1075,7 +1075,7 @@ semi-join (lookup geo_table) │ ├── columns: geo_table2.k:1 geo_table2.geom:2 geo_table.k:5 continuation:11 │ ├── inverted-expr │ │ └── st_intersects(geo_table2.geom:2, geo_table.geom:6) - │ ├── stats: [rows=10000, distinct(1)=999.956829, null(1)=0] + │ ├── stats: [rows=10000, distinct(1)=1000, null(1)=0] │ ├── cost: 41984.03 │ ├── key: (1,5) │ ├── fd: (1)-->(2), (5)-->(11) diff --git a/pkg/sql/opt/exec/execbuilder/testdata/join b/pkg/sql/opt/exec/execbuilder/testdata/join index 405265e8a78a..2eaa7e8c0333 100644 --- a/pkg/sql/opt/exec/execbuilder/testdata/join +++ b/pkg/sql/opt/exec/execbuilder/testdata/join @@ -431,123 +431,123 @@ vectorized: true │ render 12: relname │ └── • hash join (inner) - │ columns: (attrelid, attname, attnum, attrelid, attname, attnum, oid, relname, relnamespace, oid, conname, contype, condeferrable, condeferred, conrelid, confrelid, confupdtype, confdeltype, conkey, confkey, oid, nspname, generate_series, oid, relname, relnamespace, oid, nspname, objid, refobjid, oid, relname, relkind) + │ columns: (oid, nspname, oid, relname, relnamespace, attrelid, attname, attnum, attrelid, attname, attnum, objid, refobjid, oid, relname, relkind, oid, relname, relnamespace, oid, conname, contype, condeferrable, condeferred, conrelid, confrelid, confupdtype, confdeltype, conkey, confkey, oid, nspname, generate_series) │ estimated row count: 110,908 (missing stats) - │ equality: (oid) = (objid) + │ equality: (oid) = (attrelid) + │ pred: attnum = confkey[generate_series] │ ├── • hash join (inner) - │ │ columns: (attrelid, attname, attnum, attrelid, attname, attnum, oid, relname, relnamespace, oid, conname, contype, condeferrable, condeferred, conrelid, confrelid, confupdtype, confdeltype, conkey, confkey, oid, nspname, generate_series, oid, relname, relnamespace, oid, nspname) - │ │ estimated row count: 114,302 (missing stats) - │ │ equality: (relnamespace) = (oid) + │ │ columns: (oid, nspname, oid, relname, relnamespace) + │ │ estimated row count: 9,801 (missing stats) + │ │ equality: (oid) = (relnamespace) │ │ - │ ├── • hash join (inner) - │ │ │ columns: (attrelid, attname, attnum, attrelid, attname, attnum, oid, relname, relnamespace, oid, conname, contype, condeferrable, condeferred, conrelid, confrelid, confupdtype, confdeltype, conkey, confkey, oid, nspname, generate_series, oid, relname, relnamespace) - │ │ │ estimated row count: 11,557 (missing stats) - │ │ │ equality: (attrelid) = (oid) - │ │ │ pred: attnum = confkey[generate_series] - │ │ │ - │ │ ├── • hash join (inner) - │ │ │ │ columns: (attrelid, attname, attnum, attrelid, attname, attnum, oid, relname, relnamespace, oid, conname, contype, condeferrable, condeferred, conrelid, confrelid, confupdtype, confdeltype, conkey, confkey, oid, nspname, generate_series) - │ │ │ │ estimated row count: 3,502 (missing stats) - │ │ │ │ equality: (attrelid) = (confrelid) - │ │ │ │ - │ │ │ ├── • virtual table - │ │ │ │ columns: (attrelid, attname, attnum) - │ │ │ │ estimated row count: 1,000 (missing stats) - │ │ │ │ table: pg_attribute@primary - │ │ │ │ - │ │ │ └── • cross join (inner) - │ │ │ │ columns: (attrelid, attname, attnum, oid, relname, relnamespace, oid, conname, contype, condeferrable, condeferred, conrelid, confrelid, confupdtype, confdeltype, conkey, confkey, oid, nspname, generate_series) - │ │ │ │ estimated row count: 354 (missing stats) - │ │ │ │ pred: attnum = conkey[generate_series] - │ │ │ │ - │ │ │ ├── • merge join (inner) - │ │ │ │ │ columns: (attrelid, attname, attnum, oid, relname, relnamespace, oid, conname, contype, condeferrable, condeferred, conrelid, confrelid, confupdtype, confdeltype, conkey, confkey, oid, nspname) - │ │ │ │ │ estimated row count: 107 (missing stats) - │ │ │ │ │ equality: (attrelid) = (oid) - │ │ │ │ │ merge ordering: +"(attrelid=oid)" - │ │ │ │ │ - │ │ │ │ ├── • virtual table - │ │ │ │ │ columns: (attrelid, attname, attnum) - │ │ │ │ │ ordering: +attrelid - │ │ │ │ │ estimated row count: 1,000 (missing stats) - │ │ │ │ │ table: pg_attribute@pg_attribute_attrelid_idx - │ │ │ │ │ - │ │ │ │ └── • sort - │ │ │ │ │ columns: (oid, relname, relnamespace, oid, conname, contype, condeferrable, condeferred, conrelid, confrelid, confupdtype, confdeltype, conkey, confkey, oid, nspname) - │ │ │ │ │ ordering: +oid - │ │ │ │ │ estimated row count: 11 (missing stats) - │ │ │ │ │ order: +oid - │ │ │ │ │ - │ │ │ │ └── • hash join (inner) - │ │ │ │ │ columns: (oid, relname, relnamespace, oid, conname, contype, condeferrable, condeferred, conrelid, confrelid, confupdtype, confdeltype, conkey, confkey, oid, nspname) - │ │ │ │ │ estimated row count: 11 (missing stats) - │ │ │ │ │ equality: (relnamespace) = (oid) - │ │ │ │ │ - │ │ │ │ ├── • virtual table lookup join (inner) - │ │ │ │ │ │ columns: (oid, relname, relnamespace, oid, conname, contype, condeferrable, condeferred, conrelid, confrelid, confupdtype, confdeltype, conkey, confkey) - │ │ │ │ │ │ estimated row count: 10 (missing stats) - │ │ │ │ │ │ table: pg_constraint@pg_constraint_conrelid_idx - │ │ │ │ │ │ equality: (oid) = (conrelid) - │ │ │ │ │ │ pred: contype = 'f' - │ │ │ │ │ │ - │ │ │ │ │ └── • filter - │ │ │ │ │ │ columns: (oid, relname, relnamespace) - │ │ │ │ │ │ estimated row count: 10 (missing stats) - │ │ │ │ │ │ filter: relname = 'orders' - │ │ │ │ │ │ - │ │ │ │ │ └── • virtual table - │ │ │ │ │ columns: (oid, relname, relnamespace) - │ │ │ │ │ estimated row count: 1,000 (missing stats) - │ │ │ │ │ table: pg_class@primary - │ │ │ │ │ - │ │ │ │ └── • filter - │ │ │ │ │ columns: (oid, nspname) - │ │ │ │ │ estimated row count: 10 (missing stats) - │ │ │ │ │ filter: nspname = 'public' - │ │ │ │ │ - │ │ │ │ └── • virtual table - │ │ │ │ columns: (oid, nspname) - │ │ │ │ estimated row count: 1,000 (missing stats) - │ │ │ │ table: pg_namespace@primary - │ │ │ │ - │ │ │ └── • project set - │ │ │ │ columns: (generate_series) - │ │ │ │ estimated row count: 10 - │ │ │ │ render 0: generate_series(1, 32) - │ │ │ │ - │ │ │ └── • emptyrow - │ │ │ columns: () - │ │ │ - │ │ └── • virtual table - │ │ columns: (oid, relname, relnamespace) - │ │ estimated row count: 1,000 (missing stats) - │ │ table: pg_class@primary + │ ├── • virtual table + │ │ columns: (oid, nspname) + │ │ estimated row count: 1,000 (missing stats) + │ │ table: pg_namespace@primary │ │ │ └── • virtual table - │ columns: (oid, nspname) + │ columns: (oid, relname, relnamespace) │ estimated row count: 1,000 (missing stats) - │ table: pg_namespace@primary + │ table: pg_class@primary │ └── • hash join (inner) - │ columns: (objid, refobjid, oid, relname, relkind) - │ estimated row count: 99 (missing stats) - │ equality: (refobjid) = (oid) + │ columns: (attrelid, attname, attnum, attrelid, attname, attnum, objid, refobjid, oid, relname, relkind, oid, relname, relnamespace, oid, conname, contype, condeferrable, condeferred, conrelid, confrelid, confupdtype, confdeltype, conkey, confkey, oid, nspname, generate_series) + │ estimated row count: 3,433 (missing stats) + │ equality: (attrelid) = (confrelid) │ ├── • virtual table - │ columns: (objid, refobjid) + │ columns: (attrelid, attname, attnum) │ estimated row count: 1,000 (missing stats) - │ table: pg_depend@primary + │ table: pg_attribute@primary │ - └── • filter - │ columns: (oid, relname, relkind) - │ estimated row count: 10 (missing stats) - │ filter: relkind = 'i' + └── • cross join (inner) + │ columns: (attrelid, attname, attnum, objid, refobjid, oid, relname, relkind, oid, relname, relnamespace, oid, conname, contype, condeferrable, condeferred, conrelid, confrelid, confupdtype, confdeltype, conkey, confkey, oid, nspname, generate_series) + │ estimated row count: 347 (missing stats) + │ pred: attnum = conkey[generate_series] │ - └── • virtual table - columns: (oid, relname, relkind) - estimated row count: 1,000 (missing stats) - table: pg_class@primary + ├── • merge join (inner) + │ │ columns: (attrelid, attname, attnum, objid, refobjid, oid, relname, relkind, oid, relname, relnamespace, oid, conname, contype, condeferrable, condeferred, conrelid, confrelid, confupdtype, confdeltype, conkey, confkey, oid, nspname) + │ │ estimated row count: 105 (missing stats) + │ │ equality: (attrelid) = (oid) + │ │ merge ordering: +"(attrelid=oid)" + │ │ + │ ├── • virtual table + │ │ columns: (attrelid, attname, attnum) + │ │ ordering: +attrelid + │ │ estimated row count: 1,000 (missing stats) + │ │ table: pg_attribute@pg_attribute_attrelid_idx + │ │ + │ └── • sort + │ │ columns: (objid, refobjid, oid, relname, relkind, oid, relname, relnamespace, oid, conname, contype, condeferrable, condeferred, conrelid, confrelid, confupdtype, confdeltype, conkey, confkey, oid, nspname) + │ │ ordering: +oid + │ │ estimated row count: 11 (missing stats) + │ │ order: +oid + │ │ + │ └── • hash join (inner) + │ │ columns: (objid, refobjid, oid, relname, relkind, oid, relname, relnamespace, oid, conname, contype, condeferrable, condeferred, conrelid, confrelid, confupdtype, confdeltype, conkey, confkey, oid, nspname) + │ │ estimated row count: 11 (missing stats) + │ │ equality: (relnamespace) = (oid) + │ │ + │ ├── • hash join (inner) + │ │ │ columns: (objid, refobjid, oid, relname, relkind, oid, relname, relnamespace, oid, conname, contype, condeferrable, condeferred, conrelid, confrelid, confupdtype, confdeltype, conkey, confkey) + │ │ │ estimated row count: 10 (missing stats) + │ │ │ equality: (objid) = (oid) + │ │ │ + │ │ ├── • hash join (inner) + │ │ │ │ columns: (objid, refobjid, oid, relname, relkind) + │ │ │ │ estimated row count: 99 (missing stats) + │ │ │ │ equality: (refobjid) = (oid) + │ │ │ │ + │ │ │ ├── • virtual table + │ │ │ │ columns: (objid, refobjid) + │ │ │ │ estimated row count: 1,000 (missing stats) + │ │ │ │ table: pg_depend@primary + │ │ │ │ + │ │ │ └── • filter + │ │ │ │ columns: (oid, relname, relkind) + │ │ │ │ estimated row count: 10 (missing stats) + │ │ │ │ filter: relkind = 'i' + │ │ │ │ + │ │ │ └── • virtual table + │ │ │ columns: (oid, relname, relkind) + │ │ │ estimated row count: 1,000 (missing stats) + │ │ │ table: pg_class@primary + │ │ │ + │ │ └── • virtual table lookup join (inner) + │ │ │ columns: (oid, relname, relnamespace, oid, conname, contype, condeferrable, condeferred, conrelid, confrelid, confupdtype, confdeltype, conkey, confkey) + │ │ │ estimated row count: 10 (missing stats) + │ │ │ table: pg_constraint@pg_constraint_conrelid_idx + │ │ │ equality: (oid) = (conrelid) + │ │ │ pred: contype = 'f' + │ │ │ + │ │ └── • filter + │ │ │ columns: (oid, relname, relnamespace) + │ │ │ estimated row count: 10 (missing stats) + │ │ │ filter: relname = 'orders' + │ │ │ + │ │ └── • virtual table + │ │ columns: (oid, relname, relnamespace) + │ │ estimated row count: 1,000 (missing stats) + │ │ table: pg_class@primary + │ │ + │ └── • filter + │ │ columns: (oid, nspname) + │ │ estimated row count: 10 (missing stats) + │ │ filter: nspname = 'public' + │ │ + │ └── • virtual table + │ columns: (oid, nspname) + │ estimated row count: 1,000 (missing stats) + │ table: pg_namespace@primary + │ + └── • project set + │ columns: (generate_series) + │ estimated row count: 10 + │ render 0: generate_series(1, 32) + │ + └── • emptyrow + columns: () # Ensure that left joins on non-null foreign keys turn into inner joins statement ok @@ -766,7 +766,7 @@ vectorized: true · • filter │ columns: (a, b, n, sq) -│ estimated row count: 115 (missing stats) +│ estimated row count: 0 (missing stats) │ filter: ((n IS NULL) OR (n > 1)) AND ((n IS NULL) OR (a < sq)) │ └── • hash join (left outer) @@ -808,7 +808,7 @@ vectorized: true · • filter │ columns: (a, b, n, sq) -│ estimated row count: 42 (missing stats) +│ estimated row count: 0 (missing stats) │ filter: ((a IS NULL) OR (a > 2)) AND ((a IS NULL) OR (a < sq)) │ └── • hash join (left outer) diff --git a/pkg/sql/opt/exec/execbuilder/testdata/lookup_join b/pkg/sql/opt/exec/execbuilder/testdata/lookup_join index 3565c2a0f911..259c949ff703 100644 --- a/pkg/sql/opt/exec/execbuilder/testdata/lookup_join +++ b/pkg/sql/opt/exec/execbuilder/testdata/lookup_join @@ -315,7 +315,7 @@ vectorized: true · • distinct │ columns: (name) -│ estimated row count: 96 +│ estimated row count: 100 │ distinct on: name │ └── • project diff --git a/pkg/sql/opt/memo/statistics_builder.go b/pkg/sql/opt/memo/statistics_builder.go index f1824ac0ce7e..2e33c24e00f7 100644 --- a/pkg/sql/opt/memo/statistics_builder.go +++ b/pkg/sql/opt/memo/statistics_builder.go @@ -702,7 +702,7 @@ func (sb *statisticsBuilder) buildScan(scan *ScanExpr, relProps *props.Relationa // calculate selectivity = 1/9 + 1/9 + 1/9 = 1/3 in spanStatsUnion, which // is too high. Instead, we should use the value calculated from the // combined spans, which in this case is simply 1/9. - s.Selectivity = min(s.Selectivity, spanStatsUnion.Selectivity) + s.Selectivity = minSelectivity(s.Selectivity, spanStatsUnion.Selectivity) s.RowCount = min(s.RowCount, spanStatsUnion.RowCount) sb.finalizeFromCardinality(relProps) @@ -885,7 +885,7 @@ func (sb *statisticsBuilder) colStatSelect( // filter conditions were pushed down into the input after s.Selectivity // was calculated. For example, an index scan or index join created during // exploration could absorb some of the filter conditions. - selectivity := s.RowCount / inputStats.RowCount + selectivity := props.Selectivity(s.RowCount / inputStats.RowCount) colStat.ApplySelectivity(selectivity, inputStats.RowCount) if colSet.Intersects(relProps.NotNullCols) { colStat.NullCount = 0 @@ -1160,7 +1160,7 @@ func (sb *statisticsBuilder) buildJoin( // This is like an index join, so apply a selectivity that will result // in leftStats.RowCount rows. if rightStats.RowCount != 0 { - s.ApplySelectivity(1 / rightStats.RowCount) + s.ApplySelectivity(props.Selectivity(1 / rightStats.RowCount)) } } else { // Add the self join columns to equivReps so they are included in the @@ -1238,7 +1238,7 @@ func (sb *statisticsBuilder) buildJoin( switch h.joinType { case opt.AntiJoinOp, opt.AntiJoinApplyOp: s.RowCount = max(leftStats.RowCount-s.RowCount, epsilon) - s.Selectivity = max(1-s.Selectivity, epsilon) + s.Selectivity = (1-s.Selectivity).SelectivityInRange() // Converting column stats is error-prone. If any column stats are needed, // colStatJoin will use the selectivity calculated above to estimate the @@ -1421,7 +1421,7 @@ func (sb *statisticsBuilder) colStatJoin(colSet opt.ColSet, join RelExpr) *props rightNullCount, rightProps.Stats.RowCount, s.RowCount, - s.Selectivity*inputRowCount, + float64(s.Selectivity)*inputRowCount, ) // Ensure distinct count is non-zero. @@ -1594,7 +1594,7 @@ func (sb *statisticsBuilder) colStatIndexJoin( // of any filters on the input. inputStats := &inputProps.Stats tableStats := sb.makeTableStatistics(join.Table) - selectivity := inputStats.RowCount / tableStats.RowCount + selectivity := props.Selectivity(inputStats.RowCount / tableStats.RowCount) lookupColStat.ApplySelectivity(selectivity, tableStats.RowCount) // Multiply the distinct counts in case colStat.DistinctCount is @@ -1996,7 +1996,7 @@ func (sb *statisticsBuilder) buildLimit(limit *LimitExpr, relProps *props.Relati hardLimit := *cnst.Value.(*tree.DInt) if hardLimit > 0 { s.RowCount = min(float64(hardLimit), inputStats.RowCount) - s.Selectivity = s.RowCount / inputStats.RowCount + s.Selectivity = props.Selectivity(s.RowCount / inputStats.RowCount) } } @@ -2049,7 +2049,7 @@ func (sb *statisticsBuilder) buildOffset(offset *OffsetExpr, relProps *props.Rel } else if hardOffset > 0 { s.RowCount = inputStats.RowCount - float64(hardOffset) } - s.Selectivity = s.RowCount / inputStats.RowCount + s.Selectivity = props.Selectivity(s.RowCount / inputStats.RowCount) } sb.finalizeFromCardinality(relProps) @@ -2577,7 +2577,7 @@ func (sb *statisticsBuilder) finalizeFromRowCountAndDistinctCounts( if colStat.Histogram != nil { valuesCount := colStat.Histogram.ValuesCount() if valuesCount > rowCount { - colStat.Histogram = colStat.Histogram.ApplySelectivity(rowCount / valuesCount) + colStat.Histogram = colStat.Histogram.ApplySelectivity(props.Selectivity(rowCount / valuesCount)) } } } @@ -2821,6 +2821,13 @@ const ( multiColWeight = 9.0 / 10.0 ) +func minSelectivity(a, b props.Selectivity) props.Selectivity { + if a < b { + return a + } + return b +} + // countPaths returns the number of JSON or Array paths in the specified // FiltersItem. Used in the calculation of unapplied conjuncts in a // Contains operator. Returns 0 if paths could not be counted for any @@ -3491,7 +3498,7 @@ func (sb *statisticsBuilder) updateDistinctNullCountsFromEquivalency( // func (sb *statisticsBuilder) selectivityFromMultiColDistinctCounts( cols opt.ColSet, e RelExpr, s *props.Statistics, -) (selectivity float64) { +) (selectivity props.Selectivity) { // Respect the session setting OptimizerUseMultiColStats. if !sb.evalCtx.SessionData.OptimizerUseMultiColStats { return sb.selectivityFromSingleColDistinctCounts(cols, e, s) @@ -3502,11 +3509,11 @@ func (sb *statisticsBuilder) selectivityFromMultiColDistinctCounts( // First calculate the selectivity from equation (1) (see function comment), // and collect the inputs to equation (2). - singleColSelectivity := 1.0 + singleColSelectivity := props.Selectivity(1.0) newDistinctProduct, oldDistinctProduct := 1.0, 1.0 maxNewDistinct, maxOldDistinct := float64(0), float64(0) multiColNullCount := -1.0 - minLocalSel := math.MaxFloat64 + minLocalSel := props.Selectivity(math.MaxFloat64) for col, ok := cols.Next(0); ok; col, ok = cols.Next(col + 1) { colStat, ok := s.ColStats.Lookup(opt.MakeColSet(col)) if !ok { @@ -3516,7 +3523,7 @@ func (sb *statisticsBuilder) selectivityFromMultiColDistinctCounts( inputColStat, inputStats := sb.colStatFromInput(colStat.Cols, e) localSel := sb.selectivityFromDistinctCount(colStat, inputColStat, inputStats.RowCount) - singleColSelectivity *= localSel + singleColSelectivity = singleColSelectivity.Multiply(localSel) // Don't bother including columns in the multi-column calculation that // don't contribute to the selectivity. @@ -3606,7 +3613,7 @@ func (sb *statisticsBuilder) selectivityFromMultiColDistinctCounts( } } } - multiColSelectivity = min(multiColSelectivity, minLocalSel) + multiColSelectivity = minSelectivity(multiColSelectivity, minLocalSel) // As described in the function comment, we actually return a weighted sum // of multi-column and single-column selectivity estimates. @@ -3620,7 +3627,7 @@ func (sb *statisticsBuilder) selectivityFromMultiColDistinctCounts( // comment above that function for details. func (sb *statisticsBuilder) selectivityFromSingleColDistinctCounts( cols opt.ColSet, e RelExpr, s *props.Statistics, -) (selectivity float64) { +) (selectivity props.Selectivity) { selectivity = 1.0 for col, ok := cols.Next(0); ok; col, ok = cols.Next(col + 1) { colStat, ok := s.ColStats.Lookup(opt.MakeColSet(col)) @@ -3629,12 +3636,12 @@ func (sb *statisticsBuilder) selectivityFromSingleColDistinctCounts( } inputColStat, inputStats := sb.colStatFromInput(colStat.Cols, e) - selectivity *= sb.selectivityFromDistinctCount(colStat, inputColStat, inputStats.RowCount) + selectivity = selectivity.Multiply(sb.selectivityFromDistinctCount(colStat, inputColStat, inputStats.RowCount)) } // Avoid setting selectivity to 0. The stats may be stale, and we // can end up with weird and inefficient plans if we estimate 0 rows. - return max(selectivity, epsilon) + return selectivity } // selectivityFromDistinctCount calculates the selectivity of a filter by using @@ -3642,7 +3649,7 @@ func (sb *statisticsBuilder) selectivityFromSingleColDistinctCounts( // columns before and after the filter was applied. func (sb *statisticsBuilder) selectivityFromDistinctCount( colStat, inputColStat *props.ColumnStatistic, inputRowCount float64, -) float64 { +) props.Selectivity { newDistinct := colStat.DistinctCount oldDistinct := inputColStat.DistinctCount @@ -3656,8 +3663,8 @@ func (sb *statisticsBuilder) selectivityFromDistinctCount( } // Calculate the selectivity of the predicate. - nonNullSelectivity := fraction(newDistinct, oldDistinct) - nullSelectivity := fraction(colStat.NullCount, inputColStat.NullCount) + nonNullSelectivity := props.Selectivity(fraction(newDistinct, oldDistinct)) + nullSelectivity := props.Selectivity(fraction(colStat.NullCount, inputColStat.NullCount)) return sb.predicateSelectivity( nonNullSelectivity, nullSelectivity, inputColStat.NullCount, inputRowCount, ) @@ -3671,7 +3678,7 @@ func (sb *statisticsBuilder) selectivityFromDistinctCount( // (# values in histogram after filter) / (# values in histogram before filter). func (sb *statisticsBuilder) selectivityFromHistograms( cols opt.ColSet, e RelExpr, s *props.Statistics, -) (selectivity float64) { +) (selectivity props.Selectivity) { selectivity = 1.0 for col, ok := cols.Next(0); ok; col, ok = cols.Next(col + 1) { colStat, ok := s.ColStats.Lookup(opt.MakeColSet(col)) @@ -3690,16 +3697,16 @@ func (sb *statisticsBuilder) selectivityFromHistograms( oldCount := oldHist.ValuesCount() // Calculate the selectivity of the predicate. - nonNullSelectivity := fraction(newCount, oldCount) - nullSelectivity := fraction(colStat.NullCount, inputColStat.NullCount) - selectivity *= sb.predicateSelectivity( + nonNullSelectivity := props.Selectivity(fraction(newCount, oldCount)) + nullSelectivity := props.Selectivity(fraction(colStat.NullCount, inputColStat.NullCount)) + selectivity = selectivity.Multiply(sb.predicateSelectivity( nonNullSelectivity, nullSelectivity, inputColStat.NullCount, inputStats.RowCount, - ) + )) } // Avoid setting selectivity to 0. The stats may be stale, and we // can end up with weird and inefficient plans if we estimate 0 rows. - return max(selectivity, epsilon) + return selectivity } // selectivityFromNullsRemoved calculates the selectivity from null-rejecting @@ -3708,23 +3715,23 @@ func (sb *statisticsBuilder) selectivityFromHistograms( // should be designated by ignoreCols. func (sb *statisticsBuilder) selectivityFromNullsRemoved( e RelExpr, notNullCols opt.ColSet, ignoreCols opt.ColSet, -) (selectivity float64) { +) (selectivity props.Selectivity) { selectivity = 1.0 notNullCols.ForEach(func(col opt.ColumnID) { if !ignoreCols.Contains(col) { inputColStat, inputStats := sb.colStatFromInput(opt.MakeColSet(col), e) - selectivity *= sb.predicateSelectivity( + selectivity = selectivity.Multiply(sb.predicateSelectivity( 1, /* nonNullSelectivity */ 0, /* nullSelectivity */ inputColStat.NullCount, inputStats.RowCount, - ) + )) } }) // Avoid setting selectivity to 0. The stats may be stale, and we // can end up with weird and inefficient plans if we estimate 0 rows. - return max(selectivity, epsilon) + return selectivity } // predicateSelectivity calculates the selectivity of a predicate, using the @@ -3739,35 +3746,35 @@ func (sb *statisticsBuilder) selectivityFromNullsRemoved( // (fraction of null values preserved) * (number of null input rows) // func (sb *statisticsBuilder) predicateSelectivity( - nonNullSelectivity, nullSelectivity, inputNullCount, inputRowCount float64, -) float64 { - outRowCount := nonNullSelectivity*(inputRowCount-inputNullCount) + nullSelectivity*inputNullCount - sel := outRowCount / inputRowCount + nonNullSelectivity, nullSelectivity props.Selectivity, inputNullCount, inputRowCount float64, +) props.Selectivity { + outRowCount := float64(nonNullSelectivity)*(inputRowCount-inputNullCount) + float64(nullSelectivity)*inputNullCount + sel := props.MakeSelectivity(outRowCount / inputRowCount) // Avoid setting selectivity to 0. The stats may be stale, and we // can end up with weird and inefficient plans if we estimate 0 rows. - return max(sel, epsilon) + return sel } // selectivityFromEquivalencies determines the selectivity of equality // constraints. It must be called before applyEquivalencies. func (sb *statisticsBuilder) selectivityFromEquivalencies( equivReps opt.ColSet, filterFD *props.FuncDepSet, e RelExpr, s *props.Statistics, -) (selectivity float64) { +) (selectivity props.Selectivity) { selectivity = 1.0 equivReps.ForEach(func(i opt.ColumnID) { equivGroup := filterFD.ComputeEquivGroup(i) - selectivity *= sb.selectivityFromEquivalency(equivGroup, e, s) + selectivity = selectivity.Multiply(sb.selectivityFromEquivalency(equivGroup, e, s)) }) // Avoid setting selectivity to 0. The stats may be stale, and we // can end up with weird and inefficient plans if we estimate 0 rows. - return max(selectivity, epsilon) + return selectivity } func (sb *statisticsBuilder) selectivityFromEquivalency( equivGroup opt.ColSet, e RelExpr, s *props.Statistics, -) (selectivity float64) { +) (selectivity props.Selectivity) { // Find the maximum input distinct count for all columns in this equivalency // group. maxDistinctCount := float64(0) @@ -3789,7 +3796,7 @@ func (sb *statisticsBuilder) selectivityFromEquivalency( // The selectivity of an equality condition var1=var2 is // 1/max(distinct(var1), distinct(var2)). - return fraction(1, maxDistinctCount) + return props.Selectivity(fraction(1, maxDistinctCount)) } // selectivityFromEquivalenciesSemiJoin determines the selectivity of equality @@ -3799,23 +3806,23 @@ func (sb *statisticsBuilder) selectivityFromEquivalenciesSemiJoin( filterFD *props.FuncDepSet, e RelExpr, s *props.Statistics, -) (selectivity float64) { +) (selectivity props.Selectivity) { selectivity = 1.0 equivReps.ForEach(func(i opt.ColumnID) { equivGroup := filterFD.ComputeEquivGroup(i) - selectivity *= sb.selectivityFromEquivalencySemiJoin( + selectivity = selectivity.Multiply(sb.selectivityFromEquivalencySemiJoin( equivGroup, leftOutputCols, rightOutputCols, e, s, - ) + )) }) // Avoid setting selectivity to 0. The stats may be stale, and we // can end up with weird and inefficient plans if we estimate 0 rows. - return max(selectivity, epsilon) + return selectivity } func (sb *statisticsBuilder) selectivityFromEquivalencySemiJoin( equivGroup, leftOutputCols, rightOutputCols opt.ColSet, e RelExpr, s *props.Statistics, -) (selectivity float64) { +) (selectivity props.Selectivity) { // Find the minimum (maximum) input distinct count for all columns in this // equivalency group from the right (left). minDistinctCountRight := math.MaxFloat64 @@ -3842,23 +3849,23 @@ func (sb *statisticsBuilder) selectivityFromEquivalencySemiJoin( maxDistinctCountLeft = s.RowCount } - return fraction(minDistinctCountRight, maxDistinctCountLeft) + return props.Selectivity(fraction(minDistinctCountRight, maxDistinctCountLeft)) } func (sb *statisticsBuilder) selectivityFromInvertedJoinCondition( e RelExpr, s *props.Statistics, -) (selectivity float64) { +) (selectivity props.Selectivity) { return unknownInvertedJoinSelectivity } func (sb *statisticsBuilder) selectivityFromUnappliedConjuncts( numUnappliedConjuncts float64, -) (selectivity float64) { - selectivity = math.Pow(unknownFilterSelectivity, numUnappliedConjuncts) +) (selectivity props.Selectivity) { + selectivity = props.MakeSelectivity(math.Pow(unknownFilterSelectivity, numUnappliedConjuncts)) // Avoid setting selectivity to 0. The stats may be stale, and we // can end up with weird and inefficient plans if we estimate 0 rows. - return max(selectivity, epsilon) + return selectivity } // tryReduceCols is used to determine which columns to use for selectivity diff --git a/pkg/sql/opt/memo/testdata/stats/inverted-geo b/pkg/sql/opt/memo/testdata/stats/inverted-geo index 834765e4c4fb..5e7406760266 100644 --- a/pkg/sql/opt/memo/testdata/stats/inverted-geo +++ b/pkg/sql/opt/memo/testdata/stats/inverted-geo @@ -183,7 +183,7 @@ project │ │ ├── columns: rowid:3(int!null) g_inverted_key:5(geometry!null) │ │ ├── inverted constraint: /5/3 │ │ │ └── spans: ["B\xfd\xff\xff\xff\xff\xff\xff\xff\xff", "B\xfd\xff\xff\xff\xff\xff\xff\xff\xff"] - │ │ ├── stats: [rows=7e-07, distinct(3)=1.99999931e-07, null(3)=0, distinct(5)=7e-07, null(5)=0] + │ │ ├── stats: [rows=7e-07, distinct(3)=7e-07, null(3)=0, distinct(5)=7e-07, null(5)=0] │ │ │ histogram(5)= │ │ ├── key: (3) │ │ └── fd: (3)-->(5) @@ -402,7 +402,7 @@ project │ │ ├── columns: rowid:3(int!null) g_inverted_key:5(geometry!null) │ │ ├── inverted constraint: /5/3 │ │ │ └── spans: ["B\xfd\xff\xff\xff\xff\xff\xff\xff\xff", "B\xfd\xff\xff\xff\xff\xff\xff\xff\xff"] - │ │ ├── stats: [rows=7e-07, distinct(3)=1.99999931e-07, null(3)=0, distinct(5)=7e-07, null(5)=0] + │ │ ├── stats: [rows=7e-07, distinct(3)=7e-07, null(3)=0, distinct(5)=7e-07, null(5)=0] │ │ │ histogram(5)= │ │ ├── key: (3) │ │ └── fd: (3)-->(5) diff --git a/pkg/sql/opt/memo/testdata/stats/inverted-join b/pkg/sql/opt/memo/testdata/stats/inverted-join index 4e983cf08040..cf2b1789ecb2 100644 --- a/pkg/sql/opt/memo/testdata/stats/inverted-join +++ b/pkg/sql/opt/memo/testdata/stats/inverted-join @@ -33,7 +33,7 @@ project │ ├── columns: ltable.k:1(int!null) ltable.geom:2(geometry) rtable.k:4(int!null) │ ├── inverted-expr │ │ └── st_intersects(ltable.geom:2, rtable.geom:5) [type=bool] - │ ├── stats: [rows=10000, distinct(1)=999.956829, null(1)=0, distinct(4)=999.956829, null(4)=0] + │ ├── stats: [rows=10000, distinct(1)=1000, null(1)=0, distinct(4)=1000, null(4)=0] │ ├── key: (1,4) │ ├── fd: (1)-->(2) │ ├── scan ltable @@ -65,7 +65,7 @@ project │ ├── columns: ltable.k:1(int!null) ltable.geom:2(geometry) rtable.k:4(int!null) │ ├── inverted-expr │ │ └── st_intersects(ltable.geom:2, rtable.geom:5) [type=bool] - │ ├── stats: [rows=10000, distinct(1)=999.956829, null(1)=0, distinct(4)=999.956829, null(4)=0] + │ ├── stats: [rows=10000, distinct(1)=1000, null(1)=0, distinct(4)=1000, null(4)=0] │ ├── key: (1,4) │ ├── fd: (1)-->(2) │ ├── scan ltable @@ -138,7 +138,7 @@ project │ ├── columns: t1.k:1(int!null) t2.j:8(jsonb) │ ├── inverted-expr │ │ └── t1.j:2 @> t2.j:8 [type=bool] - │ ├── stats: [rows=100, distinct(1)=95.617925, null(1)=0] + │ ├── stats: [rows=100, distinct(1)=100, null(1)=0] │ ├── scan json_arr2 [as=t2] │ │ ├── columns: t2.j:8(jsonb) │ │ └── stats: [rows=10] @@ -167,7 +167,7 @@ inner-join (lookup json_arr1 [as=t1]) │ ├── columns: t1.k:1(int!null) t2.k:7(int!null) t2.j:8(jsonb) t2.a:9(string[]) │ ├── inverted-expr │ │ └── (t1.a:3 @> t2.a:9) AND (t1.a:3 @> ARRAY['foo']) [type=bool] - │ ├── stats: [rows=33.3333333, distinct(1)=32.9461714, null(1)=0, distinct(7)=3.33318943, null(7)=0] + │ ├── stats: [rows=33.3333333, distinct(1)=33.3333333, null(1)=0, distinct(7)=3.33333333, null(7)=0] │ ├── key: (1,7) │ ├── fd: (7)-->(8,9) │ ├── scan json_arr2 [as=t2] @@ -202,7 +202,7 @@ project │ ├── columns: t1.k:1(int!null) t2.k:7(int!null) t2.j:8(jsonb) t2.a:9(string[]) │ ├── inverted-expr │ │ └── t1.j:2 @> t2.j:8 [type=bool] - │ ├── stats: [rows=33.3333333, distinct(7)=3.33318943, null(7)=0] + │ ├── stats: [rows=33.3333333, distinct(7)=3.33333333, null(7)=0] │ ├── key: (1,7) │ ├── fd: (7)-->(8,9) │ ├── scan json_arr2 [as=t2] diff --git a/pkg/sql/opt/memo/testdata/stats/join b/pkg/sql/opt/memo/testdata/stats/join index 9726a3e27ba3..aedc92bbec31 100644 --- a/pkg/sql/opt/memo/testdata/stats/join +++ b/pkg/sql/opt/memo/testdata/stats/join @@ -438,18 +438,18 @@ GROUP BY y project ├── columns: count:10(int!null) ├── immutable - ├── stats: [rows=138.170075] + ├── stats: [rows=166.666667] └── group-by ├── columns: y:2(int) count_rows:10(int!null) ├── grouping columns: y:2(int) ├── immutable - ├── stats: [rows=138.170075, distinct(2)=138.170075, null(2)=0] + ├── stats: [rows=166.666667, distinct(2)=166.666667, null(2)=0] ├── key: (2) ├── fd: (2)-->(10) ├── semi-join (hash) │ ├── columns: x:1(int!null) y:2(int) │ ├── immutable - │ ├── stats: [rows=166.666667, distinct(1)=166.666667, null(1)=0, distinct(2)=138.170075, null(2)=0] + │ ├── stats: [rows=166.666667, distinct(1)=166.666667, null(1)=0, distinct(2)=166.666667, null(2)=0] │ ├── key: (1) │ ├── fd: (1)-->(2) │ ├── scan xysd @@ -475,18 +475,18 @@ GROUP BY y project ├── columns: count:10(int!null) ├── immutable - ├── stats: [rows=400] + ├── stats: [rows=5.00000056e-07] └── group-by ├── columns: y:2(int) count_rows:10(int!null) ├── grouping columns: y:2(int) ├── immutable - ├── stats: [rows=400, distinct(2)=400, null(2)=0] + ├── stats: [rows=5.00000056e-07, distinct(2)=5.00000056e-07, null(2)=0] ├── key: (2) ├── fd: (2)-->(10) ├── anti-join (hash) │ ├── columns: x:1(int!null) y:2(int) │ ├── immutable - │ ├── stats: [rows=4833.33333, distinct(2)=400, null(2)=0] + │ ├── stats: [rows=4833.33333, distinct(2)=5.00000056e-07, null(2)=0] │ ├── key: (1) │ ├── fd: (1)-->(2) │ ├── scan xysd @@ -549,19 +549,19 @@ GROUP BY y project ├── columns: count:10(int!null) ├── immutable - ├── stats: [rows=399.903879] + ├── stats: [rows=400] └── group-by ├── columns: y:2(int) count_rows:10(int!null) ├── grouping columns: y:2(int) ├── immutable - ├── stats: [rows=399.903879, distinct(2)=399.903879, null(2)=1] + ├── stats: [rows=400, distinct(2)=400, null(2)=-49990000] ├── key: (2) ├── fd: (2)-->(10) ├── left-join (hash) │ ├── columns: x:1(int) y:2(int) u:6(int) v:7(int!null) │ ├── multiplicity: left-rows(exactly-one), right-rows(zero-or-more) │ ├── immutable - │ ├── stats: [rows=10000, distinct(1)=500, null(1)=6666.66667, distinct(2)=399.903879, null(2)=6666.66667] + │ ├── stats: [rows=10000, distinct(1)=500, null(1)=6666.66667, distinct(2)=400, null(2)=-49990000] │ ├── fd: (1)-->(2) │ ├── scan uv │ │ ├── columns: u:6(int) v:7(int!null) @@ -591,14 +591,14 @@ project ├── columns: y:2(int) count_rows:10(int!null) ├── grouping columns: y:2(int) ├── immutable - ├── stats: [rows=400, distinct(2)=400, null(2)=1] + ├── stats: [rows=400, distinct(2)=400, null(2)=0] ├── key: (2) ├── fd: (2)-->(10) ├── full-join (hash) │ ├── columns: x:1(int) y:2(int) u:6(int) v:7(int) │ ├── multiplicity: left-rows(one-or-more), right-rows(exactly-one) │ ├── immutable - │ ├── stats: [rows=11666.6667, distinct(2)=400, null(2)=6666.66667] + │ ├── stats: [rows=11666.6667, distinct(2)=400, null(2)=0] │ ├── fd: (1)-->(2) │ ├── scan xysd │ │ ├── columns: x:1(int!null) y:2(int) @@ -726,13 +726,13 @@ SELECT *, rowid FROM xysd INNER JOIN uv ON x=u ---- project ├── columns: x:1(int!null) y:2(int) s:3(string) d:4(decimal!null) u:6(int!null) v:7(int!null) rowid:8(int!null) - ├── stats: [rows=5000, distinct(2)=399.99851, null(2)=2500, distinct(3)=499.977311, null(3)=50, distinct(6)=499, null(6)=0, distinct(2,3)=3160.69477, null(2,3)=25, distinct(3,6)=5000, null(3,6)=0, distinct(1,2,8)=5000, null(1,2,8)=0] + ├── stats: [rows=5000, distinct(2)=400, null(2)=2500, distinct(3)=500, null(3)=50, distinct(6)=499, null(6)=0, distinct(2,3)=5000, null(2,3)=25, distinct(3,6)=5000, null(3,6)=0, distinct(1,2,8)=5000, null(1,2,8)=0] ├── key: (8) ├── fd: (1)-->(2-4), (3,4)~~>(1,2,6), (8)-->(1-4,6,7), (1)==(6), (6)==(1) └── inner-join (hash) ├── columns: x:1(int!null) y:2(int) s:3(string) d:4(decimal!null) xysd.crdb_internal_mvcc_timestamp:5(decimal) u:6(int!null) v:7(int!null) rowid:8(int!null) uv.crdb_internal_mvcc_timestamp:9(decimal) ├── multiplicity: left-rows(zero-or-more), right-rows(zero-or-one) - ├── stats: [rows=5000, distinct(1)=499, null(1)=0, distinct(2)=399.99851, null(2)=2500, distinct(3)=499.977311, null(3)=50, distinct(6)=499, null(6)=0, distinct(2,3)=3160.69477, null(2,3)=25, distinct(3,6)=5000, null(3,6)=0, distinct(1,2,8)=5000, null(1,2,8)=0] + ├── stats: [rows=5000, distinct(1)=499, null(1)=0, distinct(2)=400, null(2)=2500, distinct(3)=500, null(3)=50, distinct(6)=499, null(6)=0, distinct(2,3)=5000, null(2,3)=25, distinct(3,6)=5000, null(3,6)=0, distinct(1,2,8)=5000, null(1,2,8)=0] ├── key: (8) ├── fd: (1)-->(2-5), (3,4)~~>(1,2,5), (8)-->(6,7,9), (1)==(6), (6)==(1) ├── scan xysd @@ -753,13 +753,13 @@ SELECT *, rowid FROM xysd LEFT JOIN uv ON x=u ---- project ├── columns: x:1(int!null) y:2(int) s:3(string) d:4(decimal!null) u:6(int) v:7(int) rowid:8(int) - ├── stats: [rows=10000, distinct(2)=400, null(2)=5000, distinct(3)=500, null(3)=100, distinct(6)=500, null(6)=0, distinct(2,3)=5000, null(2,3)=50, distinct(3,6)=10000, null(3,6)=50, distinct(1,2,8)=10000, null(1,2,8)=0] + ├── stats: [rows=10000, distinct(2)=400, null(2)=5000, distinct(3)=500, null(3)=100, distinct(6)=500, null(6)=0, distinct(2,3)=5000, null(2,3)=50, distinct(3,6)=10000, null(3,6)=-499850, distinct(1,2,8)=10000, null(1,2,8)=0] ├── key: (1,8) ├── fd: (1)-->(2-4), (3,4)~~>(1,2), (8)-->(6,7) └── left-join (hash) ├── columns: x:1(int!null) y:2(int) s:3(string) d:4(decimal!null) xysd.crdb_internal_mvcc_timestamp:5(decimal) u:6(int) v:7(int) rowid:8(int) uv.crdb_internal_mvcc_timestamp:9(decimal) ├── multiplicity: left-rows(one-or-more), right-rows(zero-or-one) - ├── stats: [rows=10000, distinct(2)=400, null(2)=5000, distinct(3)=500, null(3)=100, distinct(6)=500, null(6)=0, distinct(2,3)=5000, null(2,3)=50, distinct(3,6)=10000, null(3,6)=50, distinct(1,2,8)=10000, null(1,2,8)=0] + ├── stats: [rows=10000, distinct(2)=400, null(2)=5000, distinct(3)=500, null(3)=100, distinct(6)=500, null(6)=0, distinct(2,3)=5000, null(2,3)=50, distinct(3,6)=10000, null(3,6)=-499850, distinct(1,2,8)=10000, null(1,2,8)=0] ├── key: (1,8) ├── fd: (1)-->(2-5), (3,4)~~>(1,2,5), (8)-->(6,7,9) ├── scan xysd @@ -780,12 +780,12 @@ SELECT *, rowid FROM xysd RIGHT JOIN uv ON x=u ---- project ├── columns: x:1(int) y:2(int) s:3(string) d:4(decimal) u:6(int) v:7(int!null) rowid:8(int!null) - ├── stats: [rows=10000, distinct(2)=400, null(2)=5000, distinct(3)=499.999999, null(3)=100, distinct(6)=500, null(6)=5000, distinct(2,3)=4323.45892, null(2,3)=50, distinct(3,6)=10000, null(3,6)=50, distinct(1,2,8)=10000, null(1,2,8)=0] + ├── stats: [rows=10000, distinct(2)=400, null(2)=-49985000, distinct(3)=500, null(3)=-49989900, distinct(6)=500, null(6)=5000, distinct(2,3)=5000, null(2,3)=-49989950, distinct(3,6)=10000, null(3,6)=-24994950, distinct(1,2,8)=10000, null(1,2,8)=0] ├── key: (8) ├── fd: (1)-->(2-4), (3,4)~~>(1,2), (8)-->(1-4,6,7) └── right-join (hash) ├── columns: x:1(int) y:2(int) s:3(string) d:4(decimal) xysd.crdb_internal_mvcc_timestamp:5(decimal) u:6(int) v:7(int!null) rowid:8(int!null) uv.crdb_internal_mvcc_timestamp:9(decimal) - ├── stats: [rows=10000, distinct(1)=500, null(1)=0, distinct(2)=400, null(2)=5000, distinct(3)=499.999999, null(3)=100, distinct(6)=500, null(6)=5000, distinct(2,3)=4323.45892, null(2,3)=50, distinct(3,6)=10000, null(3,6)=50, distinct(1,2,8)=10000, null(1,2,8)=0] + ├── stats: [rows=10000, distinct(1)=500, null(1)=0, distinct(2)=400, null(2)=-49985000, distinct(3)=500, null(3)=-49989900, distinct(6)=500, null(6)=5000, distinct(2,3)=5000, null(2,3)=-49989950, distinct(3,6)=10000, null(3,6)=-24994950, distinct(1,2,8)=10000, null(1,2,8)=0] ├── key: (8) ├── fd: (1)-->(2-5), (3,4)~~>(1,2,5), (8)-->(1-7,9) ├── scan xysd @@ -1360,7 +1360,7 @@ expr format=show-all colstat=6 colstat=7 colstat=(6, 7) colstat=1 colstat=2 cols inner-join (lookup t.public.def) ├── columns: t.public.abc.a:1(int!null) t.public.abc.b:2(int!null) t.public.abc.c:3(int) t.public.def.d:5(int!null) t.public.def.e:6(int!null) t.public.def.f:7(int) ├── key columns: [1 2] = [5 6] - ├── stats: [rows=0.01, distinct(1)=0.01, null(1)=0, distinct(2)=0.01, null(2)=0, distinct(3)=0.00999500175, null(3)=0.0001, distinct(5)=0.01, null(5)=0, distinct(6)=0.01, null(6)=0, distinct(7)=0.00999995009, null(7)=0.0001, distinct(6,7)=0.00999999509, null(6,7)=0, distinct(1-3)=0.0099995001, null(1-3)=0] + ├── stats: [rows=0.01, distinct(1)=0.01, null(1)=0, distinct(2)=0.01, null(2)=0, distinct(3)=0.01, null(3)=0.0001, distinct(5)=0.01, null(5)=0, distinct(6)=0.01, null(6)=0, distinct(7)=0.01, null(7)=0.0001, distinct(6,7)=0.01, null(6,7)=0, distinct(1-3)=0.01, null(1-3)=0] ├── cost: 2110.0507 ├── key: (5,6) ├── fd: (1,2)-->(3), (5,6)-->(7), (1)==(5), (5)==(1), (2)==(6), (6)==(2) diff --git a/pkg/sql/opt/memo/testdata/stats/lookup-join b/pkg/sql/opt/memo/testdata/stats/lookup-join index 4d8f20b16e50..7396b72c5d0b 100644 --- a/pkg/sql/opt/memo/testdata/stats/lookup-join +++ b/pkg/sql/opt/memo/testdata/stats/lookup-join @@ -227,7 +227,7 @@ SELECT a, b, c, d, e, f FROM abc JOIN DEF ON a = f inner-join (lookup def) ├── columns: a:1(int!null) b:2(int) c:3(int!null) d:5(int) e:6(int!null) f:7(int!null) ├── key columns: [1] = [7] - ├── stats: [rows=100, distinct(1)=100, null(1)=0, distinct(2)=9.99954623, null(2)=1, distinct(3)=9.99954623, null(3)=0, distinct(4)=1, null(4)=0, distinct(6)=63.2138954, null(6)=0, distinct(7)=100, null(7)=0, distinct(2,6,7)=100, null(2,6,7)=0] + ├── stats: [rows=100, distinct(1)=100, null(1)=0, distinct(2)=10, null(2)=1, distinct(3)=10, null(3)=0, distinct(4)=1, null(4)=0, distinct(6)=100, null(6)=0, distinct(7)=100, null(7)=0, distinct(2,6,7)=100, null(2,6,7)=0] ├── key: (3,6,7) ├── fd: (1,3)-->(2), (6,7)-->(5), (1)==(7), (7)==(1) ├── scan abc @@ -245,7 +245,7 @@ left-join (lookup def) ├── columns: a:1(int!null) b:2(int) c:3(int!null) d:5(int) e:6(int) f:7(int) g:8(float) ├── key columns: [7 6] = [7 6] ├── lookup columns are key - ├── stats: [rows=100, distinct(5)=10, null(5)=90, distinct(8)=9.95021575, null(8)=91] + ├── stats: [rows=100, distinct(5)=10, null(5)=90, distinct(8)=100, null(8)=-999899] ├── key: (1,3,6,7) ├── fd: (1,3)-->(2), (6,7)-->(5,8) ├── left-join (lookup def@d_idx) @@ -270,7 +270,7 @@ SELECT * FROM abc LEFT JOIN DEF ON a = e AND b = 3 ---- right-join (hash) ├── columns: a:1(int!null) b:2(int) c:3(int!null) d:5(int) e:6(int) f:7(int) g:8(float) - ├── stats: [rows=100, distinct(6)=100, null(6)=0, distinct(8)=95.1671064, null(8)=1] + ├── stats: [rows=100, distinct(6)=100, null(6)=0, distinct(8)=100, null(8)=-999899] ├── key: (1,3,6,7) ├── fd: (1,3)-->(2), (6,7)-->(5,8) ├── scan def diff --git a/pkg/sql/opt/memo/testdata/stats/multi-column-inverted-geo b/pkg/sql/opt/memo/testdata/stats/multi-column-inverted-geo index 3e6dbd4f2dc4..b8f325d4c412 100644 --- a/pkg/sql/opt/memo/testdata/stats/multi-column-inverted-geo +++ b/pkg/sql/opt/memo/testdata/stats/multi-column-inverted-geo @@ -107,7 +107,7 @@ project │ │ ├── ["B\xfd\x10\x00\x00\x00\x00\x00\x00\x01", "B\xfd\x12\x00\x00\x00\x00\x00\x00\x00") │ │ └── ["B\xfd\x14\x00\x00\x00\x00\x00\x00\x00", "B\xfd\x14\x00\x00\x00\x00\x00\x00\x00"] │ ├── flags: force-index=m - │ ├── stats: [rows=153.552632, distinct(1)=43.8721805, null(1)=0, distinct(3)=1, null(3)=0, distinct(6)=3, null(6)=0, distinct(3,6)=3, null(3,6)=0] + │ ├── stats: [rows=153.552632, distinct(1)=153.552632, null(1)=0, distinct(3)=1, null(3)=0, distinct(6)=3, null(6)=0, distinct(3,6)=3, null(3,6)=0] │ │ histogram(3)= 0 100 │ │ <--- 'banana' │ │ histogram(6)= 0 0 25.592 0 25.592 51.184 25.592 0 0 0 25.592 0 @@ -158,7 +158,7 @@ project │ │ ├── ["B\xfd\x10\x00\x00\x00\x00\x00\x00\x01", "B\xfd\x12\x00\x00\x00\x00\x00\x00\x00") │ │ └── ["B\xfd\x14\x00\x00\x00\x00\x00\x00\x00", "B\xfd\x14\x00\x00\x00\x00\x00\x00\x00"] │ ├── flags: force-index=p - │ ├── stats: [rows=153.552632, distinct(1)=43.8721805, null(1)=0, distinct(3)=1, null(3)=0, distinct(7)=3, null(7)=0, distinct(3,7)=3, null(3,7)=0] + │ ├── stats: [rows=153.552632, distinct(1)=153.552632, null(1)=0, distinct(3)=1, null(3)=0, distinct(7)=3, null(7)=0, distinct(3,7)=3, null(3,7)=0] │ │ histogram(3)= 0 100 │ │ <--- 'banana' │ │ histogram(7)= 0 0 25.592 0 25.592 51.184 25.592 0 0 0 25.592 0 @@ -225,7 +225,7 @@ project │ │ ├── ["B\xfd\x10\x00\x00\x00\x00\x00\x00\x01", "B\xfd\x12\x00\x00\x00\x00\x00\x00\x00") │ │ └── ["B\xfd\x14\x00\x00\x00\x00\x00\x00\x00", "B\xfd\x14\x00\x00\x00\x00\x00\x00\x00"] │ ├── flags: force-index=m - │ ├── stats: [rows=307.105263, distinct(1)=87.7443609, null(1)=0, distinct(3)=2, null(3)=0, distinct(6)=3, null(6)=0, distinct(3,6)=6, null(3,6)=0] + │ ├── stats: [rows=307.105263, distinct(1)=307.105263, null(1)=0, distinct(3)=2, null(3)=0, distinct(6)=3, null(6)=0, distinct(3,6)=6, null(3,6)=0] │ │ histogram(3)= 0 100 0 100 │ │ <--- 'banana' --- 'cherry' │ │ histogram(6)= 0 0 51.184 0 51.184 102.37 51.184 0 0 0 51.184 0 @@ -276,7 +276,7 @@ project │ │ ├── ["B\xfd\x10\x00\x00\x00\x00\x00\x00\x01", "B\xfd\x12\x00\x00\x00\x00\x00\x00\x00") │ │ └── ["B\xfd\x14\x00\x00\x00\x00\x00\x00\x00", "B\xfd\x14\x00\x00\x00\x00\x00\x00\x00"] │ ├── flags: force-index=p - │ ├── stats: [rows=307.105263, distinct(1)=87.7443609, null(1)=0, distinct(3)=2, null(3)=0, distinct(8)=3, null(8)=0, distinct(3,8)=6, null(3,8)=0] + │ ├── stats: [rows=307.105263, distinct(1)=307.105263, null(1)=0, distinct(3)=2, null(3)=0, distinct(8)=3, null(8)=0, distinct(3,8)=6, null(3,8)=0] │ │ histogram(3)= 0 100 0 100 │ │ <--- 'banana' --- 'cherry' │ │ histogram(8)= 0 0 51.184 0 51.184 102.37 51.184 0 0 0 51.184 0 @@ -340,7 +340,7 @@ project │ │ ├── ["B\xfd\x10\x00\x00\x00\x00\x00\x00\x01", "B\xfd\x12\x00\x00\x00\x00\x00\x00\x00") │ │ └── ["B\xfd\x14\x00\x00\x00\x00\x00\x00\x00", "B\xfd\x14\x00\x00\x00\x00\x00\x00\x00"] │ ├── flags: force-index=mp - │ ├── stats: [rows=24.0813118, distinct(1)=6.88037479, null(1)=0, distinct(3)=2, null(3)=0, distinct(4)=1, null(4)=0, distinct(9)=3, null(9)=0, distinct(3,4,9)=6, null(3,4,9)=0] + │ ├── stats: [rows=24.0813118, distinct(1)=24.0813118, null(1)=0, distinct(3)=2, null(3)=0, distinct(4)=1, null(4)=0, distinct(9)=3, null(9)=0, distinct(3,4,9)=6, null(3,4,9)=0] │ │ histogram(3)= 0 12.041 0 12.041 │ │ <--- 'banana' --- 'cherry' │ │ histogram(4)= 0 24.081 @@ -399,7 +399,7 @@ project │ │ ├── ["B\xfd\x10\x00\x00\x00\x00\x00\x00\x01", "B\xfd\x12\x00\x00\x00\x00\x00\x00\x00") │ │ └── ["B\xfd\x14\x00\x00\x00\x00\x00\x00\x00", "B\xfd\x14\x00\x00\x00\x00\x00\x00\x00"] │ ├── flags: force-index=mp - │ ├── stats: [rows=48.1626236, distinct(1)=13.7607496, null(1)=0, distinct(3)=2, null(3)=0, distinct(4)=3, null(4)=0, distinct(9)=3, null(9)=0, distinct(3,4,9)=18, null(3,4,9)=0] + │ ├── stats: [rows=48.1626236, distinct(1)=48.1626236, null(1)=0, distinct(3)=2, null(3)=0, distinct(4)=3, null(4)=0, distinct(9)=3, null(9)=0, distinct(3,4,9)=18, null(3,4,9)=0] │ │ histogram(3)= 0 24.081 0 24.081 │ │ <--- 'banana' --- 'cherry' │ │ histogram(4)= 0 8.0271 0 16.054 0 24.081 diff --git a/pkg/sql/opt/memo/testdata/stats/partial-index-scan b/pkg/sql/opt/memo/testdata/stats/partial-index-scan index a1a4fdc1bd04..cf88bb48b6aa 100644 --- a/pkg/sql/opt/memo/testdata/stats/partial-index-scan +++ b/pkg/sql/opt/memo/testdata/stats/partial-index-scan @@ -1435,7 +1435,7 @@ project │ │ ├── ["B\xfd\x10\x00\x00\x00\x00\x00\x00\x00", "B\xfd\x10\x00\x00\x00\x00\x00\x00\x00"] │ │ ├── ["B\xfd\x10\x00\x00\x00\x00\x00\x00\x01", "B\xfd\x12\x00\x00\x00\x00\x00\x00\x00") │ │ └── ["B\xfd\x14\x00\x00\x00\x00\x00\x00\x00", "B\xfd\x14\x00\x00\x00\x00\x00\x00\x00"] - │ ├── stats: [rows=300, distinct(1)=85.7142857, null(1)=0, distinct(3)=2, null(3)=0, distinct(6)=3, null(6)=0, distinct(3,6)=6, null(3,6)=0] + │ ├── stats: [rows=300, distinct(1)=300, null(1)=0, distinct(3)=2, null(3)=0, distinct(6)=3, null(6)=0, distinct(3,6)=6, null(3,6)=0] │ │ histogram(3)= 0 100 0 100 │ │ <--- 'banana' --- 'cherry' │ │ histogram(6)= 0 0 50 0 50 100 50 0 0 0 50 0 @@ -1487,7 +1487,7 @@ project │ │ ├── ["B\xfd\x10\x00\x00\x00\x00\x00\x00\x00", "B\xfd\x10\x00\x00\x00\x00\x00\x00\x00"] │ │ ├── ["B\xfd\x10\x00\x00\x00\x00\x00\x00\x01", "B\xfd\x12\x00\x00\x00\x00\x00\x00\x00") │ │ └── ["B\xfd\x14\x00\x00\x00\x00\x00\x00\x00", "B\xfd\x14\x00\x00\x00\x00\x00\x00\x00"] - │ ├── stats: [rows=300, distinct(1)=85.7142857, null(1)=0, distinct(3)=2, null(3)=0, distinct(6)=3, null(6)=0, distinct(3,6)=6, null(3,6)=0] + │ ├── stats: [rows=300, distinct(1)=300, null(1)=0, distinct(3)=2, null(3)=0, distinct(6)=3, null(6)=0, distinct(3,6)=6, null(3,6)=0] │ │ histogram(3)= 0 100 0 100 │ │ <--- 'banana' --- 'cherry' │ │ histogram(6)= 0 0 50 0 50 100 50 0 0 0 50 0 @@ -1573,7 +1573,7 @@ project │ │ ├── ["B\xfd\x10\x00\x00\x00\x00\x00\x00\x00", "B\xfd\x10\x00\x00\x00\x00\x00\x00\x00"] │ │ ├── ["B\xfd\x10\x00\x00\x00\x00\x00\x00\x01", "B\xfd\x12\x00\x00\x00\x00\x00\x00\x00") │ │ └── ["B\xfd\x14\x00\x00\x00\x00\x00\x00\x00", "B\xfd\x14\x00\x00\x00\x00\x00\x00\x00"] - │ ├── stats: [rows=307.105263, distinct(1)=87.7443609, null(1)=0, distinct(3)=2, null(3)=0, distinct(6)=3, null(6)=0, distinct(3,6)=6, null(3,6)=0] + │ ├── stats: [rows=307.105263, distinct(1)=307.105263, null(1)=0, distinct(3)=2, null(3)=0, distinct(6)=3, null(6)=0, distinct(3,6)=6, null(3,6)=0] │ │ histogram(3)= 0 100 0 100 │ │ <--- 'banana' --- 'cherry' │ │ histogram(6)= 0 0 51.184 0 51.184 102.37 51.184 0 0 0 51.184 0 @@ -1623,7 +1623,7 @@ project │ │ ├── ["B\xfd\x10\x00\x00\x00\x00\x00\x00\x00", "B\xfd\x10\x00\x00\x00\x00\x00\x00\x00"] │ │ ├── ["B\xfd\x10\x00\x00\x00\x00\x00\x00\x01", "B\xfd\x12\x00\x00\x00\x00\x00\x00\x00") │ │ └── ["B\xfd\x14\x00\x00\x00\x00\x00\x00\x00", "B\xfd\x14\x00\x00\x00\x00\x00\x00\x00"] - │ ├── stats: [rows=307.105263, distinct(1)=87.7443609, null(1)=0, distinct(3)=2, null(3)=0, distinct(6)=3, null(6)=0, distinct(3,6)=6, null(3,6)=0] + │ ├── stats: [rows=307.105263, distinct(1)=307.105263, null(1)=0, distinct(3)=2, null(3)=0, distinct(6)=3, null(6)=0, distinct(3,6)=6, null(3,6)=0] │ │ histogram(3)= 0 100 0 100 │ │ <--- 'banana' --- 'cherry' │ │ histogram(6)= 0 0 51.184 0 51.184 102.37 51.184 0 0 0 51.184 0 diff --git a/pkg/sql/opt/memo/testdata/stats/scan b/pkg/sql/opt/memo/testdata/stats/scan index ed025f546e27..18c5c65e8e05 100644 --- a/pkg/sql/opt/memo/testdata/stats/scan +++ b/pkg/sql/opt/memo/testdata/stats/scan @@ -383,7 +383,7 @@ index-join a └── select ├── columns: x:1(int!null) s:3(string!null) d:4(decimal!null) ├── immutable - ├── stats: [rows=333.333333, distinct(4)=98.265847, null(4)=0] + ├── stats: [rows=333.333333, distinct(4)=100, null(4)=0] ├── key: (1) ├── fd: (1)-->(3,4), (3,4)-->(1) ├── scan a@secondary @@ -391,7 +391,7 @@ index-join a │ ├── constraint: /-3/4 │ │ ├── [ - /'foobar'/5.0] │ │ └── [/'foo' - /'bar'/5.0] - │ ├── stats: [rows=1000, distinct(1)=911.337892, null(1)=0, distinct(3)=1, null(3)=0, distinct(4)=294.797541, null(4)=0] + │ ├── stats: [rows=1000, distinct(1)=1000, null(1)=0, distinct(3)=1, null(3)=0, distinct(4)=300, null(4)=0] │ ├── key: (1) │ └── fd: (1)-->(3,4), (3,4)-->(1) └── filters @@ -1174,18 +1174,18 @@ select ├── fd: ()-->(1-4) ├── index-join multi_col │ ├── columns: a:1(uuid) b:2(bool) c:3(int) d:4(string) e:5(int) f:6(float) - │ ├── stats: [rows=3.39117229] + │ ├── stats: [rows=9.1e-10] │ ├── fd: ()-->(4) │ └── select │ ├── columns: d:4(string!null) e:5(int!null) f:6(float!null) rowid:7(int!null) - │ ├── stats: [rows=3.39117229, distinct(6)=2.91208514, null(6)=0] + │ ├── stats: [rows=9.1e-10, distinct(6)=9.1e-10, null(6)=0] │ ├── key: (7) │ ├── fd: ()-->(4), (7)-->(5,6) │ ├── scan multi_col@def_idx │ │ ├── columns: d:4(string!null) e:5(int!null) f:6(float) rowid:7(int!null) │ │ ├── constraint: /4/5/6/7: [/'foo'/11/5e-324 - /'foo'/20] │ │ ├── flags: force-index=def_idx - │ │ ├── stats: [rows=9.1, distinct(4)=1, null(4)=0, distinct(5)=9.1, null(5)=0, distinct(6)=8.73625541, null(6)=0.091, distinct(7)=9.1, null(7)=0, distinct(4,5)=9.1, null(4,5)=0] + │ │ ├── stats: [rows=9.1, distinct(4)=1, null(4)=0, distinct(5)=9.1, null(5)=0, distinct(6)=9.1, null(6)=9.1, distinct(7)=9.1, null(7)=0, distinct(4,5)=9.1, null(4,5)=0] │ │ ├── key: (7) │ │ └── fd: ()-->(4), (7)-->(5,6) │ └── filters @@ -1904,7 +1904,7 @@ AND f = 0 ---- select ├── columns: a:1(uuid!null) b:2(bool!null) c:3(int) d:4(string!null) e:5(int!null) f:6(float!null) - ├── stats: [rows=17.9784037, distinct(1)=1, null(1)=0, distinct(2)=1, null(2)=0, distinct(4)=1, null(4)=0, distinct(5)=1, null(5)=0, distinct(6)=1, null(6)=0, distinct(1,2,4-6)=1, null(1,2,4-6)=0] + ├── stats: [rows=17.9784056, distinct(1)=1, null(1)=0, distinct(2)=1, null(2)=0, distinct(4)=1, null(4)=0, distinct(5)=1, null(5)=0, distinct(6)=1, null(6)=0, distinct(1,2,4-6)=1, null(1,2,4-6)=0] │ histogram(2)= 0 17.978 │ <--- true │ histogram(4)= 0 17.978 @@ -1937,7 +1937,7 @@ AND f = 0 ---- select ├── columns: a:1(uuid!null) b:2(bool!null) c:3(int) d:4(string!null) e:5(int!null) f:6(float!null) - ├── stats: [rows=0.00179964001, distinct(1)=0.00179964001, null(1)=0, distinct(2)=0.00179964001, null(2)=0, distinct(4)=0.00179964001, null(4)=0, distinct(5)=0.00179964001, null(5)=0, distinct(6)=0.00179964001, null(6)=0, distinct(1,2,4-6)=0.00179964001, null(1,2,4-6)=0] + ├── stats: [rows=0.0017996402, distinct(1)=0.0017996402, null(1)=0, distinct(2)=0.0017996402, null(2)=0, distinct(4)=0.0017996402, null(4)=0, distinct(5)=0.0017996402, null(5)=0, distinct(6)=0.0017996402, null(6)=0, distinct(1,2,4-6)=0.0017996402, null(1,2,4-6)=0] │ histogram(2)= 0 0.0017996 │ <---- true -- │ histogram(4)= 0 0.0017996 @@ -1969,7 +1969,7 @@ AND f = 0 ---- select ├── columns: a:1(uuid!null) b:2(bool!null) c:3(int) d:4(string!null) e:5(int!null) f:6(float!null) - ├── stats: [rows=3.60000002e-07, distinct(1)=3.60000002e-07, null(1)=0, distinct(2)=3.60000002e-07, null(2)=0, distinct(4)=3.60000002e-07, null(4)=0, distinct(5)=3.60000002e-07, null(5)=0, distinct(6)=3.60000002e-07, null(6)=0, distinct(1,2,4-6)=3.60000002e-07, null(1,2,4-6)=0] + ├── stats: [rows=3.6000004e-07, distinct(1)=3.6000004e-07, null(1)=0, distinct(2)=3.6000004e-07, null(2)=0, distinct(4)=3.6000004e-07, null(4)=0, distinct(5)=3.6000004e-07, null(5)=0, distinct(6)=3.6000004e-07, null(6)=0, distinct(1,2,4-6)=3.6000004e-07, null(1,2,4-6)=0] │ histogram(2)= 0 3.6e-07 │ <--- false │ histogram(4)= 0 3.6e-07 @@ -2003,7 +2003,7 @@ AND f = 0 ---- select ├── columns: a:1(uuid!null) b:2(bool!null) c:3(int) d:4(string!null) e:5(int!null) f:6(float!null) - ├── stats: [rows=0.00359640002, distinct(1)=0.00359640002, null(1)=0, distinct(2)=0.00359640002, null(2)=0, distinct(4)=0.00359640002, null(4)=0, distinct(5)=0.00359640002, null(5)=0, distinct(6)=0.00359640002, null(6)=0, distinct(1,2,4-6)=0.00359640002, null(1,2,4-6)=0] + ├── stats: [rows=0.0035964004, distinct(1)=0.0035964004, null(1)=0, distinct(2)=0.0035964004, null(2)=0, distinct(4)=0.0035964004, null(4)=0, distinct(5)=0.0035964004, null(5)=0, distinct(6)=0.0035964004, null(6)=0, distinct(1,2,4-6)=0.0035964004, null(1,2,4-6)=0] │ histogram(2)= 0 0.0035964 │ <---- false - │ histogram(4)= 0 0.0035964 diff --git a/pkg/sql/opt/memo/testdata/stats/select b/pkg/sql/opt/memo/testdata/stats/select index e7a52f34fced..ca1e5e3bbee5 100644 --- a/pkg/sql/opt/memo/testdata/stats/select +++ b/pkg/sql/opt/memo/testdata/stats/select @@ -706,7 +706,7 @@ index-join lineitem ├── scan lineitem@l_sd │ ├── columns: l_orderkey:1(int!null) l_linenumber:4(int!null) l_shipdate:11(date!null) │ ├── constraint: /11/1/4: [/'1995-09-01' - ] - │ ├── stats: [rows=333.333333, distinct(1)=98.265847, null(1)=0, distinct(4)=98.265847, null(4)=0, distinct(11)=33.3333333, null(11)=0] + │ ├── stats: [rows=333.333333, distinct(1)=100, null(1)=0, distinct(4)=100, null(4)=0, distinct(11)=33.3333333, null(11)=0] │ ├── key: (1,4) │ └── fd: (1,4)-->(11) └── filters @@ -2462,7 +2462,7 @@ AND c29 = 1 AND c30 = 1 AND c31 = 1 AND c32 = 1 AND c33 = 1 ---- select ├── columns: c1:1(int!null) c2:2(int!null) c3:3(int!null) c4:4(int!null) c5:5(int!null) c6:6(int!null) c7:7(int!null) c8:8(int!null) c9:9(int!null) c10:10(int!null) c11:11(int!null) c12:12(int!null) c13:13(int!null) c14:14(int!null) c15:15(int!null) c16:16(int!null) c17:17(int!null) c18:18(int!null) c19:19(int!null) c20:20(int!null) c21:21(int!null) c22:22(int!null) c23:23(int!null) c24:24(int!null) c25:25(int!null) c26:26(int!null) c27:27(int!null) c28:28(int!null) c29:29(int!null) c30:30(int!null) c31:31(int!null) c32:32(int!null) c33:33(int!null) - ├── stats: [rows=9e-11, distinct(1)=9e-11, null(1)=0, distinct(2)=9e-11, null(2)=0, distinct(3)=9e-11, null(3)=0, distinct(4)=9e-11, null(4)=0, distinct(5)=9e-11, null(5)=0, distinct(6)=9e-11, null(6)=0, distinct(7)=9e-11, null(7)=0, distinct(8)=9e-11, null(8)=0, distinct(9)=9e-11, null(9)=0, distinct(10)=9e-11, null(10)=0, distinct(11)=9e-11, null(11)=0, distinct(12)=9e-11, null(12)=0, distinct(13)=9e-11, null(13)=0, distinct(14)=9e-11, null(14)=0, distinct(15)=9e-11, null(15)=0, distinct(16)=9e-11, null(16)=0, distinct(17)=9e-11, null(17)=0, distinct(18)=9e-11, null(18)=0, distinct(19)=9e-11, null(19)=0, distinct(20)=9e-11, null(20)=0, distinct(21)=9e-11, null(21)=0, distinct(22)=9e-11, null(22)=0, distinct(23)=9e-11, null(23)=0, distinct(24)=9e-11, null(24)=0, distinct(25)=9e-11, null(25)=0, distinct(26)=9e-11, null(26)=0, distinct(27)=9e-11, null(27)=0, distinct(28)=9e-11, null(28)=0, distinct(29)=9e-11, null(29)=0, distinct(30)=9e-11, null(30)=0, distinct(31)=9e-11, null(31)=0, distinct(32)=9e-11, null(32)=0, distinct(33)=9e-11, null(33)=0, distinct(1-33)=9e-11, null(1-33)=0] + ├── stats: [rows=1e-10, distinct(1)=1e-10, null(1)=0, distinct(2)=1e-10, null(2)=0, distinct(3)=1e-10, null(3)=0, distinct(4)=1e-10, null(4)=0, distinct(5)=1e-10, null(5)=0, distinct(6)=1e-10, null(6)=0, distinct(7)=1e-10, null(7)=0, distinct(8)=1e-10, null(8)=0, distinct(9)=1e-10, null(9)=0, distinct(10)=1e-10, null(10)=0, distinct(11)=1e-10, null(11)=0, distinct(12)=1e-10, null(12)=0, distinct(13)=1e-10, null(13)=0, distinct(14)=1e-10, null(14)=0, distinct(15)=1e-10, null(15)=0, distinct(16)=1e-10, null(16)=0, distinct(17)=1e-10, null(17)=0, distinct(18)=1e-10, null(18)=0, distinct(19)=1e-10, null(19)=0, distinct(20)=1e-10, null(20)=0, distinct(21)=1e-10, null(21)=0, distinct(22)=1e-10, null(22)=0, distinct(23)=1e-10, null(23)=0, distinct(24)=1e-10, null(24)=0, distinct(25)=1e-10, null(25)=0, distinct(26)=1e-10, null(26)=0, distinct(27)=1e-10, null(27)=0, distinct(28)=1e-10, null(28)=0, distinct(29)=1e-10, null(29)=0, distinct(30)=1e-10, null(30)=0, distinct(31)=1e-10, null(31)=0, distinct(32)=1e-10, null(32)=0, distinct(33)=1e-10, null(33)=0, distinct(1-33)=1e-10, null(1-33)=0] ├── fd: ()-->(1-33) ├── scan t │ ├── columns: c1:1(int) c2:2(int) c3:3(int) c4:4(int) c5:5(int) c6:6(int) c7:7(int) c8:8(int) c9:9(int) c10:10(int) c11:11(int) c12:12(int) c13:13(int) c14:14(int) c15:15(int) c16:16(int) c17:17(int) c18:18(int) c19:19(int) c20:20(int) c21:21(int) c22:22(int) c23:23(int) c24:24(int) c25:25(int) c26:26(int) c27:27(int) c28:28(int) c29:29(int) c30:30(int) c31:31(int) c32:32(int) c33:33(int) diff --git a/pkg/sql/opt/memo/testdata/stats_quality/tpcc b/pkg/sql/opt/memo/testdata/stats_quality/tpcc index e5c6a5072fe7..87b9ab1548df 100644 --- a/pkg/sql/opt/memo/testdata/stats_quality/tpcc +++ b/pkg/sql/opt/memo/testdata/stats_quality/tpcc @@ -322,7 +322,7 @@ project ├── save-table-name: order_status_02_scan_3 ├── columns: c_id:1(int!null) c_d_id:2(int!null) c_w_id:3(int!null) c_first:4(varchar) c_last:6(varchar!null) ├── constraint: /3/2/6/4/1: [/2/2/'ANTIBARESE' - /2/2/'ANTIBARESE'] - ├── stats: [rows=2.12233702, distinct(1)=2.12159373, null(1)=0, distinct(2)=1, null(2)=0, distinct(3)=1, null(3)=0, distinct(4)=2.11831349, null(4)=0, distinct(6)=1, null(6)=0, distinct(2,3,6)=1, null(2,3,6)=0] + ├── stats: [rows=2.12233702, distinct(1)=2.12233702, null(1)=0, distinct(2)=1, null(2)=0, distinct(3)=1, null(3)=0, distinct(4)=2.12233702, null(4)=0, distinct(6)=1, null(6)=0, distinct(2,3,6)=1, null(2,3,6)=0] │ histogram(1)= 0 0.00042447 0.0097628 0.00084893 0.010399 0.00084893 0.010399 0.00021223 0.009975 0.00084893 0.009975 0.0010612 0.010187 0.0010612 0.009975 0.0006367 0.010187 0.0012734 0.0097628 0.00084893 0.0097628 0.00084893 0.010399 0.0006367 0.010399 0.00042447 0.010187 0.0012734 0.010187 0.00084893 0.010399 0.0016979 0.010399 0.00084893 0.010399 0.0006367 0.009975 0.0006367 0.010187 0.00042447 0.010187 0.00084893 0.010399 0.0006367 0.010399 0.0012734 0.010399 0.00021223 0.009975 0.0006367 0.010187 0.0006367 0.010187 0.00084893 0.010399 0.00084893 0.0093383 0.0019101 0.0089138 0.0016979 0.010187 0.0014856 0.010187 0.0019101 0.0089138 0.0014856 0.009975 0.0010612 0.009975 0.0006367 0.0097628 0.0010612 0.0089138 0.0014856 0.010187 0.0006367 0.0097628 0.0006367 0.0097628 0.0010612 0.0097628 0.0006367 0.0097628 0.0006367 0.010187 0.00084893 0.010187 0.00042447 0.010187 0.00042447 0.009975 0.0006367 0.009975 0.00084893 0.009975 0.0010612 0.0097628 0.0012734 0.010187 0.0014856 0.010187 0.00021223 0.010187 0.0010612 0.0095505 0.0010612 0.0093383 0.0016979 0.0097628 0.0010612 0.010187 0.0006367 0.0095505 0.00084893 0.010187 0.00042447 0.0089138 0.0014856 0.010187 0.0010612 0.0097628 0.0010612 0.0095505 0.0010612 0.010187 0.0012734 0.0095505 0.00084893 0.0095505 0.00084893 0.009975 0.00084893 0.010187 0.0010612 0.009975 0.0010612 0.009975 0.0006367 0.009975 0.00084893 0.010187 0.0006367 0.0097628 0.0006367 0.009975 0.0006367 0.0093383 0.0014856 0.0095505 0.00084893 0.0097628 0.0006367 0.010187 0.0006367 0.010187 0.0006367 0.010187 0.00042447 0.0093383 0.0014856 0.010187 0.00042447 0.0097628 0.0014856 0.009975 0.0006367 0.0095505 0.0014856 0.010187 0.0012734 0.009975 0.00084893 0.009975 0.00084893 0.0097628 0.0010612 0.0097628 0.00084893 0.009975 0.0006367 0.010187 0.00084893 0.010187 0.00021223 0.010187 0.00021223 0.010187 0.0006367 0.009975 0.0010612 0.0095505 0.0010612 0.009126 0.0012734 0.0093383 0.0016979 0.0097628 0.0006367 0.0097628 0.0006367 0.009975 0.00042447 0.010187 0.00021223 0.009975 0.00084893 0.0097628 0.0016979 0.0095505 0.0012734 0.009975 0.00084893 0.009975 0.00042447 0.0097628 0.0012734 0.0095505 0.00084893 0.0093383 0.0010612 0.0097628 0.0006367 0.010187 0.00042447 0.0097628 0.0010612 0.009975 0.00084893 0.0097628 0.0006367 0.010187 0.00042447 0.0095505 0.00084893 0.010187 0.0006367 0.0093383 0.0010612 0.010187 0.0006367 0.0089138 0.0014856 0.010187 0.00084893 0.010187 0.0012734 0.009975 0.00042447 0.009126 0.0016979 0.010187 0.00042447 0.010187 0.0012734 0.0097628 0.0006367 0.009975 0.0006367 0.009975 0.00021223 0.0095505 0.0006367 0.009126 0.0014856 0.009975 0.00021223 0.0097628 0.0010612 0.009975 0.0006367 0.0093383 0.00084893 0.0097628 0.00084893 0.0093383 0.00084893 0.0097628 0.0012734 0.009975 0.00042447 0.009975 0.0010612 0.0087016 0.0019101 0.0087016 0.0023346 0.009126 0.0010612 0.0097628 0.00042447 0.009975 0.00084893 0.009975 0.00021223 0.0097628 0.0010612 0.0093383 0.00084893 0.0093383 0.00084893 0.0093383 0.0010612 0.009975 0.0006367 0.0097628 0.0006367 0.0097628 0.00042447 0.0097628 0.0014856 0.0095505 0.0006367 0.0097628 0.0006367 0.0097628 0.0006367 0.009126 0.0010612 0.0097628 0.00084893 0.0095505 0.0010612 0.0097628 0.0006367 0.009975 0.0006367 0.009975 0.00084893 0.009126 0.0012734 0.0095505 0.00084893 0.0095505 0.0010612 0.009126 0.0010612 0.0095505 0.0010612 0.0095505 0.0014856 0.009975 0.0014856 0.0095505 0.0006367 0.0097628 0.0014856 0.0097628 0.0010612 0.0093383 0.0006367 0.0095505 0.0006367 0.0097628 0.0006367 0.0097628 0.0006367 0.0087016 0.0012734 0.0095505 0.0014856 0.0097628 0.00021223 0.0089138 0.0014856 0.0095505 0.0010612 0.0087016 0.0012734 0.0097628 0.00084893 0.0095505 0.0012734 0.009126 0.0012734 0.0089138 0.00084893 0.0095505 0.00021223 0.0095505 0.0006367 0.0095505 0.00042447 0.0093383 0.0010612 0.0093383 0.00084893 0.0089138 0.0010612 0.0093383 0.00042447 0.0087016 0.0010612 0.0082771 0.0016979 0.0089138 0.0012734 0.0089138 0.00042447 0.0087016 0.00084893 │ <------ 2 ------------------ 22 ---------------- 40 ---------------- 56 ---------------- 72 --------------- 89 --------------- 104 -------------- 122 -------------- 138 --------------- 154 ---------------- 168 --------------- 186 -------------- 199 --------------- 213 -------------- 228 --------------- 244 -------------- 260 --------------- 277 -------------- 289 -------------- 299 --------------- 314 --------------- 329 -------------- 348 -------------- 365 --------------- 379 -------------- 396 -------------- 415 --------------- 428 ---------------- 440 --------------- 456 -------------- 475 -------------- 491 --------------- 505 -------------- 521 -------------- 535 --------------- 549 --------------- 561 -------------- 577 --------------- 592 --------------- 604 --------------- 616 --------------- 628 -------------- 641 --------------- 662 --------------- 679 --------------- 695 -------------- 706 --------------- 720 --------------- 736 -------------- 756 -------------- 771 --------------- 787 --------------- 803 --------------- 820 --------------- 836 -------------- 847 --------------- 860 --------------- 878 ---------------- 893 -------------- 908 --------------- 924 --------------- 937 -------------- 960 --------------- 975 ---------------- 990 --------------- 1005 ------------- 1018 ------------- 1032 ------------- 1050 -------------- 1063 ------------- 1084 -------------- 1101 ------------- 1120 -------------- 1133 --------------- 1148 -------------- 1160 ------------- 1177 ------------- 1192 -------------- 1212 -------------- 1227 -------------- 1241 -------------- 1260 ------------- 1275 -------------- 1289 ------------- 1305 -------------- 1320 -------------- 1334 -------------- 1348 --------------- 1361 ------------- 1377 -------------- 1393 -------------- 1405 -------------- 1421 ------------- 1436 ------------- 1450 -------------- 1466 ------------- 1478 -------------- 1492 -------------- 1507 -------------- 1525 -------------- 1541 -------------- 1555 -------------- 1568 -------------- 1586 -------------- 1599 -------------- 1614 -------------- 1630 -------------- 1647 --------------- 1666 -------------- 1683 -------------- 1696 -------------- 1713 -------------- 1724 -------------- 1739 -------------- 1753 -------------- 1773 --------------- 1787 ------------- 1802 -------------- 1823 ------------- 1839 -------------- 1851 -------------- 1865 ------------- 1879 -------------- 1891 ------------- 1903 -------------- 1917 ------------- 1930 -------------- 1945 ------------- 1960 -------------- 1976 -------------- 1992 ------------- 2010 -------------- 2023 -------------- 2038 ------------- 2054 --------------- 2067 --------------- 2080 --------------- 2095 -------------- 2113 -------------- 2128 ------------- 2144 -------------- 2159 -------------- 2173 ------------- 2189 --------------- 2199 -------------- 2214 -------------- 2230 -------------- 2243 --------------- 2257 --------------- 2271 -------------- 2288 ------------- 2302 -------------- 2316 --------------- 2331 -------------- 2345 -------------- 2363 -------------- 2381 -------------- 2396 ------------- 2409 --------------- 2427 -------------- 2441 -------------- 2453 ------------- 2469 -------------- 2480 ------------- 2495 --------------- 2508 -------------- 2524 ------------- 2536 -------------- 2553 -------------- 2570 ------------- 2583 -------------- 2598 -------------- 2612 -------------- 2626 -------------- 2638 -------------- 2653 -------------- 2671 -------------- 2686 -------------- 2700 -------------- 2717 --------------- 2734 -------------- 2751 -------------- 2770 -------------- 2782 --------------- 2795 -------------- 2812 ------------- 2828 --------------- 2839 --------------- 2851 -------------- 2868 --------------- 2881 -------------- 2894 --------------- 2908 -------------- 2921 --------------- 2935 -------------- 2950 -------------- 2962 -------------- 2975 --------------- 2989 --------------- 3000 -- │ histogram(2)= 0 2.1223 @@ -623,7 +623,7 @@ scalar-group-by │ ├── columns: ol_o_id:1(int!null) ol_d_id:2(int!null) ol_w_id:3(int!null) ol_i_id:5(int!null) s_i_id:12(int!null) s_w_id:13(int!null) s_quantity:14(int!null) │ ├── key columns: [3 5] = [13 12] │ ├── lookup columns are key - │ ├── stats: [rows=225.0829, distinct(1)=19.9933136, null(1)=0, distinct(2)=1, null(2)=0, distinct(3)=1, null(3)=0, distinct(5)=219.261715, null(5)=0, distinct(12)=219.261715, null(12)=0, distinct(13)=1, null(13)=0, distinct(14)=5, null(14)=0] + │ ├── stats: [rows=225.0829, distinct(1)=19.9935714, null(1)=0, distinct(2)=1, null(2)=0, distinct(3)=1, null(3)=0, distinct(5)=219.261715, null(5)=0, distinct(12)=219.261715, null(12)=0, distinct(13)=1, null(13)=0, distinct(14)=5, null(14)=0] │ ├── fd: ()-->(2,3,13), (12)-->(14), (5)==(12), (12)==(5), (3)==(13), (13)==(3) │ ├── scan order_line │ │ ├── save-table-name: stock_level_02_scan_4 @@ -1637,12 +1637,12 @@ scalar-group-by ├── select │ ├── save-table-name: consistency_12_select_2 │ ├── columns: o_id:1(int) o_d_id:2(int) o_w_id:3(int) ol_o_id:10(int) ol_d_id:11(int) ol_w_id:12(int) - │ ├── stats: [rows=299711.333, distinct(1)=2999, null(1)=209767.952, distinct(2)=10, null(2)=209767.952, distinct(3)=10, null(3)=209767.952, distinct(10)=2999, null(10)=0, distinct(11)=10, null(11)=0, distinct(12)=10, null(12)=0] + │ ├── stats: [rows=299711.333, distinct(1)=2999, null(1)=0, distinct(2)=10, null(2)=0, distinct(3)=10, null(3)=0, distinct(10)=2999, null(10)=0, distinct(11)=10, null(11)=0, distinct(12)=10, null(12)=0] │ ├── full-join (hash) │ │ ├── save-table-name: consistency_12_full_join_3 │ │ ├── columns: o_id:1(int) o_d_id:2(int) o_w_id:3(int) ol_o_id:10(int) ol_d_id:11(int) ol_w_id:12(int) │ │ ├── multiplicity: left-rows(exactly-one), right-rows(one-or-more) - │ │ ├── stats: [rows=899134, distinct(1)=2999, null(1)=629303.857, distinct(2)=10, null(2)=629303.857, distinct(3)=10, null(3)=629303.857, distinct(10)=2999, null(10)=0, distinct(11)=10, null(11)=0, distinct(12)=10, null(12)=0] + │ │ ├── stats: [rows=899134, distinct(1)=2999, null(1)=0, distinct(2)=10, null(2)=0, distinct(3)=10, null(3)=0, distinct(10)=2999, null(10)=0, distinct(11)=10, null(11)=0, distinct(12)=10, null(12)=0] │ │ ├── project │ │ │ ├── save-table-name: consistency_12_project_4 │ │ │ ├── columns: ol_o_id:10(int!null) ol_d_id:11(int!null) ol_w_id:12(int!null) @@ -1721,9 +1721,9 @@ column_names row_count distinct_count null_count {ol_w_id} 0 0 0 ~~~~ column_names row_count_est row_count_err distinct_count_est distinct_count_err null_count_est null_count_err -{o_d_id} 299711.00 +Inf <== 10.00 +Inf <== 209768.00 +Inf <== -{o_id} 299711.00 +Inf <== 2999.00 +Inf <== 209768.00 +Inf <== -{o_w_id} 299711.00 +Inf <== 10.00 +Inf <== 209768.00 +Inf <== +{o_d_id} 299711.00 +Inf <== 10.00 +Inf <== 0.00 1.00 +{o_id} 299711.00 +Inf <== 2999.00 +Inf <== 0.00 1.00 +{o_w_id} 299711.00 +Inf <== 10.00 +Inf <== 0.00 1.00 {ol_d_id} 299711.00 +Inf <== 10.00 +Inf <== 0.00 1.00 {ol_o_id} 299711.00 +Inf <== 2999.00 +Inf <== 0.00 1.00 {ol_w_id} 299711.00 +Inf <== 10.00 +Inf <== 0.00 1.00 @@ -1738,9 +1738,9 @@ column_names row_count distinct_count null_count {ol_w_id} 899134 10 0 ~~~~ column_names row_count_est row_count_err distinct_count_est distinct_count_err null_count_est null_count_err -{o_d_id} 899134.00 1.00 10.00 1.00 629304.00 +Inf <== -{o_id} 899134.00 1.00 2999.00 3.33 <== 629304.00 +Inf <== -{o_w_id} 899134.00 1.00 10.00 1.00 629304.00 +Inf <== +{o_d_id} 899134.00 1.00 10.00 1.00 0.00 1.00 +{o_id} 899134.00 1.00 2999.00 3.33 <== 0.00 1.00 +{o_w_id} 899134.00 1.00 10.00 1.00 0.00 1.00 {ol_d_id} 899134.00 1.00 10.00 1.00 0.00 1.00 {ol_o_id} 899134.00 1.00 2999.00 3.33 <== 0.00 1.00 {ol_w_id} 899134.00 1.00 10.00 1.00 0.00 1.00 diff --git a/pkg/sql/opt/memo/testdata/stats_quality/tpch/q02 b/pkg/sql/opt/memo/testdata/stats_quality/tpch/q02 index 8b690ef8b353..70c9c7aad82e 100644 --- a/pkg/sql/opt/memo/testdata/stats_quality/tpch/q02 +++ b/pkg/sql/opt/memo/testdata/stats_quality/tpch/q02 @@ -81,14 +81,14 @@ project ├── columns: p_partkey:1(int!null) p_mfgr:3(char!null) s_name:12(char!null) s_address:13(varchar!null) s_phone:15(char!null) s_acctbal:16(float!null) s_comment:17(varchar!null) ps_partkey:19(int!null) ps_suppkey:20(int!null) ps_supplycost:22(float!null) n_name:26(char!null) min:57(float!null) ├── internal-ordering: -16,+26,+12,+(1|19) ├── cardinality: [0 - 100] - ├── stats: [rows=1, distinct(1)=1, null(1)=0, distinct(3)=1, null(3)=0, distinct(12)=1, null(12)=0, distinct(13)=1, null(13)=0, distinct(15)=1, null(15)=0, distinct(16)=1, null(16)=0, distinct(17)=1, null(17)=0, distinct(19)=0.999912219, null(19)=0, distinct(20)=0.999982118, null(20)=0, distinct(22)=1, null(22)=0, distinct(26)=1, null(26)=0, distinct(57)=1, null(57)=0] + ├── stats: [rows=1, distinct(1)=1, null(1)=0, distinct(3)=1, null(3)=0, distinct(12)=1, null(12)=0, distinct(13)=1, null(13)=0, distinct(15)=1, null(15)=0, distinct(16)=1, null(16)=0, distinct(17)=1, null(17)=0, distinct(19)=0.999999995, null(19)=0, distinct(20)=1, null(20)=0, distinct(22)=1, null(22)=0, distinct(26)=1, null(26)=0, distinct(57)=1, null(57)=0] ├── key: (19,20) ├── fd: (1)-->(3), (19,20)-->(1,3,12,13,15-17,22,26,57), (1)==(19), (19)==(1), (20)-->(12,13,15-17,26), (22)==(57), (57)==(22) ├── ordering: -16,+26,+12,+(1|19) [actual: -16,+26,+12,+1] ├── sort │ ├── save-table-name: q2_sort_3 │ ├── columns: p_partkey:1(int!null) p_mfgr:3(char!null) s_name:12(char!null) s_address:13(varchar!null) s_phone:15(char!null) s_acctbal:16(float!null) s_comment:17(varchar!null) ps_partkey:19(int!null) ps_suppkey:20(int!null) ps_supplycost:22(float!null) n_name:26(char!null) min:57(float!null) - │ ├── stats: [rows=1, distinct(1)=1, null(1)=0, distinct(3)=1, null(3)=0, distinct(12)=1, null(12)=0, distinct(13)=1, null(13)=0, distinct(15)=1, null(15)=0, distinct(16)=1, null(16)=0, distinct(17)=1, null(17)=0, distinct(19)=0.999912219, null(19)=0, distinct(20)=0.999982118, null(20)=0, distinct(22)=1, null(22)=0, distinct(26)=1, null(26)=0, distinct(57)=1, null(57)=0] + │ ├── stats: [rows=1, distinct(1)=1, null(1)=0, distinct(3)=1, null(3)=0, distinct(12)=1, null(12)=0, distinct(13)=1, null(13)=0, distinct(15)=1, null(15)=0, distinct(16)=1, null(16)=0, distinct(17)=1, null(17)=0, distinct(19)=0.999999995, null(19)=0, distinct(20)=1, null(20)=0, distinct(22)=1, null(22)=0, distinct(26)=1, null(26)=0, distinct(57)=1, null(57)=0] │ ├── key: (19,20) │ ├── fd: (1)-->(3), (19,20)-->(1,3,12,13,15-17,22,26,57), (1)==(19), (19)==(1), (20)-->(12,13,15-17,26), (22)==(57), (57)==(22) │ ├── ordering: -16,+26,+12,+(1|19) [actual: -16,+26,+12,+1] @@ -96,42 +96,42 @@ project │ └── select │ ├── save-table-name: q2_select_4 │ ├── columns: p_partkey:1(int!null) p_mfgr:3(char!null) s_name:12(char!null) s_address:13(varchar!null) s_phone:15(char!null) s_acctbal:16(float!null) s_comment:17(varchar!null) ps_partkey:19(int!null) ps_suppkey:20(int!null) ps_supplycost:22(float!null) n_name:26(char!null) min:57(float!null) - │ ├── stats: [rows=1, distinct(1)=1, null(1)=0, distinct(3)=1, null(3)=0, distinct(12)=1, null(12)=0, distinct(13)=1, null(13)=0, distinct(15)=1, null(15)=0, distinct(16)=1, null(16)=0, distinct(17)=1, null(17)=0, distinct(19)=0.999912219, null(19)=0, distinct(20)=0.999982118, null(20)=0, distinct(22)=1, null(22)=0, distinct(26)=1, null(26)=0, distinct(57)=1, null(57)=0] + │ ├── stats: [rows=1, distinct(1)=1, null(1)=0, distinct(3)=1, null(3)=0, distinct(12)=1, null(12)=0, distinct(13)=1, null(13)=0, distinct(15)=1, null(15)=0, distinct(16)=1, null(16)=0, distinct(17)=1, null(17)=0, distinct(19)=0.999999995, null(19)=0, distinct(20)=1, null(20)=0, distinct(22)=1, null(22)=0, distinct(26)=1, null(26)=0, distinct(57)=1, null(57)=0] │ ├── key: (19,20) │ ├── fd: (1)-->(3), (19,20)-->(1,3,12,13,15-17,22,26,57), (1)==(19), (19)==(1), (20)-->(12,13,15-17,26), (22)==(57), (57)==(22) │ ├── group-by │ │ ├── save-table-name: q2_group_by_5 │ │ ├── columns: p_partkey:1(int!null) p_mfgr:3(char!null) s_name:12(char!null) s_address:13(varchar!null) s_phone:15(char!null) s_acctbal:16(float!null) s_comment:17(varchar!null) ps_partkey:19(int!null) ps_suppkey:20(int!null) ps_supplycost:22(float!null) n_name:26(char!null) min:57(float!null) │ │ ├── grouping columns: ps_partkey:19(int!null) ps_suppkey:20(int!null) - │ │ ├── stats: [rows=1480.78794, distinct(1)=1480.78794, null(1)=0, distinct(3)=1480.78794, null(3)=0, distinct(12)=1480.78794, null(12)=0, distinct(13)=1480.78794, null(13)=0, distinct(15)=1480.78794, null(15)=0, distinct(16)=1480.78794, null(16)=0, distinct(17)=1480.78794, null(17)=0, distinct(19)=1175.29714, null(19)=0, distinct(20)=1406.32684, null(20)=0, distinct(22)=1480.78794, null(22)=0, distinct(26)=1480.78794, null(26)=0, distinct(57)=1480.78794, null(57)=0, distinct(19,20)=1480.78794, null(19,20)=0] + │ │ ├── stats: [rows=1336.80556, distinct(1)=1336.80556, null(1)=0, distinct(3)=1336.80556, null(3)=0, distinct(12)=1336.80556, null(12)=0, distinct(13)=1336.80556, null(13)=0, distinct(15)=1336.80556, null(15)=0, distinct(16)=1336.80556, null(16)=0, distinct(17)=1336.80556, null(17)=0, distinct(19)=1336.7885, null(19)=0, distinct(20)=1336.80556, null(20)=0, distinct(22)=1336.80556, null(22)=0, distinct(26)=1336.80556, null(26)=0, distinct(57)=1336.80556, null(57)=0, distinct(19,20)=1336.80556, null(19,20)=0] │ │ ├── key: (19,20) │ │ ├── fd: (1)-->(3), (19,20)-->(1,3,12,13,15-17,22,26,57), (1)==(19), (19)==(1), (20)-->(12,13,15-17,26) │ │ ├── inner-join (hash) │ │ │ ├── save-table-name: q2_inner_join_6 │ │ │ ├── columns: p_partkey:1(int!null) p_mfgr:3(char!null) p_type:5(varchar!null) p_size:6(int!null) s_suppkey:11(int!null) s_name:12(char!null) s_address:13(varchar!null) s_nationkey:14(int!null) s_phone:15(char!null) s_acctbal:16(float!null) s_comment:17(varchar!null) ps_partkey:19(int!null) ps_suppkey:20(int!null) ps_supplycost:22(float!null) n_nationkey:25(int!null) n_name:26(char!null) n_regionkey:27(int!null) r_regionkey:30(int!null) r_name:31(char!null) ps_partkey:34(int!null) ps_suppkey:35(int!null) ps_supplycost:37(float!null) s_suppkey:40(int!null) s_nationkey:43(int!null) n_nationkey:48(int!null) n_regionkey:50(int!null) r_regionkey:53(int!null) r_name:54(char!null) │ │ │ ├── multiplicity: left-rows(zero-or-one), right-rows(zero-or-more) - │ │ │ ├── stats: [rows=2825.38826, distinct(1)=1336.7885, null(1)=0, distinct(3)=5, null(3)=0, distinct(5)=149.999629, null(5)=0, distinct(6)=1, null(6)=0, distinct(11)=1406.32684, null(11)=0, distinct(12)=1406.88226, null(12)=0, distinct(13)=1406.96098, null(13)=0, distinct(14)=5, null(14)=0, distinct(15)=1406.96098, null(15)=0, distinct(16)=1406.70062, null(16)=0, distinct(17)=1406.43854, null(17)=0, distinct(19)=1175.29714, null(19)=0, distinct(20)=1406.32684, null(20)=0, distinct(22)=1476.57814, null(22)=0, distinct(25)=5, null(25)=0, distinct(26)=5, null(26)=0, distinct(27)=1, null(27)=0, distinct(30)=1, null(30)=0, distinct(31)=0.996222107, null(31)=0, distinct(34)=1336.7885, null(34)=0, distinct(35)=1445.95586, null(35)=0, distinct(37)=2776.24326, null(37)=0, distinct(40)=1445.95586, null(40)=0, distinct(43)=5, null(43)=0, distinct(48)=5, null(48)=0, distinct(50)=1, null(50)=0, distinct(53)=1, null(53)=0, distinct(54)=0.996222107, null(54)=0, distinct(19,20)=1480.78794, null(19,20)=0] + │ │ │ ├── stats: [rows=1336.80556, distinct(1)=1336.7885, null(1)=0, distinct(3)=5, null(3)=0, distinct(5)=150, null(5)=0, distinct(6)=1, null(6)=0, distinct(11)=1336.80556, null(11)=0, distinct(12)=1336.80556, null(12)=0, distinct(13)=1336.80556, null(13)=0, distinct(14)=5, null(14)=0, distinct(15)=1336.80556, null(15)=0, distinct(16)=1336.80556, null(16)=0, distinct(17)=1336.80556, null(17)=0, distinct(19)=1336.7885, null(19)=0, distinct(20)=1336.80556, null(20)=0, distinct(22)=1336.80556, null(22)=0, distinct(25)=5, null(25)=0, distinct(26)=5, null(26)=0, distinct(27)=1, null(27)=0, distinct(30)=1, null(30)=0, distinct(31)=1, null(31)=0, distinct(34)=1336.7885, null(34)=0, distinct(35)=1336.80556, null(35)=0, distinct(37)=1336.80556, null(37)=0, distinct(40)=1336.80556, null(40)=0, distinct(43)=5, null(43)=0, distinct(48)=5, null(48)=0, distinct(50)=1, null(50)=0, distinct(53)=1, null(53)=0, distinct(54)=1, null(54)=0, distinct(19,20)=1336.80556, null(19,20)=0] │ │ │ ├── key: (20,34,40) │ │ │ ├── fd: ()-->(6,31,54), (1)-->(3,5), (11)-->(12-17), (19,20)-->(22), (11)==(20), (20)==(11), (25)-->(26,27), (27)==(30), (30)==(27), (14)==(25), (25)==(14), (1)==(19,34), (19)==(1,34), (34,35)-->(37), (40)-->(43), (48)-->(50), (50)==(53), (53)==(50), (43)==(48), (48)==(43), (35)==(40), (40)==(35), (34)==(1,19) │ │ │ ├── inner-join (lookup partsupp) │ │ │ │ ├── save-table-name: q2_lookup_join_7 │ │ │ │ ├── columns: p_partkey:1(int!null) p_mfgr:3(char!null) p_type:5(varchar!null) p_size:6(int!null) s_suppkey:11(int!null) s_name:12(char!null) s_address:13(varchar!null) s_nationkey:14(int!null) s_phone:15(char!null) s_acctbal:16(float!null) s_comment:17(varchar!null) ps_partkey:19(int!null) ps_suppkey:20(int!null) ps_supplycost:22(float!null) n_nationkey:25(int!null) n_name:26(char!null) n_regionkey:27(int!null) r_regionkey:30(int!null) r_name:31(char!null) ps_partkey:34(int!null) ps_suppkey:35(int!null) ps_supplycost:37(float!null) │ │ │ │ ├── key columns: [1] = [34] - │ │ │ │ ├── stats: [rows=4463.96897, distinct(1)=1336.7885, null(1)=0, distinct(3)=5, null(3)=0, distinct(5)=150, null(5)=0, distinct(6)=1, null(6)=0, distinct(11)=3594.71629, null(11)=0, distinct(12)=3599.9653, null(12)=0, distinct(13)=3600.71001, null(13)=0, distinct(14)=25, null(14)=0, distinct(15)=3600.71001, null(15)=0, distinct(16)=3598.24759, null(16)=0, distinct(17)=3595.77116, null(17)=0, distinct(19)=1336.7885, null(19)=0, distinct(20)=3594.71629, null(20)=0, distinct(22)=4366.10413, null(22)=0, distinct(25)=25, null(25)=0, distinct(26)=25, null(26)=0, distinct(27)=1, null(27)=0, distinct(30)=1, null(30)=0, distinct(31)=1, null(31)=0, distinct(34)=4412.99786, null(34)=0, distinct(35)=3594.71629, null(35)=0, distinct(37)=4366.10413, null(37)=0] + │ │ │ │ ├── stats: [rows=4345.19342, distinct(1)=1336.7885, null(1)=0, distinct(3)=5, null(3)=0, distinct(5)=150, null(5)=0, distinct(6)=1, null(6)=0, distinct(11)=4345.19342, null(11)=0, distinct(12)=4345.19342, null(12)=0, distinct(13)=4345.19342, null(13)=0, distinct(14)=25, null(14)=0, distinct(15)=4345.19342, null(15)=0, distinct(16)=4345.19342, null(16)=0, distinct(17)=4345.19342, null(17)=0, distinct(19)=1336.7885, null(19)=0, distinct(20)=4345.19342, null(20)=0, distinct(22)=4345.19342, null(22)=0, distinct(25)=25, null(25)=0, distinct(26)=25, null(26)=0, distinct(27)=1, null(27)=0, distinct(30)=1, null(30)=0, distinct(31)=1, null(31)=0, distinct(34)=4345.19342, null(34)=0, distinct(35)=4345.19342, null(35)=0, distinct(37)=4345.19342, null(37)=0] │ │ │ │ ├── key: (20,34,35) │ │ │ │ ├── fd: ()-->(6,31), (1)-->(3,5), (25)-->(26,27), (11)-->(12-17), (19,20)-->(22), (34,35)-->(37), (19)==(1,34), (34)==(1,19), (11)==(20), (20)==(11), (14)==(25), (25)==(14), (27)==(30), (30)==(27), (1)==(19,34) │ │ │ │ ├── inner-join (hash) │ │ │ │ │ ├── save-table-name: q2_inner_join_8 │ │ │ │ │ ├── columns: p_partkey:1(int!null) p_mfgr:3(char!null) p_type:5(varchar!null) p_size:6(int!null) s_suppkey:11(int!null) s_name:12(char!null) s_address:13(varchar!null) s_nationkey:14(int!null) s_phone:15(char!null) s_acctbal:16(float!null) s_comment:17(varchar!null) ps_partkey:19(int!null) ps_suppkey:20(int!null) ps_supplycost:22(float!null) n_nationkey:25(int!null) n_name:26(char!null) n_regionkey:27(int!null) r_regionkey:30(int!null) r_name:31(char!null) │ │ │ │ │ ├── multiplicity: left-rows(zero-or-one), right-rows(zero-or-more) - │ │ │ │ │ ├── stats: [rows=1936.87223, distinct(1)=1336.7885, null(1)=0, distinct(3)=5, null(3)=0, distinct(5)=149.99963, null(5)=0, distinct(6)=1, null(6)=0, distinct(11)=1759.52132, null(11)=0, distinct(12)=1760.68631, null(12)=0, distinct(13)=1760.8515, null(13)=0, distinct(14)=5, null(14)=0, distinct(15)=1760.8515, null(15)=0, distinct(16)=1760.30522, null(16)=0, distinct(17)=1759.75555, null(17)=0, distinct(19)=1336.7885, null(19)=0, distinct(20)=1759.52132, null(20)=0, distinct(22)=1913.8755, null(22)=0, distinct(25)=5, null(25)=0, distinct(26)=5, null(26)=0, distinct(27)=1, null(27)=0, distinct(30)=1, null(30)=0, distinct(31)=0.996222107, null(31)=0, distinct(19,20)=1923.59922, null(19,20)=0] + │ │ │ │ │ ├── stats: [rows=1336.80556, distinct(1)=1336.7885, null(1)=0, distinct(3)=5, null(3)=0, distinct(5)=150, null(5)=0, distinct(6)=1, null(6)=0, distinct(11)=1336.80556, null(11)=0, distinct(12)=1336.80556, null(12)=0, distinct(13)=1336.80556, null(13)=0, distinct(14)=5, null(14)=0, distinct(15)=1336.80556, null(15)=0, distinct(16)=1336.80556, null(16)=0, distinct(17)=1336.80556, null(17)=0, distinct(19)=1336.7885, null(19)=0, distinct(20)=1336.80556, null(20)=0, distinct(22)=1336.80556, null(22)=0, distinct(25)=5, null(25)=0, distinct(26)=5, null(26)=0, distinct(27)=1, null(27)=0, distinct(30)=1, null(30)=0, distinct(31)=1, null(31)=0, distinct(19,20)=1336.80556, null(19,20)=0] │ │ │ │ │ ├── key: (19,20) │ │ │ │ │ ├── fd: ()-->(6,31), (1)-->(3,5), (11)-->(12-17), (19,20)-->(22), (11)==(20), (20)==(11), (25)-->(26,27), (27)==(30), (30)==(27), (14)==(25), (25)==(14), (1)==(19), (19)==(1) │ │ │ │ │ ├── inner-join (lookup partsupp) │ │ │ │ │ │ ├── save-table-name: q2_lookup_join_9 │ │ │ │ │ │ ├── columns: p_partkey:1(int!null) p_mfgr:3(char!null) p_type:5(varchar!null) p_size:6(int!null) ps_partkey:19(int!null) ps_suppkey:20(int!null) ps_supplycost:22(float!null) │ │ │ │ │ │ ├── key columns: [1] = [19] - │ │ │ │ │ │ ├── stats: [rows=5367.59223, distinct(1)=1336.7885, null(1)=0, distinct(3)=5, null(3)=0, distinct(5)=150, null(5)=0, distinct(6)=1, null(6)=0, distinct(19)=1336.7885, null(19)=0, distinct(20)=4145.43091, null(20)=0, distinct(22)=5226.61785, null(22)=0] + │ │ │ │ │ │ ├── stats: [rows=5367.59223, distinct(1)=1336.7885, null(1)=0, distinct(3)=5, null(3)=0, distinct(5)=150, null(5)=0, distinct(6)=1, null(6)=0, distinct(19)=1336.7885, null(19)=0, distinct(20)=5367.59223, null(20)=0, distinct(22)=5367.59223, null(22)=0] │ │ │ │ │ │ ├── key: (19,20) │ │ │ │ │ │ ├── fd: ()-->(6), (1)-->(3,5), (19,20)-->(22), (1)==(19), (19)==(1) │ │ │ │ │ │ ├── select @@ -164,7 +164,7 @@ project │ │ │ │ │ │ ├── save-table-name: q2_inner_join_12 │ │ │ │ │ │ ├── columns: s_suppkey:11(int!null) s_name:12(char!null) s_address:13(varchar!null) s_nationkey:14(int!null) s_phone:15(char!null) s_acctbal:16(float!null) s_comment:17(varchar!null) n_nationkey:25(int!null) n_name:26(char!null) n_regionkey:27(int!null) r_regionkey:30(int!null) r_name:31(char!null) │ │ │ │ │ │ ├── multiplicity: left-rows(zero-or-one), right-rows(zero-or-more) - │ │ │ │ │ │ ├── stats: [rows=2000, distinct(11)=1844.80594, null(11)=0, distinct(12)=1846.09084, null(12)=0, distinct(13)=1846.27302, null(13)=0, distinct(14)=5, null(14)=0, distinct(15)=1846.27302, null(15)=0, distinct(16)=1845.67052, null(16)=0, distinct(17)=1845.06427, null(17)=0, distinct(25)=5, null(25)=0, distinct(26)=5, null(26)=0, distinct(27)=1, null(27)=0, distinct(30)=1, null(30)=0, distinct(31)=0.996222107, null(31)=0] + │ │ │ │ │ │ ├── stats: [rows=2000, distinct(11)=2000, null(11)=0, distinct(12)=2000, null(12)=0, distinct(13)=2000, null(13)=0, distinct(14)=5, null(14)=0, distinct(15)=2000, null(15)=0, distinct(16)=2000, null(16)=0, distinct(17)=2000, null(17)=0, distinct(25)=5, null(25)=0, distinct(26)=5, null(26)=0, distinct(27)=1, null(27)=0, distinct(30)=1, null(30)=0, distinct(31)=1, null(31)=0] │ │ │ │ │ │ ├── key: (11) │ │ │ │ │ │ ├── fd: ()-->(31), (11)-->(12-17), (25)-->(26,27), (27)==(30), (30)==(27), (14)==(25), (25)==(14) │ │ │ │ │ │ ├── scan supplier @@ -191,7 +191,7 @@ project │ │ │ │ │ │ │ ├── save-table-name: q2_inner_join_14 │ │ │ │ │ │ │ ├── columns: n_nationkey:25(int!null) n_name:26(char!null) n_regionkey:27(int!null) r_regionkey:30(int!null) r_name:31(char!null) │ │ │ │ │ │ │ ├── multiplicity: left-rows(zero-or-one), right-rows(zero-or-more) - │ │ │ │ │ │ │ ├── stats: [rows=5, distinct(25)=5, null(25)=0, distinct(26)=5, null(26)=0, distinct(27)=1, null(27)=0, distinct(30)=1, null(30)=0, distinct(31)=0.996222107, null(31)=0] + │ │ │ │ │ │ │ ├── stats: [rows=5, distinct(25)=5, null(25)=0, distinct(26)=5, null(26)=0, distinct(27)=1, null(27)=0, distinct(30)=1, null(30)=0, distinct(31)=1, null(31)=0] │ │ │ │ │ │ │ ├── key: (25) │ │ │ │ │ │ │ ├── fd: ()-->(31), (25)-->(26,27), (27)==(30), (30)==(27) │ │ │ │ │ │ │ ├── scan nation @@ -237,14 +237,14 @@ project │ │ │ │ ├── save-table-name: q2_lookup_join_18 │ │ │ │ ├── columns: s_suppkey:40(int!null) s_nationkey:43(int!null) n_nationkey:48(int!null) n_regionkey:50(int!null) r_regionkey:53(int!null) r_name:54(char!null) │ │ │ │ ├── key columns: [48] = [43] - │ │ │ │ ├── stats: [rows=2000, distinct(40)=1844.80594, null(40)=0, distinct(43)=5, null(43)=0, distinct(48)=5, null(48)=0, distinct(50)=1, null(50)=0, distinct(53)=1, null(53)=0, distinct(54)=0.996222107, null(54)=0] + │ │ │ │ ├── stats: [rows=2000, distinct(40)=2000, null(40)=0, distinct(43)=5, null(43)=0, distinct(48)=5, null(48)=0, distinct(50)=1, null(50)=0, distinct(53)=1, null(53)=0, distinct(54)=1, null(54)=0] │ │ │ │ ├── key: (40) │ │ │ │ ├── fd: ()-->(54), (40)-->(43), (48)-->(50), (50)==(53), (53)==(50), (43)==(48), (48)==(43) │ │ │ │ ├── inner-join (lookup nation@n_rk) │ │ │ │ │ ├── save-table-name: q2_lookup_join_19 │ │ │ │ │ ├── columns: n_nationkey:48(int!null) n_regionkey:50(int!null) r_regionkey:53(int!null) r_name:54(char!null) │ │ │ │ │ ├── key columns: [53] = [50] - │ │ │ │ │ ├── stats: [rows=5, distinct(48)=5, null(48)=0, distinct(50)=1, null(50)=0, distinct(53)=1, null(53)=0, distinct(54)=0.996222107, null(54)=0] + │ │ │ │ │ ├── stats: [rows=5, distinct(48)=5, null(48)=0, distinct(50)=1, null(50)=0, distinct(53)=1, null(53)=0, distinct(54)=1, null(54)=0] │ │ │ │ │ ├── key: (48) │ │ │ │ │ ├── fd: ()-->(54), (48)-->(50), (50)==(53), (53)==(50) │ │ │ │ │ ├── select @@ -420,18 +420,18 @@ column_names row_count distinct_count null_count {s_phone} 642 548 0 ~~~~ column_names row_count_est row_count_err distinct_count_est distinct_count_err null_count_est null_count_err -{min} 1481.00 2.31 <== 1481.00 3.23 <== 0.00 1.00 -{n_name} 1481.00 2.31 <== 1481.00 296.20 <== 0.00 1.00 -{p_mfgr} 1481.00 2.31 <== 1481.00 296.20 <== 0.00 1.00 -{p_partkey} 1481.00 2.31 <== 1481.00 3.22 <== 0.00 1.00 -{ps_partkey} 1481.00 2.31 <== 1175.00 2.55 <== 0.00 1.00 -{ps_suppkey} 1481.00 2.31 <== 1406.00 2.57 <== 0.00 1.00 -{ps_supplycost} 1481.00 2.31 <== 1481.00 2.31 <== 0.00 1.00 -{s_acctbal} 1481.00 2.31 <== 1481.00 2.70 <== 0.00 1.00 -{s_address} 1481.00 2.31 <== 1481.00 2.70 <== 0.00 1.00 -{s_comment} 1481.00 2.31 <== 1481.00 2.70 <== 0.00 1.00 -{s_name} 1481.00 2.31 <== 1481.00 2.70 <== 0.00 1.00 -{s_phone} 1481.00 2.31 <== 1481.00 2.70 <== 0.00 1.00 +{min} 1337.00 2.08 <== 1337.00 2.92 <== 0.00 1.00 +{n_name} 1337.00 2.08 <== 1337.00 267.40 <== 0.00 1.00 +{p_mfgr} 1337.00 2.08 <== 1337.00 267.40 <== 0.00 1.00 +{p_partkey} 1337.00 2.08 <== 1337.00 2.91 <== 0.00 1.00 +{ps_partkey} 1337.00 2.08 <== 1337.00 2.91 <== 0.00 1.00 +{ps_suppkey} 1337.00 2.08 <== 1337.00 2.44 <== 0.00 1.00 +{ps_supplycost} 1337.00 2.08 <== 1337.00 2.09 <== 0.00 1.00 +{s_acctbal} 1337.00 2.08 <== 1337.00 2.44 <== 0.00 1.00 +{s_address} 1337.00 2.08 <== 1337.00 2.44 <== 0.00 1.00 +{s_comment} 1337.00 2.08 <== 1337.00 2.44 <== 0.00 1.00 +{s_name} 1337.00 2.08 <== 1337.00 2.44 <== 0.00 1.00 +{s_phone} 1337.00 2.08 <== 1337.00 2.44 <== 0.00 1.00 ----Stats for q2_inner_join_6---- column_names row_count distinct_count null_count @@ -465,34 +465,34 @@ column_names row_count distinct_count null_count {s_suppkey} 1070 548 0 ~~~~ column_names row_count_est row_count_err distinct_count_est distinct_count_err null_count_est null_count_err -{n_name} 2825.00 2.64 <== 5.00 1.00 0.00 1.00 -{n_nationkey} 2825.00 2.64 <== 5.00 1.00 0.00 1.00 -{n_nationkey_1} 2825.00 2.64 <== 5.00 1.00 0.00 1.00 -{n_regionkey} 2825.00 2.64 <== 1.00 1.00 0.00 1.00 -{n_regionkey_1} 2825.00 2.64 <== 1.00 1.00 0.00 1.00 -{p_mfgr} 2825.00 2.64 <== 5.00 1.00 0.00 1.00 -{p_partkey} 2825.00 2.64 <== 1337.00 2.91 <== 0.00 1.00 -{p_size} 2825.00 2.64 <== 1.00 1.00 0.00 1.00 -{p_type} 2825.00 2.64 <== 150.00 5.00 <== 0.00 1.00 -{ps_partkey} 2825.00 2.64 <== 1175.00 2.55 <== 0.00 1.00 -{ps_partkey_1} 2825.00 2.64 <== 1337.00 2.91 <== 0.00 1.00 -{ps_suppkey} 2825.00 2.64 <== 1406.00 2.57 <== 0.00 1.00 -{ps_suppkey_1} 2825.00 2.64 <== 1446.00 2.64 <== 0.00 1.00 -{ps_supplycost} 2825.00 2.64 <== 1477.00 2.31 <== 0.00 1.00 -{ps_supplycost_1} 2825.00 2.64 <== 2776.00 4.34 <== 0.00 1.00 -{r_name} 2825.00 2.64 <== 1.00 1.00 0.00 1.00 -{r_name_1} 2825.00 2.64 <== 1.00 1.00 0.00 1.00 -{r_regionkey} 2825.00 2.64 <== 1.00 1.00 0.00 1.00 -{r_regionkey_1} 2825.00 2.64 <== 1.00 1.00 0.00 1.00 -{s_acctbal} 2825.00 2.64 <== 1407.00 2.57 <== 0.00 1.00 -{s_address} 2825.00 2.64 <== 1407.00 2.57 <== 0.00 1.00 -{s_comment} 2825.00 2.64 <== 1406.00 2.57 <== 0.00 1.00 -{s_name} 2825.00 2.64 <== 1407.00 2.57 <== 0.00 1.00 -{s_nationkey} 2825.00 2.64 <== 5.00 1.00 0.00 1.00 -{s_nationkey_1} 2825.00 2.64 <== 5.00 1.00 0.00 1.00 -{s_phone} 2825.00 2.64 <== 1407.00 2.57 <== 0.00 1.00 -{s_suppkey} 2825.00 2.64 <== 1406.00 2.57 <== 0.00 1.00 -{s_suppkey_1} 2825.00 2.64 <== 1446.00 2.64 <== 0.00 1.00 +{n_name} 1337.00 1.25 5.00 1.00 0.00 1.00 +{n_nationkey} 1337.00 1.25 5.00 1.00 0.00 1.00 +{n_nationkey_1} 1337.00 1.25 5.00 1.00 0.00 1.00 +{n_regionkey} 1337.00 1.25 1.00 1.00 0.00 1.00 +{n_regionkey_1} 1337.00 1.25 1.00 1.00 0.00 1.00 +{p_mfgr} 1337.00 1.25 5.00 1.00 0.00 1.00 +{p_partkey} 1337.00 1.25 1337.00 2.91 <== 0.00 1.00 +{p_size} 1337.00 1.25 1.00 1.00 0.00 1.00 +{p_type} 1337.00 1.25 150.00 5.00 <== 0.00 1.00 +{ps_partkey} 1337.00 1.25 1337.00 2.91 <== 0.00 1.00 +{ps_partkey_1} 1337.00 1.25 1337.00 2.91 <== 0.00 1.00 +{ps_suppkey} 1337.00 1.25 1337.00 2.44 <== 0.00 1.00 +{ps_suppkey_1} 1337.00 1.25 1337.00 2.44 <== 0.00 1.00 +{ps_supplycost} 1337.00 1.25 1337.00 2.09 <== 0.00 1.00 +{ps_supplycost_1} 1337.00 1.25 1337.00 2.09 <== 0.00 1.00 +{r_name} 1337.00 1.25 1.00 1.00 0.00 1.00 +{r_name_1} 1337.00 1.25 1.00 1.00 0.00 1.00 +{r_regionkey} 1337.00 1.25 1.00 1.00 0.00 1.00 +{r_regionkey_1} 1337.00 1.25 1.00 1.00 0.00 1.00 +{s_acctbal} 1337.00 1.25 1337.00 2.44 <== 0.00 1.00 +{s_address} 1337.00 1.25 1337.00 2.44 <== 0.00 1.00 +{s_comment} 1337.00 1.25 1337.00 2.44 <== 0.00 1.00 +{s_name} 1337.00 1.25 1337.00 2.44 <== 0.00 1.00 +{s_nationkey} 1337.00 1.25 5.00 1.00 0.00 1.00 +{s_nationkey_1} 1337.00 1.25 5.00 1.00 0.00 1.00 +{s_phone} 1337.00 1.25 1337.00 2.44 <== 0.00 1.00 +{s_suppkey} 1337.00 1.25 1337.00 2.44 <== 0.00 1.00 +{s_suppkey_1} 1337.00 1.25 1337.00 2.44 <== 0.00 1.00 ----Stats for q2_lookup_join_7---- column_names row_count distinct_count null_count @@ -520,28 +520,28 @@ column_names row_count distinct_count null_count {s_suppkey} 2568 548 0 ~~~~ column_names row_count_est row_count_err distinct_count_est distinct_count_err null_count_est null_count_err -{n_name} 4464.00 1.74 25.00 5.00 <== 0.00 1.00 -{n_nationkey} 4464.00 1.74 25.00 5.00 <== 0.00 1.00 -{n_regionkey} 4464.00 1.74 1.00 1.00 0.00 1.00 -{p_mfgr} 4464.00 1.74 5.00 1.00 0.00 1.00 -{p_partkey} 4464.00 1.74 1337.00 2.91 <== 0.00 1.00 -{p_size} 4464.00 1.74 1.00 1.00 0.00 1.00 -{p_type} 4464.00 1.74 150.00 5.00 <== 0.00 1.00 -{ps_partkey} 4464.00 1.74 1337.00 2.91 <== 0.00 1.00 -{ps_partkey_1} 4464.00 1.74 4413.00 9.59 <== 0.00 1.00 -{ps_suppkey} 4464.00 1.74 3595.00 6.56 <== 0.00 1.00 -{ps_suppkey_1} 4464.00 1.74 3595.00 2.16 <== 0.00 1.00 -{ps_supplycost} 4464.00 1.74 4366.00 6.82 <== 0.00 1.00 -{ps_supplycost_1} 4464.00 1.74 4366.00 2.39 <== 0.00 1.00 -{r_name} 4464.00 1.74 1.00 1.00 0.00 1.00 -{r_regionkey} 4464.00 1.74 1.00 1.00 0.00 1.00 -{s_acctbal} 4464.00 1.74 3598.00 6.57 <== 0.00 1.00 -{s_address} 4464.00 1.74 3601.00 6.57 <== 0.00 1.00 -{s_comment} 4464.00 1.74 3596.00 6.56 <== 0.00 1.00 -{s_name} 4464.00 1.74 3600.00 6.57 <== 0.00 1.00 -{s_nationkey} 4464.00 1.74 25.00 5.00 <== 0.00 1.00 -{s_phone} 4464.00 1.74 3601.00 6.57 <== 0.00 1.00 -{s_suppkey} 4464.00 1.74 3595.00 6.56 <== 0.00 1.00 +{n_name} 4345.00 1.69 25.00 5.00 <== 0.00 1.00 +{n_nationkey} 4345.00 1.69 25.00 5.00 <== 0.00 1.00 +{n_regionkey} 4345.00 1.69 1.00 1.00 0.00 1.00 +{p_mfgr} 4345.00 1.69 5.00 1.00 0.00 1.00 +{p_partkey} 4345.00 1.69 1337.00 2.91 <== 0.00 1.00 +{p_size} 4345.00 1.69 1.00 1.00 0.00 1.00 +{p_type} 4345.00 1.69 150.00 5.00 <== 0.00 1.00 +{ps_partkey} 4345.00 1.69 1337.00 2.91 <== 0.00 1.00 +{ps_partkey_1} 4345.00 1.69 4345.00 9.45 <== 0.00 1.00 +{ps_suppkey} 4345.00 1.69 4345.00 7.93 <== 0.00 1.00 +{ps_suppkey_1} 4345.00 1.69 4345.00 2.62 <== 0.00 1.00 +{ps_supplycost} 4345.00 1.69 4345.00 6.79 <== 0.00 1.00 +{ps_supplycost_1} 4345.00 1.69 4345.00 2.38 <== 0.00 1.00 +{r_name} 4345.00 1.69 1.00 1.00 0.00 1.00 +{r_regionkey} 4345.00 1.69 1.00 1.00 0.00 1.00 +{s_acctbal} 4345.00 1.69 4345.00 7.93 <== 0.00 1.00 +{s_address} 4345.00 1.69 4345.00 7.93 <== 0.00 1.00 +{s_comment} 4345.00 1.69 4345.00 7.93 <== 0.00 1.00 +{s_name} 4345.00 1.69 4345.00 7.93 <== 0.00 1.00 +{s_nationkey} 4345.00 1.69 25.00 5.00 <== 0.00 1.00 +{s_phone} 4345.00 1.69 4345.00 7.93 <== 0.00 1.00 +{s_suppkey} 4345.00 1.69 4345.00 7.93 <== 0.00 1.00 ----Stats for q2_inner_join_8---- column_names row_count distinct_count null_count @@ -566,25 +566,25 @@ column_names row_count distinct_count null_count {s_suppkey} 642 548 0 ~~~~ column_names row_count_est row_count_err distinct_count_est distinct_count_err null_count_est null_count_err -{n_name} 1937.00 3.02 <== 5.00 1.00 0.00 1.00 -{n_nationkey} 1937.00 3.02 <== 5.00 1.00 0.00 1.00 -{n_regionkey} 1937.00 3.02 <== 1.00 1.00 0.00 1.00 -{p_mfgr} 1937.00 3.02 <== 5.00 1.00 0.00 1.00 -{p_partkey} 1937.00 3.02 <== 1337.00 2.91 <== 0.00 1.00 -{p_size} 1937.00 3.02 <== 1.00 1.00 0.00 1.00 -{p_type} 1937.00 3.02 <== 150.00 5.00 <== 0.00 1.00 -{ps_partkey} 1937.00 3.02 <== 1337.00 2.91 <== 0.00 1.00 -{ps_suppkey} 1937.00 3.02 <== 1760.00 3.21 <== 0.00 1.00 -{ps_supplycost} 1937.00 3.02 <== 1914.00 2.99 <== 0.00 1.00 -{r_name} 1937.00 3.02 <== 1.00 1.00 0.00 1.00 -{r_regionkey} 1937.00 3.02 <== 1.00 1.00 0.00 1.00 -{s_acctbal} 1937.00 3.02 <== 1760.00 3.21 <== 0.00 1.00 -{s_address} 1937.00 3.02 <== 1761.00 3.21 <== 0.00 1.00 -{s_comment} 1937.00 3.02 <== 1760.00 3.21 <== 0.00 1.00 -{s_name} 1937.00 3.02 <== 1761.00 3.21 <== 0.00 1.00 -{s_nationkey} 1937.00 3.02 <== 5.00 1.00 0.00 1.00 -{s_phone} 1937.00 3.02 <== 1761.00 3.21 <== 0.00 1.00 -{s_suppkey} 1937.00 3.02 <== 1760.00 3.21 <== 0.00 1.00 +{n_name} 1337.00 2.08 <== 5.00 1.00 0.00 1.00 +{n_nationkey} 1337.00 2.08 <== 5.00 1.00 0.00 1.00 +{n_regionkey} 1337.00 2.08 <== 1.00 1.00 0.00 1.00 +{p_mfgr} 1337.00 2.08 <== 5.00 1.00 0.00 1.00 +{p_partkey} 1337.00 2.08 <== 1337.00 2.91 <== 0.00 1.00 +{p_size} 1337.00 2.08 <== 1.00 1.00 0.00 1.00 +{p_type} 1337.00 2.08 <== 150.00 5.00 <== 0.00 1.00 +{ps_partkey} 1337.00 2.08 <== 1337.00 2.91 <== 0.00 1.00 +{ps_suppkey} 1337.00 2.08 <== 1337.00 2.44 <== 0.00 1.00 +{ps_supplycost} 1337.00 2.08 <== 1337.00 2.09 <== 0.00 1.00 +{r_name} 1337.00 2.08 <== 1.00 1.00 0.00 1.00 +{r_regionkey} 1337.00 2.08 <== 1.00 1.00 0.00 1.00 +{s_acctbal} 1337.00 2.08 <== 1337.00 2.44 <== 0.00 1.00 +{s_address} 1337.00 2.08 <== 1337.00 2.44 <== 0.00 1.00 +{s_comment} 1337.00 2.08 <== 1337.00 2.44 <== 0.00 1.00 +{s_name} 1337.00 2.08 <== 1337.00 2.44 <== 0.00 1.00 +{s_nationkey} 1337.00 2.08 <== 5.00 1.00 0.00 1.00 +{s_phone} 1337.00 2.08 <== 1337.00 2.44 <== 0.00 1.00 +{s_suppkey} 1337.00 2.08 <== 1337.00 2.44 <== 0.00 1.00 ----Stats for q2_lookup_join_9---- column_names row_count distinct_count null_count @@ -602,8 +602,8 @@ column_names row_count_est row_count_err distinct_count_est distinct_coun {p_size} 5368.00 1.80 1.00 1.00 0.00 1.00 {p_type} 5368.00 1.80 150.00 5.00 <== 0.00 1.00 {ps_partkey} 5368.00 1.80 1337.00 1.79 0.00 1.00 -{ps_suppkey} 5368.00 1.80 4145.00 1.61 0.00 1.00 -{ps_supplycost} 5368.00 1.80 5227.00 1.77 0.00 1.00 +{ps_suppkey} 5368.00 1.80 5368.00 2.09 <== 0.00 1.00 +{ps_supplycost} 5368.00 1.80 5368.00 1.82 0.00 1.00 ----Stats for q2_select_10---- column_names row_count distinct_count null_count @@ -652,13 +652,13 @@ column_names row_count_est row_count_err distinct_count_est distinct_count_ {n_regionkey} 2000.00 1.01 1.00 1.00 0.00 1.00 {r_name} 2000.00 1.01 1.00 1.00 0.00 1.00 {r_regionkey} 2000.00 1.01 1.00 1.00 0.00 1.00 -{s_acctbal} 2000.00 1.01 1846.00 1.07 0.00 1.00 -{s_address} 2000.00 1.01 1846.00 1.08 0.00 1.00 -{s_comment} 2000.00 1.01 1845.00 1.08 0.00 1.00 -{s_name} 2000.00 1.01 1846.00 1.08 0.00 1.00 +{s_acctbal} 2000.00 1.01 2000.00 1.01 0.00 1.00 +{s_address} 2000.00 1.01 2000.00 1.01 0.00 1.00 +{s_comment} 2000.00 1.01 2000.00 1.01 0.00 1.00 +{s_name} 2000.00 1.01 2000.00 1.01 0.00 1.00 {s_nationkey} 2000.00 1.01 5.00 1.00 0.00 1.00 -{s_phone} 2000.00 1.01 1846.00 1.08 0.00 1.00 -{s_suppkey} 2000.00 1.01 1845.00 1.08 0.00 1.00 +{s_phone} 2000.00 1.01 2000.00 1.01 0.00 1.00 +{s_suppkey} 2000.00 1.01 2000.00 1.01 0.00 1.00 ----Stats for q2_scan_13---- column_names row_count distinct_count null_count @@ -738,7 +738,7 @@ column_names row_count_est row_count_err distinct_count_est distinct_count_ {r_name} 2000.00 1.01 1.00 1.00 0.00 1.00 {r_regionkey} 2000.00 1.01 1.00 1.00 0.00 1.00 {s_nationkey} 2000.00 1.01 5.00 1.00 0.00 1.00 -{s_suppkey} 2000.00 1.01 1845.00 1.08 0.00 1.00 +{s_suppkey} 2000.00 1.01 2000.00 1.01 0.00 1.00 ----Stats for q2_lookup_join_19---- column_names row_count distinct_count null_count diff --git a/pkg/sql/opt/memo/testdata/stats_quality/tpch/q03 b/pkg/sql/opt/memo/testdata/stats_quality/tpch/q03 index 83ed9bb77cbf..d8b6c318c5a5 100644 --- a/pkg/sql/opt/memo/testdata/stats_quality/tpch/q03 +++ b/pkg/sql/opt/memo/testdata/stats_quality/tpch/q03 @@ -55,7 +55,7 @@ limit │ ├── save-table-name: q3_sort_2 │ ├── columns: o_orderdate:14(date!null) o_shippriority:17(int!null) l_orderkey:20(int!null) sum:38(float!null) │ ├── immutable - │ ├── stats: [rows=358257.687, distinct(14)=358257.687, null(14)=0, distinct(17)=358257.687, null(17)=0, distinct(20)=358257.687, null(20)=0, distinct(38)=358257.687, null(38)=0] + │ ├── stats: [rows=492693.767, distinct(14)=492693.767, null(14)=0, distinct(17)=492693.767, null(17)=0, distinct(20)=492693.767, null(20)=0, distinct(38)=492693.767, null(38)=0] │ ├── key: (20) │ ├── fd: (20)-->(14,17,38) │ ├── ordering: -38,+14 @@ -65,26 +65,26 @@ limit │ ├── columns: o_orderdate:14(date!null) o_shippriority:17(int!null) l_orderkey:20(int!null) sum:38(float!null) │ ├── grouping columns: l_orderkey:20(int!null) │ ├── immutable - │ ├── stats: [rows=358257.687, distinct(14)=358257.687, null(14)=0, distinct(17)=358257.687, null(17)=0, distinct(20)=358257.687, null(20)=0, distinct(38)=358257.687, null(38)=0] + │ ├── stats: [rows=492693.767, distinct(14)=492693.767, null(14)=0, distinct(17)=492693.767, null(17)=0, distinct(20)=492693.767, null(20)=0, distinct(38)=492693.767, null(38)=0] │ ├── key: (20) │ ├── fd: (20)-->(14,17,38) │ ├── project │ │ ├── save-table-name: q3_project_4 │ │ ├── columns: column37:37(float!null) o_orderdate:14(date!null) o_shippriority:17(int!null) l_orderkey:20(int!null) │ │ ├── immutable - │ │ ├── stats: [rows=492693.81, distinct(14)=1169, null(14)=0, distinct(17)=1, null(17)=0, distinct(20)=358257.687, null(20)=0, distinct(37)=408701.909, null(37)=0] + │ │ ├── stats: [rows=492693.767, distinct(14)=1169, null(14)=0, distinct(17)=1, null(17)=0, distinct(20)=492693.767, null(20)=0, distinct(37)=492693.767, null(37)=0] │ │ ├── fd: (20)-->(14,17) │ │ ├── inner-join (lookup lineitem) │ │ │ ├── save-table-name: q3_lookup_join_5 │ │ │ ├── columns: c_custkey:1(int!null) c_mktsegment:7(char!null) o_orderkey:10(int!null) o_custkey:11(int!null) o_orderdate:14(date!null) o_shippriority:17(int!null) l_orderkey:20(int!null) l_extendedprice:25(float!null) l_discount:26(float!null) l_shipdate:30(date!null) │ │ │ ├── key columns: [10] = [20] - │ │ │ ├── stats: [rows=492693.81, distinct(1)=30293.7362, null(1)=0, distinct(7)=1, null(7)=0, distinct(10)=358257.687, null(10)=0, distinct(11)=30293.7362, null(11)=0, distinct(14)=1169, null(14)=0, distinct(17)=1, null(17)=0, distinct(20)=358257.687, null(20)=0, distinct(25)=362862.531, null(25)=0, distinct(26)=11, null(26)=0, distinct(30)=1351, null(30)=0, distinct(25,26)=408701.909, null(25,26)=0] + │ │ │ ├── stats: [rows=492693.767, distinct(1)=30293.7362, null(1)=0, distinct(7)=1, null(7)=0, distinct(10)=492693.767, null(10)=0, distinct(11)=30293.7362, null(11)=0, distinct(14)=1169, null(14)=0, distinct(17)=1, null(17)=0, distinct(20)=492693.767, null(20)=0, distinct(25)=492693.767, null(25)=0, distinct(26)=11, null(26)=0, distinct(30)=1351, null(30)=0, distinct(25,26)=492693.767, null(25,26)=0] │ │ │ ├── fd: ()-->(7), (10)-->(11,14,17), (10)==(20), (20)==(10), (1)==(11), (11)==(1) │ │ │ ├── inner-join (hash) │ │ │ │ ├── save-table-name: q3_inner_join_6 │ │ │ │ ├── columns: c_custkey:1(int!null) c_mktsegment:7(char!null) o_orderkey:10(int!null) o_custkey:11(int!null) o_orderdate:14(date!null) o_shippriority:17(int!null) │ │ │ │ ├── multiplicity: left-rows(zero-or-one), right-rows(zero-or-more) - │ │ │ │ ├── stats: [rows=221623.813, distinct(1)=30293.7362, null(1)=0, distinct(7)=1, null(7)=0, distinct(10)=191135.905, null(10)=0, distinct(11)=30293.7362, null(11)=0, distinct(14)=1169, null(14)=0, distinct(17)=1, null(17)=0] + │ │ │ │ ├── stats: [rows=221623.813, distinct(1)=30293.7362, null(1)=0, distinct(7)=1, null(7)=0, distinct(10)=221623.813, null(10)=0, distinct(11)=30293.7362, null(11)=0, distinct(14)=1169, null(14)=0, distinct(17)=1, null(17)=0] │ │ │ │ ├── key: (10) │ │ │ │ ├── fd: ()-->(7), (10)-->(11,14,17), (1)==(11), (11)==(1) │ │ │ │ ├── select @@ -167,10 +167,10 @@ column_names row_count distinct_count null_count {sum} 0 0 0 ~~~~ column_names row_count_est row_count_err distinct_count_est distinct_count_err null_count_est null_count_err -{l_orderkey} 358258.00 +Inf <== 358258.00 +Inf <== 0.00 1.00 -{o_orderdate} 358258.00 +Inf <== 358258.00 +Inf <== 0.00 1.00 -{o_shippriority} 358258.00 +Inf <== 358258.00 +Inf <== 0.00 1.00 -{sum} 358258.00 +Inf <== 358258.00 +Inf <== 0.00 1.00 +{l_orderkey} 492694.00 +Inf <== 492694.00 +Inf <== 0.00 1.00 +{o_orderdate} 492694.00 +Inf <== 492694.00 +Inf <== 0.00 1.00 +{o_shippriority} 492694.00 +Inf <== 492694.00 +Inf <== 0.00 1.00 +{sum} 492694.00 +Inf <== 492694.00 +Inf <== 0.00 1.00 ----Stats for q3_group_by_3---- column_names row_count distinct_count null_count @@ -180,10 +180,10 @@ column_names row_count distinct_count null_count {sum} 11620 11601 0 ~~~~ column_names row_count_est row_count_err distinct_count_est distinct_count_err null_count_est null_count_err -{l_orderkey} 358258.00 30.83 <== 358258.00 30.86 <== 0.00 1.00 -{o_orderdate} 358258.00 30.83 <== 358258.00 2985.48 <== 0.00 1.00 -{o_shippriority} 358258.00 30.83 <== 358258.00 358258.00 <== 0.00 1.00 -{sum} 358258.00 30.83 <== 358258.00 30.88 <== 0.00 1.00 +{l_orderkey} 492694.00 42.40 <== 492694.00 42.43 <== 0.00 1.00 +{o_orderdate} 492694.00 42.40 <== 492694.00 4105.78 <== 0.00 1.00 +{o_shippriority} 492694.00 42.40 <== 492694.00 492694.00 <== 0.00 1.00 +{sum} 492694.00 42.40 <== 492694.00 42.47 <== 0.00 1.00 ----Stats for q3_project_4---- column_names row_count distinct_count null_count @@ -193,8 +193,8 @@ column_names row_count distinct_count null_count {o_shippriority} 30519 1 0 ~~~~ column_names row_count_est row_count_err distinct_count_est distinct_count_err null_count_est null_count_err -{column37} 492694.00 16.14 <== 408702.00 13.43 <== 0.00 1.00 -{l_orderkey} 492694.00 16.14 <== 358258.00 30.86 <== 0.00 1.00 +{column37} 492694.00 16.14 <== 492694.00 16.19 <== 0.00 1.00 +{l_orderkey} 492694.00 16.14 <== 492694.00 42.43 <== 0.00 1.00 {o_orderdate} 492694.00 16.14 <== 1169.00 9.74 <== 0.00 1.00 {o_shippriority} 492694.00 16.14 <== 1.00 1.00 0.00 1.00 @@ -215,12 +215,12 @@ column_names row_count_est row_count_err distinct_count_est distinct_co {c_custkey} 492694.00 16.14 <== 30294.00 3.51 <== 0.00 1.00 {c_mktsegment} 492694.00 16.14 <== 1.00 1.00 0.00 1.00 {l_discount} 492694.00 16.14 <== 11.00 1.00 0.00 1.00 -{l_extendedprice} 492694.00 16.14 <== 362863.00 12.08 <== 0.00 1.00 -{l_orderkey} 492694.00 16.14 <== 358258.00 30.86 <== 0.00 1.00 +{l_extendedprice} 492694.00 16.14 <== 492694.00 16.40 <== 0.00 1.00 +{l_orderkey} 492694.00 16.14 <== 492694.00 42.43 <== 0.00 1.00 {l_shipdate} 492694.00 16.14 <== 1351.00 11.26 <== 0.00 1.00 {o_custkey} 492694.00 16.14 <== 30294.00 3.51 <== 0.00 1.00 {o_orderdate} 492694.00 16.14 <== 1169.00 9.74 <== 0.00 1.00 -{o_orderkey} 492694.00 16.14 <== 358258.00 30.86 <== 0.00 1.00 +{o_orderkey} 492694.00 16.14 <== 492694.00 42.43 <== 0.00 1.00 {o_shippriority} 492694.00 16.14 <== 1.00 1.00 0.00 1.00 ----Stats for q3_inner_join_6---- @@ -237,7 +237,7 @@ column_names row_count_est row_count_err distinct_count_est distinct_cou {c_mktsegment} 221624.00 1.51 1.00 1.00 0.00 1.00 {o_custkey} 221624.00 1.51 30294.00 1.50 0.00 1.00 {o_orderdate} 221624.00 1.51 1169.00 1.00 0.00 1.00 -{o_orderkey} 221624.00 1.51 191136.00 1.32 0.00 1.00 +{o_orderkey} 221624.00 1.51 221624.00 1.53 0.00 1.00 {o_shippriority} 221624.00 1.51 1.00 1.00 0.00 1.00 ----Stats for q3_select_7---- diff --git a/pkg/sql/opt/memo/testdata/stats_quality/tpch/q05 b/pkg/sql/opt/memo/testdata/stats_quality/tpch/q05 index 9d0139b3e665..cf9d7e009bb1 100644 --- a/pkg/sql/opt/memo/testdata/stats_quality/tpch/q05 +++ b/pkg/sql/opt/memo/testdata/stats_quality/tpch/q05 @@ -65,24 +65,24 @@ sort │ ├── save-table-name: q5_project_3 │ ├── columns: column54:54(float!null) n_name:46(char!null) │ ├── immutable - │ ├── stats: [rows=13423.9824, distinct(46)=5, null(46)=0, distinct(54)=13115.0063, null(54)=0] + │ ├── stats: [rows=9271.86225, distinct(46)=5, null(46)=0, distinct(54)=9271.86225, null(54)=0] │ ├── inner-join (hash) │ │ ├── save-table-name: q5_inner_join_4 │ │ ├── columns: c_custkey:1(int!null) c_nationkey:4(int!null) o_orderkey:10(int!null) o_custkey:11(int!null) o_orderdate:14(date!null) l_orderkey:20(int!null) l_suppkey:22(int!null) l_extendedprice:25(float!null) l_discount:26(float!null) s_suppkey:37(int!null) s_nationkey:40(int!null) n_nationkey:45(int!null) n_name:46(char!null) n_regionkey:47(int!null) r_regionkey:50(int!null) r_name:51(char!null) │ │ ├── multiplicity: left-rows(zero-or-one), right-rows(zero-or-more) - │ │ ├── stats: [rows=13423.9824, distinct(1)=13423.9824, null(1)=0, distinct(4)=5, null(4)=0, distinct(10)=13039.6875, null(10)=0, distinct(11)=13423.9824, null(11)=0, distinct(14)=365, null(14)=0, distinct(20)=13039.6875, null(20)=0, distinct(22)=1843.53025, null(22)=0, distinct(25)=13086.9528, null(25)=0, distinct(26)=11, null(26)=0, distinct(37)=1843.53025, null(37)=0, distinct(40)=5, null(40)=0, distinct(45)=5, null(45)=0, distinct(46)=5, null(46)=0, distinct(47)=1, null(47)=0, distinct(50)=1, null(50)=0, distinct(51)=0.996222107, null(51)=0, distinct(25,26)=13115.0063, null(25,26)=0] + │ │ ├── stats: [rows=9271.86225, distinct(1)=9271.86225, null(1)=0, distinct(4)=5, null(4)=0, distinct(10)=9271.86225, null(10)=0, distinct(11)=9271.86225, null(11)=0, distinct(14)=365, null(14)=0, distinct(20)=9271.86225, null(20)=0, distinct(22)=2000, null(22)=0, distinct(25)=9271.86225, null(25)=0, distinct(26)=11, null(26)=0, distinct(37)=2000, null(37)=0, distinct(40)=5, null(40)=0, distinct(45)=5, null(45)=0, distinct(46)=5, null(46)=0, distinct(47)=1, null(47)=0, distinct(50)=1, null(50)=0, distinct(51)=1, null(51)=0, distinct(25,26)=9271.86225, null(25,26)=0] │ │ ├── fd: ()-->(51), (1)-->(4), (10)-->(11,14), (37)-->(40), (45)-->(46,47), (47)==(50), (50)==(47), (40)==(4,45), (45)==(4,40), (22)==(37), (37)==(22), (10)==(20), (20)==(10), (1)==(11), (11)==(1), (4)==(40,45) │ │ ├── inner-join (lookup lineitem) │ │ │ ├── save-table-name: q5_lookup_join_5 │ │ │ ├── columns: c_custkey:1(int!null) c_nationkey:4(int!null) o_orderkey:10(int!null) o_custkey:11(int!null) o_orderdate:14(date!null) l_orderkey:20(int!null) l_suppkey:22(int!null) l_extendedprice:25(float!null) l_discount:26(float!null) n_nationkey:45(int!null) n_name:46(char!null) n_regionkey:47(int!null) r_regionkey:50(int!null) r_name:51(char!null) │ │ │ ├── key columns: [10] = [20] - │ │ │ ├── stats: [rows=295776.124, distinct(1)=27671.6983, null(1)=0, distinct(4)=5, null(4)=0, distinct(10)=64194.893, null(10)=0, distinct(11)=27671.6983, null(11)=0, distinct(14)=365, null(14)=0, distinct(20)=64194.893, null(20)=0, distinct(22)=9920, null(22)=0, distinct(25)=253189.15, null(25)=0, distinct(26)=11, null(26)=0, distinct(45)=5, null(45)=0, distinct(46)=5, null(46)=0, distinct(47)=1, null(47)=0, distinct(50)=1, null(50)=0, distinct(51)=0.996222107, null(51)=0] + │ │ │ ├── stats: [rows=295776.124, distinct(1)=30000, null(1)=0, distinct(4)=5, null(4)=0, distinct(10)=75273.0907, null(10)=0, distinct(11)=30000, null(11)=0, distinct(14)=365, null(14)=0, distinct(20)=75273.0907, null(20)=0, distinct(22)=9920, null(22)=0, distinct(25)=295776.124, null(25)=0, distinct(26)=11, null(26)=0, distinct(45)=5, null(45)=0, distinct(46)=5, null(46)=0, distinct(47)=1, null(47)=0, distinct(50)=1, null(50)=0, distinct(51)=1, null(51)=0] │ │ │ ├── fd: ()-->(51), (10)-->(11,14), (1)-->(4), (45)-->(46,47), (47)==(50), (50)==(47), (4)==(45), (45)==(4), (1)==(11), (11)==(1), (10)==(20), (20)==(10) │ │ │ ├── inner-join (hash) │ │ │ │ ├── save-table-name: q5_inner_join_6 │ │ │ │ ├── columns: c_custkey:1(int!null) c_nationkey:4(int!null) o_orderkey:10(int!null) o_custkey:11(int!null) o_orderdate:14(date!null) n_nationkey:45(int!null) n_name:46(char!null) n_regionkey:47(int!null) r_regionkey:50(int!null) r_name:51(char!null) │ │ │ │ ├── multiplicity: left-rows(zero-or-one), right-rows(zero-or-more) - │ │ │ │ ├── stats: [rows=75273.0907, distinct(1)=27672.3293, null(1)=0, distinct(4)=5, null(4)=0, distinct(10)=64194.893, null(10)=0, distinct(11)=27672.3293, null(11)=0, distinct(14)=365, null(14)=0, distinct(45)=5, null(45)=0, distinct(46)=5, null(46)=0, distinct(47)=1, null(47)=0, distinct(50)=1, null(50)=0, distinct(51)=0.996222107, null(51)=0] + │ │ │ │ ├── stats: [rows=75273.0907, distinct(1)=30000, null(1)=0, distinct(4)=5, null(4)=0, distinct(10)=75273.0907, null(10)=0, distinct(11)=30000, null(11)=0, distinct(14)=365, null(14)=0, distinct(45)=5, null(45)=0, distinct(46)=5, null(46)=0, distinct(47)=1, null(47)=0, distinct(50)=1, null(50)=0, distinct(51)=1, null(51)=0] │ │ │ │ ├── key: (10) │ │ │ │ ├── fd: ()-->(51), (10)-->(11,14), (1)-->(4), (45)-->(46,47), (47)==(50), (50)==(47), (4)==(45), (45)==(4), (1)==(11), (11)==(1) │ │ │ │ ├── index-join orders @@ -108,14 +108,14 @@ sort │ │ │ │ │ ├── save-table-name: q5_lookup_join_9 │ │ │ │ │ ├── columns: c_custkey:1(int!null) c_nationkey:4(int!null) n_nationkey:45(int!null) n_name:46(char!null) n_regionkey:47(int!null) r_regionkey:50(int!null) r_name:51(char!null) │ │ │ │ │ ├── key columns: [45] = [4] - │ │ │ │ │ ├── stats: [rows=30000, distinct(1)=27672.3293, null(1)=0, distinct(4)=5, null(4)=0, distinct(45)=5, null(45)=0, distinct(46)=5, null(46)=0, distinct(47)=1, null(47)=0, distinct(50)=1, null(50)=0, distinct(51)=0.996222107, null(51)=0] + │ │ │ │ │ ├── stats: [rows=30000, distinct(1)=30000, null(1)=0, distinct(4)=5, null(4)=0, distinct(45)=5, null(45)=0, distinct(46)=5, null(46)=0, distinct(47)=1, null(47)=0, distinct(50)=1, null(50)=0, distinct(51)=1, null(51)=0] │ │ │ │ │ ├── key: (1) │ │ │ │ │ ├── fd: ()-->(51), (1)-->(4), (45)-->(46,47), (47)==(50), (50)==(47), (4)==(45), (45)==(4) │ │ │ │ │ ├── inner-join (hash) │ │ │ │ │ │ ├── save-table-name: q5_inner_join_10 │ │ │ │ │ │ ├── columns: n_nationkey:45(int!null) n_name:46(char!null) n_regionkey:47(int!null) r_regionkey:50(int!null) r_name:51(char!null) │ │ │ │ │ │ ├── multiplicity: left-rows(zero-or-one), right-rows(zero-or-more) - │ │ │ │ │ │ ├── stats: [rows=5, distinct(45)=5, null(45)=0, distinct(46)=5, null(46)=0, distinct(47)=1, null(47)=0, distinct(50)=1, null(50)=0, distinct(51)=0.996222107, null(51)=0] + │ │ │ │ │ │ ├── stats: [rows=5, distinct(45)=5, null(45)=0, distinct(46)=5, null(46)=0, distinct(47)=1, null(47)=0, distinct(50)=1, null(50)=0, distinct(51)=1, null(51)=0] │ │ │ │ │ │ ├── key: (45) │ │ │ │ │ │ ├── fd: ()-->(51), (45)-->(46,47), (47)==(50), (50)==(47) │ │ │ │ │ │ ├── scan nation @@ -199,8 +199,8 @@ column_names row_count distinct_count null_count {n_name} 7243 5 0 ~~~~ column_names row_count_est row_count_err distinct_count_est distinct_count_err null_count_est null_count_err -{column54} 13424.00 1.85 13115.00 1.81 0.00 1.00 -{n_name} 13424.00 1.85 5.00 1.00 0.00 1.00 +{column54} 9272.00 1.28 9272.00 1.28 0.00 1.00 +{n_name} 9272.00 1.28 5.00 1.00 0.00 1.00 ----Stats for q5_inner_join_4---- column_names row_count distinct_count null_count @@ -222,22 +222,22 @@ column_names row_count distinct_count null_count {s_suppkey} 7243 1944 0 ~~~~ column_names row_count_est row_count_err distinct_count_est distinct_count_err null_count_est null_count_err -{c_custkey} 13424.00 1.85 13424.00 2.42 <== 0.00 1.00 -{c_nationkey} 13424.00 1.85 5.00 1.00 0.00 1.00 -{l_discount} 13424.00 1.85 11.00 1.00 0.00 1.00 -{l_extendedprice} 13424.00 1.85 13087.00 1.82 0.00 1.00 -{l_orderkey} 13424.00 1.85 13040.00 1.96 <== 0.00 1.00 -{l_suppkey} 13424.00 1.85 1844.00 1.05 0.00 1.00 -{n_name} 13424.00 1.85 5.00 1.00 0.00 1.00 -{n_nationkey} 13424.00 1.85 5.00 1.00 0.00 1.00 -{n_regionkey} 13424.00 1.85 1.00 1.00 0.00 1.00 -{o_custkey} 13424.00 1.85 13424.00 2.42 <== 0.00 1.00 -{o_orderdate} 13424.00 1.85 365.00 1.00 0.00 1.00 -{o_orderkey} 13424.00 1.85 13040.00 1.96 <== 0.00 1.00 -{r_name} 13424.00 1.85 1.00 1.00 0.00 1.00 -{r_regionkey} 13424.00 1.85 1.00 1.00 0.00 1.00 -{s_nationkey} 13424.00 1.85 5.00 1.00 0.00 1.00 -{s_suppkey} 13424.00 1.85 1844.00 1.05 0.00 1.00 +{c_custkey} 9272.00 1.28 9272.00 1.67 0.00 1.00 +{c_nationkey} 9272.00 1.28 5.00 1.00 0.00 1.00 +{l_discount} 9272.00 1.28 11.00 1.00 0.00 1.00 +{l_extendedprice} 9272.00 1.28 9272.00 1.29 0.00 1.00 +{l_orderkey} 9272.00 1.28 9272.00 1.40 0.00 1.00 +{l_suppkey} 9272.00 1.28 2000.00 1.03 0.00 1.00 +{n_name} 9272.00 1.28 5.00 1.00 0.00 1.00 +{n_nationkey} 9272.00 1.28 5.00 1.00 0.00 1.00 +{n_regionkey} 9272.00 1.28 1.00 1.00 0.00 1.00 +{o_custkey} 9272.00 1.28 9272.00 1.67 0.00 1.00 +{o_orderdate} 9272.00 1.28 365.00 1.00 0.00 1.00 +{o_orderkey} 9272.00 1.28 9272.00 1.40 0.00 1.00 +{r_name} 9272.00 1.28 1.00 1.00 0.00 1.00 +{r_regionkey} 9272.00 1.28 1.00 1.00 0.00 1.00 +{s_nationkey} 9272.00 1.28 5.00 1.00 0.00 1.00 +{s_suppkey} 9272.00 1.28 2000.00 1.03 0.00 1.00 ----Stats for q5_lookup_join_5---- column_names row_count distinct_count null_count @@ -257,18 +257,18 @@ column_names row_count distinct_count null_count {r_regionkey} 184082 1 0 ~~~~ column_names row_count_est row_count_err distinct_count_est distinct_count_err null_count_est null_count_err -{c_custkey} 295776.00 1.61 27672.00 1.60 0.00 1.00 +{c_custkey} 295776.00 1.61 30000.00 1.73 0.00 1.00 {c_nationkey} 295776.00 1.61 5.00 1.00 0.00 1.00 {l_discount} 295776.00 1.61 11.00 1.00 0.00 1.00 -{l_extendedprice} 295776.00 1.61 253189.00 1.53 0.00 1.00 -{l_orderkey} 295776.00 1.61 64195.00 1.40 0.00 1.00 +{l_extendedprice} 295776.00 1.61 295776.00 1.79 0.00 1.00 +{l_orderkey} 295776.00 1.61 75273.00 1.64 0.00 1.00 {l_suppkey} 295776.00 1.61 9920.00 1.00 0.00 1.00 {n_name} 295776.00 1.61 5.00 1.00 0.00 1.00 {n_nationkey} 295776.00 1.61 5.00 1.00 0.00 1.00 {n_regionkey} 295776.00 1.61 1.00 1.00 0.00 1.00 -{o_custkey} 295776.00 1.61 27672.00 1.60 0.00 1.00 +{o_custkey} 295776.00 1.61 30000.00 1.73 0.00 1.00 {o_orderdate} 295776.00 1.61 365.00 1.00 0.00 1.00 -{o_orderkey} 295776.00 1.61 64195.00 1.40 0.00 1.00 +{o_orderkey} 295776.00 1.61 75273.00 1.64 0.00 1.00 {r_name} 295776.00 1.61 1.00 1.00 0.00 1.00 {r_regionkey} 295776.00 1.61 1.00 1.00 0.00 1.00 @@ -286,14 +286,14 @@ column_names row_count distinct_count null_count {r_regionkey} 46008 1 0 ~~~~ column_names row_count_est row_count_err distinct_count_est distinct_count_err null_count_est null_count_err -{c_custkey} 75273.00 1.64 27672.00 1.60 0.00 1.00 +{c_custkey} 75273.00 1.64 30000.00 1.73 0.00 1.00 {c_nationkey} 75273.00 1.64 5.00 1.00 0.00 1.00 {n_name} 75273.00 1.64 5.00 1.00 0.00 1.00 {n_nationkey} 75273.00 1.64 5.00 1.00 0.00 1.00 {n_regionkey} 75273.00 1.64 1.00 1.00 0.00 1.00 -{o_custkey} 75273.00 1.64 27672.00 1.60 0.00 1.00 +{o_custkey} 75273.00 1.64 30000.00 1.73 0.00 1.00 {o_orderdate} 75273.00 1.64 365.00 1.00 0.00 1.00 -{o_orderkey} 75273.00 1.64 64195.00 1.40 0.00 1.00 +{o_orderkey} 75273.00 1.64 75273.00 1.64 0.00 1.00 {r_name} 75273.00 1.64 1.00 1.00 0.00 1.00 {r_regionkey} 75273.00 1.64 1.00 1.00 0.00 1.00 @@ -328,7 +328,7 @@ column_names row_count distinct_count null_count {r_regionkey} 30183 1 0 ~~~~ column_names row_count_est row_count_err distinct_count_est distinct_count_err null_count_est null_count_err -{c_custkey} 30000.00 1.01 27672.00 1.08 0.00 1.00 +{c_custkey} 30000.00 1.01 30000.00 1.00 0.00 1.00 {c_nationkey} 30000.00 1.01 5.00 1.00 0.00 1.00 {n_name} 30000.00 1.01 5.00 1.00 0.00 1.00 {n_nationkey} 30000.00 1.01 5.00 1.00 0.00 1.00 diff --git a/pkg/sql/opt/memo/testdata/stats_quality/tpch/q06 b/pkg/sql/opt/memo/testdata/stats_quality/tpch/q06 index b10a52cc5b84..cd502fd8868b 100644 --- a/pkg/sql/opt/memo/testdata/stats_quality/tpch/q06 +++ b/pkg/sql/opt/memo/testdata/stats_quality/tpch/q06 @@ -62,9 +62,9 @@ scalar-group-by │ │ │ ├── save-table-name: q6_scan_5 │ │ │ ├── columns: l_orderkey:1(int!null) l_linenumber:4(int!null) l_shipdate:11(date!null) │ │ │ ├── constraint: /11/1/4: [/'1994-01-01' - /'1994-12-31'] - │ │ │ ├── stats: [rows=925860.354, distinct(1)=736656.352, null(1)=0, distinct(4)=7, null(4)=0, distinct(11)=365, null(11)=0] - │ │ │ │ histogram(1)= 0 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4444 185.13 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4444 185.13 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4629.3 92.567 4629.3 92.567 4629.3 92.567 4629.3 92.567 4629.3 92.567 4629.3 92.567 4629.3 92.567 4629.3 92.567 4629.3 92.567 4629.3 92.567 4629.3 92.567 4629.3 92.567 4629.3 92.567 4629.3 92.567 4629.3 92.567 4629.3 92.567 4629.3 92.567 4629.3 92.567 4629.3 92.567 4629.3 92.567 4629.3 92.567 4629.3 92.567 4629.3 92.567 4629.3 92.567 4629.3 92.567 4629.3 92.567 4629.3 92.567 4629.3 92.567 4629.3 92.567 4629.3 92.567 4629.3 92.567 4629.3 92.567 4629.3 92.567 4629.3 92.567 4629.3 92.567 4629.3 92.567 4629.3 92.567 4629.3 92.567 4629.3 92.567 4629.3 92.567 4629.3 92.567 4629.3 92.567 4629.3 92.567 4629.3 92.567 4629.3 92.567 4629.3 92.567 4629.3 92.567 4629.3 92.567 4629.3 92.567 - │ │ │ │ <---- 32 --------- 27780 -------- 60677 -------- 87430 -------- 111814 -------- 139648 -------- 166148 -------- 198051 -------- 232580 -------- 259104 -------- 283460 -------- 311460 -------- 344230 -------- 376102 -------- 408963 -------- 436743 -------- 470368 -------- 503942 -------- 531236 -------- 559395 -------- 589314 -------- 620839 -------- 649670 -------- 672483 -------- 698693 -------- 726629 -------- 756997 -------- 796164 -------- 824327 -------- 855873 -------- 882247 -------- 916418 -------- 951748 -------- 978498 -------- 1005765 -------- 1036864 -------- 1061351 -------- 1093638 -------- 1122308 -------- 1155844 -------- 1191239 -------- 1225540 -------- 1254915 -------- 1281670 -------- 1306721 -------- 1337410 -------- 1368419 -------- 1405382 -------- 1438210 -------- 1465477 -------- 1490627 -------- 1517251 -------- 1544289 -------- 1573729 -------- 1607168 -------- 1635648 -------- 1658848 -------- 1691623 -------- 1718631 -------- 1753345 -------- 1782470 -------- 1812742 -------- 1837702 -------- 1873349 -------- 1905733 -------- 1941024 -------- 1977287 -------- 2005826 -------- 2035300 -------- 2067878 -------- 2093927 -------- 2127906 -------- 2154055 -------- 2181095 -------- 2212035 -------- 2242374 -------- 2263458 -------- 2288481 -------- 2315300 -------- 2340997 -------- 2371200 -------- 2399616 -------- 2429154 -------- 2455393 -------- 2488384 -------- 2521088 -------- 2550885 -------- 2581058 -------- 2610496 -------- 2644197 -------- 2675648 -------- 2698821 -------- 2726246 -------- 2757444 -------- 2792612 -------- 2827174 -------- 2846849 -------- 2881250 -------- 2900739 -------- 2930660 -------- 2962240 -------- 2999235 -------- 3031974 -------- 3060197 -------- 3087586 -------- 3120390 -------- 3147524 -------- 3170721 -------- 3199173 ------ 3230049 -------- 3255008 -------- 3284965 -------- 3315744 -------- 3345376 -------- 3379776 -------- 3405445 -------- 3436711 -------- 3467557 -------- 3489541 -------- 3518179 -------- 3546276 -------- 3568964 ------ 3596039 -------- 3621926 -------- 3644805 -------- 3675361 -------- 3706592 -------- 3735589 -------- 3761220 -------- 3789607 -------- 3820866 -------- 3862274 -------- 3898051 -------- 3925188 -------- 3957157 -------- 3983873 -------- 4013092 -------- 4039202 -------- 4070918 -------- 4105696 -------- 4136867 -------- 4169475 -------- 4205249 -------- 4239013 -------- 4264423 -------- 4292135 -------- 4324453 -------- 4356356 -------- 4392386 -------- 4423074 -------- 4447335 -------- 4469345 -------- 4496513 -------- 4530848 -------- 4565159 -------- 4596965 -------- 4627011 -------- 4662598 -------- 4690818 -------- 4718691 -------- 4749349 -------- 4782722 -------- 4824485 -------- 4856323 -------- 4885795 -------- 4911142 -------- 4945794 -------- 4972801 -------- 5000583 -------- 5033735 -------- 5072421 -------- 5112929 -------- 5145956 -------- 5181923 -------- 5217478 -------- 5247620 -------- 5273605 -------- 5304100 -------- 5343362 -------- 5375842 -------- 5408391 -------- 5439046 -------- 5464610 -------- 5497857 -------- 5528295 -------- 5557956 -------- 5593474 -------- 5626209 -------- 5660931 -------- 5703463 -------- 5733440 -------- 5762565 -------- 5788034 -------- 5813505 -------- 5848227 -------- 5870727 -------- 5908998 -------- 5938311 -------- 5968930 -------- 5999751 + │ │ │ ├── stats: [rows=925860.354, distinct(1)=925860.354, null(1)=0, distinct(4)=7, null(4)=0, distinct(11)=365, null(11)=0] + │ │ │ │ histogram(1)= 0 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4444.1 185.14 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4444.1 185.14 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4629.4 92.57 4629.4 92.57 4629.4 92.57 4629.4 92.57 4629.4 92.57 4629.4 92.57 4629.4 92.57 4629.4 92.57 4629.4 92.57 4629.4 92.57 4629.4 92.57 4629.4 92.57 4629.4 92.57 4629.4 92.57 4629.4 92.57 4629.4 92.57 4629.4 92.57 4629.4 92.57 4629.4 92.57 4629.4 92.57 4629.4 92.57 4629.4 92.57 4629.4 92.57 4629.4 92.57 4629.4 92.57 4629.4 92.57 4629.4 92.57 4629.4 92.57 4629.4 92.57 4629.4 92.57 4629.4 92.57 4629.4 92.57 4629.4 92.57 4629.4 92.57 4629.4 92.57 4629.4 92.57 4629.4 92.57 4629.4 92.57 4629.4 92.57 4629.4 92.57 4629.4 92.57 4629.4 92.57 4629.4 92.57 4629.4 92.57 4629.4 92.57 4629.4 92.57 4629.4 92.57 4629.4 92.57 4629.4 92.57 + │ │ │ │ <--- 32 --------- 27780 -------- 60677 -------- 87430 -------- 111814 -------- 139648 -------- 166148 -------- 198051 -------- 232580 -------- 259104 -------- 283460 -------- 311460 -------- 344230 -------- 376102 -------- 408963 -------- 436743 -------- 470368 -------- 503942 -------- 531236 -------- 559395 -------- 589314 -------- 620839 -------- 649670 -------- 672483 -------- 698693 -------- 726629 -------- 756997 -------- 796164 -------- 824327 -------- 855873 -------- 882247 -------- 916418 -------- 951748 -------- 978498 -------- 1005765 -------- 1036864 -------- 1061351 -------- 1093638 -------- 1122308 -------- 1155844 -------- 1191239 -------- 1225540 -------- 1254915 -------- 1281670 -------- 1306721 -------- 1337410 -------- 1368419 -------- 1405382 -------- 1438210 -------- 1465477 -------- 1490627 -------- 1517251 -------- 1544289 -------- 1573729 -------- 1607168 -------- 1635648 -------- 1658848 -------- 1691623 -------- 1718631 -------- 1753345 -------- 1782470 -------- 1812742 -------- 1837702 -------- 1873349 -------- 1905733 -------- 1941024 -------- 1977287 -------- 2005826 -------- 2035300 -------- 2067878 -------- 2093927 -------- 2127906 -------- 2154055 -------- 2181095 -------- 2212035 -------- 2242374 -------- 2263458 -------- 2288481 -------- 2315300 -------- 2340997 -------- 2371200 -------- 2399616 -------- 2429154 -------- 2455393 -------- 2488384 -------- 2521088 -------- 2550885 -------- 2581058 -------- 2610496 -------- 2644197 -------- 2675648 -------- 2698821 -------- 2726246 -------- 2757444 -------- 2792612 -------- 2827174 -------- 2846849 -------- 2881250 -------- 2900739 -------- 2930660 -------- 2962240 -------- 2999235 -------- 3031974 -------- 3060197 -------- 3087586 -------- 3120390 -------- 3147524 -------- 3170721 -------- 3199173 -------- 3230049 -------- 3255008 -------- 3284965 -------- 3315744 -------- 3345376 -------- 3379776 -------- 3405445 -------- 3436711 -------- 3467557 -------- 3489541 -------- 3518179 -------- 3546276 -------- 3568964 -------- 3596039 -------- 3621926 -------- 3644805 -------- 3675361 -------- 3706592 -------- 3735589 -------- 3761220 -------- 3789607 -------- 3820866 -------- 3862274 -------- 3898051 -------- 3925188 -------- 3957157 -------- 3983873 -------- 4013092 -------- 4039202 -------- 4070918 -------- 4105696 -------- 4136867 -------- 4169475 -------- 4205249 -------- 4239013 -------- 4264423 -------- 4292135 -------- 4324453 -------- 4356356 -------- 4392386 -------- 4423074 -------- 4447335 -------- 4469345 -------- 4496513 -------- 4530848 -------- 4565159 -------- 4596965 -------- 4627011 -------- 4662598 -------- 4690818 -------- 4718691 -------- 4749349 -------- 4782722 -------- 4824485 -------- 4856323 -------- 4885795 -------- 4911142 -------- 4945794 -------- 4972801 -------- 5000583 -------- 5033735 -------- 5072421 -------- 5112929 -------- 5145956 -------- 5181923 -------- 5217478 -------- 5247620 -------- 5273605 -------- 5304100 -------- 5343362 -------- 5375842 -------- 5408391 -------- 5439046 -------- 5464610 -------- 5497857 -------- 5528295 -------- 5557956 -------- 5593474 -------- 5626209 -------- 5660931 -------- 5703463 -------- 5733440 -------- 5762565 -------- 5788034 -------- 5813505 -------- 5848227 -------- 5870727 -------- 5908998 -------- 5938311 -------- 5968930 -------- 5999751 │ │ │ │ histogram(4)= 0 2.3017e+05 0 1.9693e+05 0 1.6119e+05 0 1.3036e+05 0 1.0268e+05 0 69069 0 35460 │ │ │ │ <------ 1 ---------- 2 ---------- 3 ---------- 4 ---------- 5 -------- 6 ----- 7 - │ │ │ │ histogram(11)= 0 0 24928 2400 27605 1800 27605 2400 28205 4800 28205 3000 28205 1800 25205 4200 28805 1800 28205 4200 27005 3600 28205 1800 26405 3600 27605 2400 28805 1200 24004 5401 27005 5401 28205 3600 28205 1200 28805 1800 27005 3600 27605 1800 27005 2400 27605 4200 26405 5401 28205 4200 27605 2400 28205 1800 26405 3000 27005 4200 28805 3000 6901.2 3450.6 @@ -128,7 +128,7 @@ column_names row_count distinct_count null_count ~~~~ column_names row_count_est row_count_err distinct_count_est distinct_count_err null_count_est null_count_err {l_linenumber} 925860.00 1.02 7.00 1.00 0.00 1.00 -{l_orderkey} 925860.00 1.02 736656.00 2.77 <== 0.00 1.00 +{l_orderkey} 925860.00 1.02 925860.00 3.48 <== 0.00 1.00 {l_shipdate} 925860.00 1.02 365.00 1.00 0.00 1.00 ---- ---- diff --git a/pkg/sql/opt/memo/testdata/stats_quality/tpch/q08 b/pkg/sql/opt/memo/testdata/stats_quality/tpch/q08 index 1b6ba98a2cb7..61a765bde0e6 100644 --- a/pkg/sql/opt/memo/testdata/stats_quality/tpch/q08 +++ b/pkg/sql/opt/memo/testdata/stats_quality/tpch/q08 @@ -60,7 +60,7 @@ sort ├── save-table-name: q8_sort_1 ├── columns: o_year:69(float) mkt_share:74(float!null) ├── immutable - ├── stats: [rows=728.956992, distinct(69)=728.956992, null(69)=0, distinct(74)=728.956992, null(74)=0] + ├── stats: [rows=731, distinct(69)=731, null(69)=0, distinct(74)=731, null(74)=0] ├── key: (69) ├── fd: (69)-->(74) ├── ordering: +69 @@ -68,7 +68,7 @@ sort ├── save-table-name: q8_project_2 ├── columns: mkt_share:74(float!null) o_year:69(float) ├── immutable - ├── stats: [rows=728.956992, distinct(69)=728.956992, null(69)=0, distinct(74)=728.956992, null(74)=0] + ├── stats: [rows=731, distinct(69)=731, null(69)=0, distinct(74)=731, null(74)=0] ├── key: (69) ├── fd: (69)-->(74) ├── group-by @@ -76,30 +76,30 @@ sort │ ├── columns: o_year:69(float) sum:72(float!null) sum:73(float!null) │ ├── grouping columns: o_year:69(float) │ ├── immutable - │ ├── stats: [rows=728.956992, distinct(69)=728.956992, null(69)=0, distinct(72)=728.956992, null(72)=0, distinct(73)=728.956992, null(73)=0, distinct(72,73)=728.956992, null(72,73)=0] + │ ├── stats: [rows=731, distinct(69)=731, null(69)=0, distinct(72)=731, null(72)=0, distinct(73)=731, null(73)=0, distinct(72,73)=731, null(72,73)=0] │ ├── key: (69) │ ├── fd: (69)-->(72,73) │ ├── project │ │ ├── save-table-name: q8_project_4 │ │ ├── columns: column71:71(float!null) o_year:69(float) volume:70(float!null) │ │ ├── immutable - │ │ ├── stats: [rows=4298.26025, distinct(69)=728.956992, null(69)=0, distinct(70)=4264.27541, null(70)=0, distinct(71)=4281.24453, null(71)=0] + │ │ ├── stats: [rows=3626.32395, distinct(69)=731, null(69)=0, distinct(70)=3626.32395, null(70)=0, distinct(71)=3626.32395, null(71)=0] │ │ ├── project │ │ │ ├── save-table-name: q8_project_5 │ │ │ ├── columns: o_year:69(float) volume:70(float!null) n2.n_name:61(char!null) │ │ │ ├── immutable - │ │ │ ├── stats: [rows=4298.26025, distinct(61)=25, null(61)=0, distinct(69)=728.956992, null(69)=0, distinct(70)=4264.27541, null(70)=0, distinct(61,70)=4281.24453, null(61,70)=0] + │ │ │ ├── stats: [rows=3626.32395, distinct(61)=25, null(61)=0, distinct(69)=731, null(69)=0, distinct(70)=3626.32395, null(70)=0, distinct(61,70)=3626.32395, null(61,70)=0] │ │ │ ├── inner-join (hash) │ │ │ │ ├── save-table-name: q8_inner_join_6 │ │ │ │ ├── columns: p_partkey:1(int!null) p_type:5(varchar!null) s_suppkey:11(int!null) s_nationkey:14(int!null) l_orderkey:19(int!null) l_partkey:20(int!null) l_suppkey:21(int!null) l_extendedprice:24(float!null) l_discount:25(float!null) o_orderkey:36(int!null) o_custkey:37(int!null) o_orderdate:40(date!null) c_custkey:46(int!null) c_nationkey:49(int!null) n1.n_nationkey:55(int!null) n1.n_regionkey:57(int!null) n2.n_nationkey:60(int!null) n2.n_name:61(char!null) r_regionkey:65(int!null) r_name:66(char!null) │ │ │ │ ├── multiplicity: left-rows(exactly-one), right-rows(zero-or-more) - │ │ │ │ ├── stats: [rows=4298.26025, distinct(1)=1335.38838, null(1)=0, distinct(5)=1, null(5)=0, distinct(11)=3488.16892, null(11)=0, distinct(14)=25, null(14)=0, distinct(19)=4219.39619, null(19)=0, distinct(20)=1335.38838, null(20)=0, distinct(21)=3488.16892, null(21)=0, distinct(24)=4261.8323, null(24)=0, distinct(25)=11, null(25)=0, distinct(36)=4219.39619, null(36)=0, distinct(37)=3981.08605, null(37)=0, distinct(40)=728.956992, null(40)=0, distinct(46)=3981.08605, null(46)=0, distinct(49)=5, null(49)=0, distinct(55)=5, null(55)=0, distinct(57)=1, null(57)=0, distinct(60)=25, null(60)=0, distinct(61)=25, null(61)=0, distinct(65)=1, null(65)=0, distinct(66)=0.996222107, null(66)=0, distinct(24,25)=4264.27541, null(24,25)=0, distinct(24,25,61)=4281.24453, null(24,25,61)=0] + │ │ │ │ ├── stats: [rows=3626.32395, distinct(1)=1335.38838, null(1)=0, distinct(5)=1, null(5)=0, distinct(11)=3626.32395, null(11)=0, distinct(14)=25, null(14)=0, distinct(19)=3626.32395, null(19)=0, distinct(20)=1335.38838, null(20)=0, distinct(21)=3626.32395, null(21)=0, distinct(24)=3626.32395, null(24)=0, distinct(25)=11, null(25)=0, distinct(36)=3626.32395, null(36)=0, distinct(37)=3626.32395, null(37)=0, distinct(40)=731, null(40)=0, distinct(46)=3626.32395, null(46)=0, distinct(49)=5, null(49)=0, distinct(55)=5, null(55)=0, distinct(57)=1, null(57)=0, distinct(60)=25, null(60)=0, distinct(61)=25, null(61)=0, distinct(65)=1, null(65)=0, distinct(66)=1, null(66)=0, distinct(24,25)=3626.32395, null(24,25)=0, distinct(24,25,61)=3626.32395, null(24,25,61)=0] │ │ │ │ ├── fd: ()-->(5,66), (11)-->(14), (36)-->(37,40), (46)-->(49), (55)-->(57), (57)==(65), (65)==(57), (49)==(55), (55)==(49), (37)==(46), (46)==(37), (19)==(36), (36)==(19), (11)==(21), (21)==(11), (60)-->(61), (14)==(60), (60)==(14), (1)==(20), (20)==(1) │ │ │ │ ├── inner-join (hash) │ │ │ │ │ ├── save-table-name: q8_inner_join_7 │ │ │ │ │ ├── columns: p_partkey:1(int!null) p_type:5(varchar!null) s_suppkey:11(int!null) s_nationkey:14(int!null) l_orderkey:19(int!null) l_partkey:20(int!null) l_suppkey:21(int!null) l_extendedprice:24(float!null) l_discount:25(float!null) o_orderkey:36(int!null) o_custkey:37(int!null) o_orderdate:40(date!null) c_custkey:46(int!null) c_nationkey:49(int!null) n1.n_nationkey:55(int!null) n1.n_regionkey:57(int!null) r_regionkey:65(int!null) r_name:66(char!null) │ │ │ │ │ ├── multiplicity: left-rows(zero-or-more), right-rows(exactly-one) - │ │ │ │ │ ├── stats: [rows=4112.79535, distinct(1)=1335.38838, null(1)=0, distinct(5)=1, null(5)=0, distinct(11)=3366.78718, null(11)=0, distinct(14)=25, null(14)=0, distinct(19)=4041.18142, null(19)=0, distinct(20)=1335.38838, null(20)=0, distinct(21)=3366.78718, null(21)=0, distinct(24)=4084.68927, null(24)=0, distinct(25)=11, null(25)=0, distinct(36)=4041.18142, null(36)=0, distinct(37)=3821.76888, null(37)=0, distinct(40)=728.366962, null(40)=0, distinct(46)=3821.76888, null(46)=0, distinct(49)=5, null(49)=0, distinct(55)=5, null(55)=0, distinct(57)=1, null(57)=0, distinct(65)=1, null(65)=0, distinct(66)=0.996222107, null(66)=0] + │ │ │ │ │ ├── stats: [rows=3626.32395, distinct(1)=1335.38838, null(1)=0, distinct(5)=1, null(5)=0, distinct(11)=3626.32395, null(11)=0, distinct(14)=25, null(14)=0, distinct(19)=3626.32395, null(19)=0, distinct(20)=1335.38838, null(20)=0, distinct(21)=3626.32395, null(21)=0, distinct(24)=3626.32395, null(24)=0, distinct(25)=11, null(25)=0, distinct(36)=3626.32395, null(36)=0, distinct(37)=3626.32395, null(37)=0, distinct(40)=731, null(40)=0, distinct(46)=3626.32395, null(46)=0, distinct(49)=5, null(49)=0, distinct(55)=5, null(55)=0, distinct(57)=1, null(57)=0, distinct(65)=1, null(65)=0, distinct(66)=1, null(66)=0] │ │ │ │ │ ├── fd: ()-->(5,66), (11)-->(14), (36)-->(37,40), (46)-->(49), (55)-->(57), (57)==(65), (65)==(57), (49)==(55), (55)==(49), (37)==(46), (46)==(37), (19)==(36), (36)==(19), (11)==(21), (21)==(11), (1)==(20), (20)==(1) │ │ │ │ │ ├── scan supplier@s_nk │ │ │ │ │ │ ├── save-table-name: q8_scan_8 @@ -115,20 +115,20 @@ sort │ │ │ │ │ │ ├── save-table-name: q8_inner_join_9 │ │ │ │ │ │ ├── columns: p_partkey:1(int!null) p_type:5(varchar!null) l_orderkey:19(int!null) l_partkey:20(int!null) l_suppkey:21(int!null) l_extendedprice:24(float!null) l_discount:25(float!null) o_orderkey:36(int!null) o_custkey:37(int!null) o_orderdate:40(date!null) c_custkey:46(int!null) c_nationkey:49(int!null) n1.n_nationkey:55(int!null) n1.n_regionkey:57(int!null) r_regionkey:65(int!null) r_name:66(char!null) │ │ │ │ │ │ ├── multiplicity: left-rows(zero-or-more), right-rows(zero-or-one) - │ │ │ │ │ │ ├── stats: [rows=3858.21971, distinct(1)=1335.38838, null(1)=0, distinct(5)=1, null(5)=0, distinct(19)=3795.78555, null(19)=0, distinct(20)=1335.38838, null(20)=0, distinct(21)=3196.43556, null(21)=0, distinct(24)=3840.01484, null(24)=0, distinct(25)=11, null(25)=0, distinct(36)=3795.78555, null(36)=0, distinct(37)=3601.33863, null(37)=0, distinct(40)=727.270042, null(40)=0, distinct(46)=3601.33863, null(46)=0, distinct(49)=5, null(49)=0, distinct(55)=5, null(55)=0, distinct(57)=1, null(57)=0, distinct(65)=1, null(65)=0, distinct(66)=0.996222107, null(66)=0] + │ │ │ │ │ │ ├── stats: [rows=3597.31335, distinct(1)=1335.38838, null(1)=0, distinct(5)=1, null(5)=0, distinct(19)=3597.31335, null(19)=0, distinct(20)=1335.38838, null(20)=0, distinct(21)=3597.31335, null(21)=0, distinct(24)=3597.31335, null(24)=0, distinct(25)=11, null(25)=0, distinct(36)=3597.31335, null(36)=0, distinct(37)=3597.31335, null(37)=0, distinct(40)=731, null(40)=0, distinct(46)=3597.31335, null(46)=0, distinct(49)=5, null(49)=0, distinct(55)=5, null(55)=0, distinct(57)=1, null(57)=0, distinct(65)=1, null(65)=0, distinct(66)=1, null(66)=0] │ │ │ │ │ │ ├── fd: ()-->(5,66), (36)-->(37,40), (46)-->(49), (55)-->(57), (57)==(65), (65)==(57), (49)==(55), (55)==(49), (37)==(46), (46)==(37), (19)==(36), (36)==(19), (1)==(20), (20)==(1) │ │ │ │ │ │ ├── inner-join (lookup customer@c_nk) │ │ │ │ │ │ │ ├── save-table-name: q8_lookup_join_10 │ │ │ │ │ │ │ ├── columns: c_custkey:46(int!null) c_nationkey:49(int!null) n1.n_nationkey:55(int!null) n1.n_regionkey:57(int!null) r_regionkey:65(int!null) r_name:66(char!null) │ │ │ │ │ │ │ ├── key columns: [55] = [49] - │ │ │ │ │ │ │ ├── stats: [rows=30000, distinct(46)=27672.3293, null(46)=0, distinct(49)=5, null(49)=0, distinct(55)=5, null(55)=0, distinct(57)=1, null(57)=0, distinct(65)=1, null(65)=0, distinct(66)=0.996222107, null(66)=0] + │ │ │ │ │ │ │ ├── stats: [rows=30000, distinct(46)=30000, null(46)=0, distinct(49)=5, null(49)=0, distinct(55)=5, null(55)=0, distinct(57)=1, null(57)=0, distinct(65)=1, null(65)=0, distinct(66)=1, null(66)=0] │ │ │ │ │ │ │ ├── key: (46) │ │ │ │ │ │ │ ├── fd: ()-->(66), (46)-->(49), (55)-->(57), (57)==(65), (65)==(57), (49)==(55), (55)==(49) │ │ │ │ │ │ │ ├── inner-join (lookup nation@n_rk [as=n1]) │ │ │ │ │ │ │ │ ├── save-table-name: q8_lookup_join_11 │ │ │ │ │ │ │ │ ├── columns: n1.n_nationkey:55(int!null) n1.n_regionkey:57(int!null) r_regionkey:65(int!null) r_name:66(char!null) │ │ │ │ │ │ │ │ ├── key columns: [65] = [57] - │ │ │ │ │ │ │ │ ├── stats: [rows=5, distinct(55)=5, null(55)=0, distinct(57)=1, null(57)=0, distinct(65)=1, null(65)=0, distinct(66)=0.996222107, null(66)=0] + │ │ │ │ │ │ │ │ ├── stats: [rows=5, distinct(55)=5, null(55)=0, distinct(57)=1, null(57)=0, distinct(65)=1, null(65)=0, distinct(66)=1, null(66)=0] │ │ │ │ │ │ │ │ ├── key: (55) │ │ │ │ │ │ │ │ ├── fd: ()-->(66), (55)-->(57), (57)==(65), (65)==(57) │ │ │ │ │ │ │ │ ├── select @@ -158,20 +158,20 @@ sort │ │ │ │ │ │ │ ├── columns: p_partkey:1(int!null) p_type:5(varchar!null) l_orderkey:19(int!null) l_partkey:20(int!null) l_suppkey:21(int!null) l_extendedprice:24(float!null) l_discount:25(float!null) o_orderkey:36(int!null) o_custkey:37(int!null) o_orderdate:40(date!null) │ │ │ │ │ │ │ ├── key columns: [19] = [36] │ │ │ │ │ │ │ ├── lookup columns are key - │ │ │ │ │ │ │ ├── stats: [rows=11919.8023, distinct(1)=1335.38838, null(1)=0, distinct(5)=1, null(5)=0, distinct(19)=11764.217, null(19)=0, distinct(20)=1335.38838, null(20)=0, distinct(21)=6936.91818, null(21)=0, distinct(24)=11830.3859, null(24)=0, distinct(25)=11, null(25)=0, distinct(36)=11764.217, null(36)=0, distinct(37)=11232.8152, null(37)=0, distinct(40)=730.999939, null(40)=0] + │ │ │ │ │ │ │ ├── stats: [rows=11918.2163, distinct(1)=1335.38838, null(1)=0, distinct(5)=1, null(5)=0, distinct(19)=11918.2163, null(19)=0, distinct(20)=1335.38838, null(20)=0, distinct(21)=9920, null(21)=0, distinct(24)=11918.2163, null(24)=0, distinct(25)=11, null(25)=0, distinct(36)=11918.2163, null(36)=0, distinct(37)=11918.2163, null(37)=0, distinct(40)=731, null(40)=0] │ │ │ │ │ │ │ ├── fd: ()-->(5), (36)-->(37,40), (19)==(36), (36)==(19), (1)==(20), (20)==(1) │ │ │ │ │ │ │ ├── inner-join (lookup lineitem) │ │ │ │ │ │ │ │ ├── save-table-name: q8_lookup_join_15 │ │ │ │ │ │ │ │ ├── columns: p_partkey:1(int!null) p_type:5(varchar!null) l_orderkey:19(int!null) l_partkey:20(int!null) l_suppkey:21(int!null) l_extendedprice:24(float!null) l_discount:25(float!null) │ │ │ │ │ │ │ │ ├── key columns: [19 22] = [19 22] │ │ │ │ │ │ │ │ ├── lookup columns are key - │ │ │ │ │ │ │ │ ├── stats: [rows=40222.9207, distinct(1)=1335.38838, null(1)=0, distinct(5)=1, null(5)=0, distinct(19)=39697.9733, null(19)=0, distinct(20)=1335.38838, null(20)=0, distinct(21)=9747.98733, null(21)=0, distinct(24)=39361.9016, null(24)=0, distinct(25)=11, null(25)=0] + │ │ │ │ │ │ │ │ ├── stats: [rows=40222.9207, distinct(1)=1335.38838, null(1)=0, distinct(5)=1, null(5)=0, distinct(19)=40222.9207, null(19)=0, distinct(20)=1335.38838, null(20)=0, distinct(21)=9920, null(21)=0, distinct(24)=40222.9207, null(24)=0, distinct(25)=11, null(25)=0] │ │ │ │ │ │ │ │ ├── fd: ()-->(5), (1)==(20), (20)==(1) │ │ │ │ │ │ │ │ ├── inner-join (lookup lineitem@l_pk) │ │ │ │ │ │ │ │ │ ├── save-table-name: q8_lookup_join_16 │ │ │ │ │ │ │ │ │ ├── columns: p_partkey:1(int!null) p_type:5(varchar!null) l_orderkey:19(int!null) l_partkey:20(int!null) l_linenumber:22(int!null) │ │ │ │ │ │ │ │ │ ├── key columns: [1] = [20] - │ │ │ │ │ │ │ │ │ ├── stats: [rows=40222.9207, distinct(1)=1335.38838, null(1)=0, distinct(5)=1, null(5)=0, distinct(19)=39697.9733, null(19)=0, distinct(20)=1335.38838, null(20)=0, distinct(22)=7, null(22)=0] + │ │ │ │ │ │ │ │ │ ├── stats: [rows=40222.9207, distinct(1)=1335.38838, null(1)=0, distinct(5)=1, null(5)=0, distinct(19)=40222.9207, null(19)=0, distinct(20)=1335.38838, null(20)=0, distinct(22)=7, null(22)=0] │ │ │ │ │ │ │ │ │ ├── key: (19,22) │ │ │ │ │ │ │ │ │ ├── fd: ()-->(5), (19,22)-->(20), (1)==(20), (20)==(1) │ │ │ │ │ │ │ │ │ ├── select @@ -233,8 +233,8 @@ column_names row_count distinct_count null_count {o_year} 2 2 0 ~~~~ column_names row_count_est row_count_err distinct_count_est distinct_count_err null_count_est null_count_err -{mkt_share} 729.00 364.50 <== 729.00 364.50 <== 0.00 1.00 -{o_year} 729.00 364.50 <== 729.00 364.50 <== 0.00 1.00 +{mkt_share} 731.00 365.50 <== 731.00 365.50 <== 0.00 1.00 +{o_year} 731.00 365.50 <== 731.00 365.50 <== 0.00 1.00 ----Stats for q8_project_2---- column_names row_count distinct_count null_count @@ -242,8 +242,8 @@ column_names row_count distinct_count null_count {o_year} 2 2 0 ~~~~ column_names row_count_est row_count_err distinct_count_est distinct_count_err null_count_est null_count_err -{mkt_share} 729.00 364.50 <== 729.00 364.50 <== 0.00 1.00 -{o_year} 729.00 364.50 <== 729.00 364.50 <== 0.00 1.00 +{mkt_share} 731.00 365.50 <== 731.00 365.50 <== 0.00 1.00 +{o_year} 731.00 365.50 <== 731.00 365.50 <== 0.00 1.00 ----Stats for q8_group_by_3---- column_names row_count distinct_count null_count @@ -252,9 +252,9 @@ column_names row_count distinct_count null_count {sum} 2 2 0 ~~~~ column_names row_count_est row_count_err distinct_count_est distinct_count_err null_count_est null_count_err -{o_year} 729.00 364.50 <== 729.00 364.50 <== 0.00 1.00 -{sum} 729.00 364.50 <== 729.00 364.50 <== 0.00 1.00 -{sum_1} 729.00 364.50 <== 729.00 364.50 <== 0.00 1.00 +{o_year} 731.00 365.50 <== 731.00 365.50 <== 0.00 1.00 +{sum} 731.00 365.50 <== 731.00 365.50 <== 0.00 1.00 +{sum_1} 731.00 365.50 <== 731.00 365.50 <== 0.00 1.00 ----Stats for q8_project_4---- column_names row_count distinct_count null_count @@ -263,9 +263,9 @@ column_names row_count distinct_count null_count {volume} 2603 2599 0 ~~~~ column_names row_count_est row_count_err distinct_count_est distinct_count_err null_count_est null_count_err -{column71} 4298.00 1.65 4281.00 39.64 <== 0.00 1.00 -{o_year} 4298.00 1.65 729.00 364.50 <== 0.00 1.00 -{volume} 4298.00 1.65 4264.00 1.64 0.00 1.00 +{column71} 3626.00 1.39 3626.00 33.57 <== 0.00 1.00 +{o_year} 3626.00 1.39 731.00 365.50 <== 0.00 1.00 +{volume} 3626.00 1.39 3626.00 1.40 0.00 1.00 ----Stats for q8_project_5---- column_names row_count distinct_count null_count @@ -274,9 +274,9 @@ column_names row_count distinct_count null_count {volume} 2603 2599 0 ~~~~ column_names row_count_est row_count_err distinct_count_est distinct_count_err null_count_est null_count_err -{n_name} 4298.00 1.65 25.00 1.00 0.00 1.00 -{o_year} 4298.00 1.65 729.00 364.50 <== 0.00 1.00 -{volume} 4298.00 1.65 4264.00 1.64 0.00 1.00 +{n_name} 3626.00 1.39 25.00 1.00 0.00 1.00 +{o_year} 3626.00 1.39 731.00 365.50 <== 0.00 1.00 +{volume} 3626.00 1.39 3626.00 1.40 0.00 1.00 ----Stats for q8_inner_join_6---- column_names row_count distinct_count null_count @@ -302,26 +302,26 @@ column_names row_count distinct_count null_count {s_suppkey} 2603 1895 0 ~~~~ column_names row_count_est row_count_err distinct_count_est distinct_count_err null_count_est null_count_err -{c_custkey} 4298.00 1.65 3981.00 1.67 0.00 1.00 -{c_nationkey} 4298.00 1.65 5.00 1.00 0.00 1.00 -{l_discount} 4298.00 1.65 11.00 1.00 0.00 1.00 -{l_extendedprice} 4298.00 1.65 4262.00 1.68 0.00 1.00 -{l_orderkey} 4298.00 1.65 4219.00 1.64 0.00 1.00 -{l_partkey} 4298.00 1.65 1335.00 1.09 0.00 1.00 -{l_suppkey} 4298.00 1.65 3488.00 1.84 0.00 1.00 -{n_name} 4298.00 1.65 25.00 1.00 0.00 1.00 -{n_nationkey} 4298.00 1.65 5.00 1.00 0.00 1.00 -{n_nationkey_1} 4298.00 1.65 25.00 1.00 0.00 1.00 -{n_regionkey} 4298.00 1.65 1.00 1.00 0.00 1.00 -{o_custkey} 4298.00 1.65 3981.00 1.67 0.00 1.00 -{o_orderdate} 4298.00 1.65 729.00 1.03 0.00 1.00 -{o_orderkey} 4298.00 1.65 4219.00 1.64 0.00 1.00 -{p_partkey} 4298.00 1.65 1335.00 1.09 0.00 1.00 -{p_type} 4298.00 1.65 1.00 1.00 0.00 1.00 -{r_name} 4298.00 1.65 1.00 1.00 0.00 1.00 -{r_regionkey} 4298.00 1.65 1.00 1.00 0.00 1.00 -{s_nationkey} 4298.00 1.65 25.00 1.00 0.00 1.00 -{s_suppkey} 4298.00 1.65 3488.00 1.84 0.00 1.00 +{c_custkey} 3626.00 1.39 3626.00 1.52 0.00 1.00 +{c_nationkey} 3626.00 1.39 5.00 1.00 0.00 1.00 +{l_discount} 3626.00 1.39 11.00 1.00 0.00 1.00 +{l_extendedprice} 3626.00 1.39 3626.00 1.43 0.00 1.00 +{l_orderkey} 3626.00 1.39 3626.00 1.41 0.00 1.00 +{l_partkey} 3626.00 1.39 1335.00 1.09 0.00 1.00 +{l_suppkey} 3626.00 1.39 3626.00 1.91 <== 0.00 1.00 +{n_name} 3626.00 1.39 25.00 1.00 0.00 1.00 +{n_nationkey} 3626.00 1.39 5.00 1.00 0.00 1.00 +{n_nationkey_1} 3626.00 1.39 25.00 1.00 0.00 1.00 +{n_regionkey} 3626.00 1.39 1.00 1.00 0.00 1.00 +{o_custkey} 3626.00 1.39 3626.00 1.52 0.00 1.00 +{o_orderdate} 3626.00 1.39 731.00 1.03 0.00 1.00 +{o_orderkey} 3626.00 1.39 3626.00 1.41 0.00 1.00 +{p_partkey} 3626.00 1.39 1335.00 1.09 0.00 1.00 +{p_type} 3626.00 1.39 1.00 1.00 0.00 1.00 +{r_name} 3626.00 1.39 1.00 1.00 0.00 1.00 +{r_regionkey} 3626.00 1.39 1.00 1.00 0.00 1.00 +{s_nationkey} 3626.00 1.39 25.00 1.00 0.00 1.00 +{s_suppkey} 3626.00 1.39 3626.00 1.91 <== 0.00 1.00 ----Stats for q8_inner_join_7---- column_names row_count distinct_count null_count @@ -345,24 +345,24 @@ column_names row_count distinct_count null_count {s_suppkey} 2603 1895 0 ~~~~ column_names row_count_est row_count_err distinct_count_est distinct_count_err null_count_est null_count_err -{c_custkey} 4113.00 1.58 3822.00 1.60 0.00 1.00 -{c_nationkey} 4113.00 1.58 5.00 1.00 0.00 1.00 -{l_discount} 4113.00 1.58 11.00 1.00 0.00 1.00 -{l_extendedprice} 4113.00 1.58 4085.00 1.61 0.00 1.00 -{l_orderkey} 4113.00 1.58 4041.00 1.57 0.00 1.00 -{l_partkey} 4113.00 1.58 1335.00 1.09 0.00 1.00 -{l_suppkey} 4113.00 1.58 3367.00 1.78 0.00 1.00 -{n_nationkey} 4113.00 1.58 5.00 1.00 0.00 1.00 -{n_regionkey} 4113.00 1.58 1.00 1.00 0.00 1.00 -{o_custkey} 4113.00 1.58 3822.00 1.60 0.00 1.00 -{o_orderdate} 4113.00 1.58 728.00 1.03 0.00 1.00 -{o_orderkey} 4113.00 1.58 4041.00 1.57 0.00 1.00 -{p_partkey} 4113.00 1.58 1335.00 1.09 0.00 1.00 -{p_type} 4113.00 1.58 1.00 1.00 0.00 1.00 -{r_name} 4113.00 1.58 1.00 1.00 0.00 1.00 -{r_regionkey} 4113.00 1.58 1.00 1.00 0.00 1.00 -{s_nationkey} 4113.00 1.58 25.00 1.00 0.00 1.00 -{s_suppkey} 4113.00 1.58 3367.00 1.78 0.00 1.00 +{c_custkey} 3626.00 1.39 3626.00 1.52 0.00 1.00 +{c_nationkey} 3626.00 1.39 5.00 1.00 0.00 1.00 +{l_discount} 3626.00 1.39 11.00 1.00 0.00 1.00 +{l_extendedprice} 3626.00 1.39 3626.00 1.43 0.00 1.00 +{l_orderkey} 3626.00 1.39 3626.00 1.41 0.00 1.00 +{l_partkey} 3626.00 1.39 1335.00 1.09 0.00 1.00 +{l_suppkey} 3626.00 1.39 3626.00 1.91 <== 0.00 1.00 +{n_nationkey} 3626.00 1.39 5.00 1.00 0.00 1.00 +{n_regionkey} 3626.00 1.39 1.00 1.00 0.00 1.00 +{o_custkey} 3626.00 1.39 3626.00 1.52 0.00 1.00 +{o_orderdate} 3626.00 1.39 731.00 1.03 0.00 1.00 +{o_orderkey} 3626.00 1.39 3626.00 1.41 0.00 1.00 +{p_partkey} 3626.00 1.39 1335.00 1.09 0.00 1.00 +{p_type} 3626.00 1.39 1.00 1.00 0.00 1.00 +{r_name} 3626.00 1.39 1.00 1.00 0.00 1.00 +{r_regionkey} 3626.00 1.39 1.00 1.00 0.00 1.00 +{s_nationkey} 3626.00 1.39 25.00 1.00 0.00 1.00 +{s_suppkey} 3626.00 1.39 3626.00 1.91 <== 0.00 1.00 ----Stats for q8_scan_8---- column_names row_count distinct_count null_count @@ -393,22 +393,22 @@ column_names row_count distinct_count null_count {r_regionkey} 2603 1 0 ~~~~ column_names row_count_est row_count_err distinct_count_est distinct_count_err null_count_est null_count_err -{c_custkey} 3858.00 1.48 3601.00 1.51 0.00 1.00 -{c_nationkey} 3858.00 1.48 5.00 1.00 0.00 1.00 -{l_discount} 3858.00 1.48 11.00 1.00 0.00 1.00 -{l_extendedprice} 3858.00 1.48 3840.00 1.51 0.00 1.00 -{l_orderkey} 3858.00 1.48 3796.00 1.48 0.00 1.00 -{l_partkey} 3858.00 1.48 1335.00 1.09 0.00 1.00 -{l_suppkey} 3858.00 1.48 3196.00 1.69 0.00 1.00 -{n_nationkey} 3858.00 1.48 5.00 1.00 0.00 1.00 -{n_regionkey} 3858.00 1.48 1.00 1.00 0.00 1.00 -{o_custkey} 3858.00 1.48 3601.00 1.51 0.00 1.00 -{o_orderdate} 3858.00 1.48 727.00 1.03 0.00 1.00 -{o_orderkey} 3858.00 1.48 3796.00 1.48 0.00 1.00 -{p_partkey} 3858.00 1.48 1335.00 1.09 0.00 1.00 -{p_type} 3858.00 1.48 1.00 1.00 0.00 1.00 -{r_name} 3858.00 1.48 1.00 1.00 0.00 1.00 -{r_regionkey} 3858.00 1.48 1.00 1.00 0.00 1.00 +{c_custkey} 3597.00 1.38 3597.00 1.51 0.00 1.00 +{c_nationkey} 3597.00 1.38 5.00 1.00 0.00 1.00 +{l_discount} 3597.00 1.38 11.00 1.00 0.00 1.00 +{l_extendedprice} 3597.00 1.38 3597.00 1.42 0.00 1.00 +{l_orderkey} 3597.00 1.38 3597.00 1.40 0.00 1.00 +{l_partkey} 3597.00 1.38 1335.00 1.09 0.00 1.00 +{l_suppkey} 3597.00 1.38 3597.00 1.90 0.00 1.00 +{n_nationkey} 3597.00 1.38 5.00 1.00 0.00 1.00 +{n_regionkey} 3597.00 1.38 1.00 1.00 0.00 1.00 +{o_custkey} 3597.00 1.38 3597.00 1.51 0.00 1.00 +{o_orderdate} 3597.00 1.38 731.00 1.03 0.00 1.00 +{o_orderkey} 3597.00 1.38 3597.00 1.40 0.00 1.00 +{p_partkey} 3597.00 1.38 1335.00 1.09 0.00 1.00 +{p_type} 3597.00 1.38 1.00 1.00 0.00 1.00 +{r_name} 3597.00 1.38 1.00 1.00 0.00 1.00 +{r_regionkey} 3597.00 1.38 1.00 1.00 0.00 1.00 ----Stats for q8_lookup_join_10---- column_names row_count distinct_count null_count @@ -420,7 +420,7 @@ column_names row_count distinct_count null_count {r_regionkey} 29952 1 0 ~~~~ column_names row_count_est row_count_err distinct_count_est distinct_count_err null_count_est null_count_err -{c_custkey} 30000.00 1.00 27672.00 1.09 0.00 1.00 +{c_custkey} 30000.00 1.00 30000.00 1.01 0.00 1.00 {c_nationkey} 30000.00 1.00 5.00 1.00 0.00 1.00 {n_nationkey} 30000.00 1.00 5.00 1.00 0.00 1.00 {n_regionkey} 30000.00 1.00 1.00 1.00 0.00 1.00 @@ -472,16 +472,16 @@ column_names row_count distinct_count null_count {p_type} 13389 1 0 ~~~~ column_names row_count_est row_count_err distinct_count_est distinct_count_err null_count_est null_count_err -{l_discount} 11920.00 1.12 11.00 1.00 0.00 1.00 -{l_extendedprice} 11920.00 1.12 11830.00 1.02 0.00 1.00 -{l_orderkey} 11920.00 1.12 11764.00 1.14 0.00 1.00 -{l_partkey} 11920.00 1.12 1335.00 1.09 0.00 1.00 -{l_suppkey} 11920.00 1.12 6937.00 1.72 0.00 1.00 -{o_custkey} 11920.00 1.12 11233.00 1.09 0.00 1.00 -{o_orderdate} 11920.00 1.12 731.00 1.00 0.00 1.00 -{o_orderkey} 11920.00 1.12 11764.00 1.14 0.00 1.00 -{p_partkey} 11920.00 1.12 1335.00 1.09 0.00 1.00 -{p_type} 11920.00 1.12 1.00 1.00 0.00 1.00 +{l_discount} 11918.00 1.12 11.00 1.00 0.00 1.00 +{l_extendedprice} 11918.00 1.12 11918.00 1.01 0.00 1.00 +{l_orderkey} 11918.00 1.12 11918.00 1.12 0.00 1.00 +{l_partkey} 11918.00 1.12 1335.00 1.09 0.00 1.00 +{l_suppkey} 11918.00 1.12 9920.00 2.45 <== 0.00 1.00 +{o_custkey} 11918.00 1.12 11918.00 1.03 0.00 1.00 +{o_orderdate} 11918.00 1.12 731.00 1.00 0.00 1.00 +{o_orderkey} 11918.00 1.12 11918.00 1.12 0.00 1.00 +{p_partkey} 11918.00 1.12 1335.00 1.09 0.00 1.00 +{p_type} 11918.00 1.12 1.00 1.00 0.00 1.00 ----Stats for q8_lookup_join_15---- column_names row_count distinct_count null_count @@ -495,10 +495,10 @@ column_names row_count distinct_count null_count ~~~~ column_names row_count_est row_count_err distinct_count_est distinct_count_err null_count_est null_count_err {l_discount} 40223.00 1.09 11.00 1.00 0.00 1.00 -{l_extendedprice} 40223.00 1.09 39362.00 1.22 0.00 1.00 -{l_orderkey} 40223.00 1.09 39698.00 1.09 0.00 1.00 +{l_extendedprice} 40223.00 1.09 40223.00 1.25 0.00 1.00 +{l_orderkey} 40223.00 1.09 40223.00 1.08 0.00 1.00 {l_partkey} 40223.00 1.09 1335.00 1.09 0.00 1.00 -{l_suppkey} 40223.00 1.09 9748.00 2.24 <== 0.00 1.00 +{l_suppkey} 40223.00 1.09 9920.00 2.28 <== 0.00 1.00 {p_partkey} 40223.00 1.09 1335.00 1.09 0.00 1.00 {p_type} 40223.00 1.09 1.00 1.00 0.00 1.00 @@ -512,7 +512,7 @@ column_names row_count distinct_count null_count ~~~~ column_names row_count_est row_count_err distinct_count_est distinct_count_err null_count_est null_count_err {l_linenumber} 40223.00 1.09 7.00 1.00 0.00 1.00 -{l_orderkey} 40223.00 1.09 39698.00 1.09 0.00 1.00 +{l_orderkey} 40223.00 1.09 40223.00 1.08 0.00 1.00 {l_partkey} 40223.00 1.09 1335.00 1.09 0.00 1.00 {p_partkey} 40223.00 1.09 1335.00 1.09 0.00 1.00 {p_type} 40223.00 1.09 1.00 1.00 0.00 1.00 diff --git a/pkg/sql/opt/memo/testdata/stats_quality/tpch/q09 b/pkg/sql/opt/memo/testdata/stats_quality/tpch/q09 index bb40a56a3e0d..b3e8c77b14f7 100644 --- a/pkg/sql/opt/memo/testdata/stats_quality/tpch/q09 +++ b/pkg/sql/opt/memo/testdata/stats_quality/tpch/q09 @@ -54,376 +54,375 @@ ORDER BY o_year DESC; ---- ---- -sort - ├── save-table-name: q9_sort_1 +group-by + ├── save-table-name: q9_group_by_1 ├── columns: nation:53(char!null) o_year:57(float) sum_profit:59(float!null) + ├── grouping columns: n_name:53(char!null) o_year:57(float) ├── immutable - ├── stats: [rows=1548.49892, distinct(53)=25, null(53)=0, distinct(57)=957.145308, null(57)=0, distinct(59)=1548.49892, null(59)=0, distinct(53,57)=1548.49892, null(53,57)=0] + ├── stats: [rows=2448.65227, distinct(53)=25, null(53)=0, distinct(57)=2406, null(57)=0, distinct(59)=2448.65227, null(59)=0, distinct(53,57)=2448.65227, null(53,57)=0] ├── key: (53,57) ├── fd: (53,57)-->(59) ├── ordering: +53,-57 - └── group-by - ├── save-table-name: q9_group_by_2 - ├── columns: n_name:53(char!null) o_year:57(float) sum:59(float!null) - ├── grouping columns: n_name:53(char!null) o_year:57(float) - ├── immutable - ├── stats: [rows=1548.49892, distinct(53)=25, null(53)=0, distinct(57)=957.145308, null(57)=0, distinct(59)=1548.49892, null(59)=0, distinct(53,57)=1548.49892, null(53,57)=0] - ├── key: (53,57) - ├── fd: (53,57)-->(59) - ├── project - │ ├── save-table-name: q9_project_3 - │ ├── columns: o_year:57(float) amount:58(float!null) n_name:53(char!null) - │ ├── immutable - │ ├── stats: [rows=2450.41631, distinct(53)=25, null(53)=0, distinct(57)=957.145308, null(57)=0, distinct(58)=958.326364, null(58)=0, distinct(53,57)=1548.49892, null(53,57)=0] - │ ├── inner-join (hash) - │ │ ├── save-table-name: q9_inner_join_4 - │ │ ├── columns: p_partkey:1(int!null) p_name:2(varchar!null) s_suppkey:11(int!null) s_nationkey:14(int!null) l_orderkey:19(int!null) l_partkey:20(int!null) l_suppkey:21(int!null) l_quantity:23(float!null) l_extendedprice:24(float!null) l_discount:25(float!null) ps_partkey:36(int!null) ps_suppkey:37(int!null) ps_supplycost:39(float!null) o_orderkey:42(int!null) o_orderdate:46(date!null) n_nationkey:52(int!null) n_name:53(char!null) - │ │ ├── multiplicity: left-rows(exactly-one), right-rows(zero-or-more) - │ │ ├── stats: [rows=2450.41631, distinct(1)=1065.01249, null(1)=0, distinct(2)=2405.94672, null(2)=0, distinct(11)=1064.52386, null(11)=0, distinct(14)=25, null(14)=0, distinct(19)=1066.4323, null(19)=0, distinct(20)=1065.01249, null(20)=0, distinct(21)=1064.52386, null(21)=0, distinct(23)=50, null(23)=0, distinct(24)=958.164832, null(24)=0, distinct(25)=11, null(25)=0, distinct(36)=958.326364, null(36)=0, distinct(37)=958.326364, null(37)=0, distinct(39)=956.829183, null(39)=0, distinct(42)=1066.4323, null(42)=0, distinct(46)=957.145308, null(46)=0, distinct(52)=25, null(52)=0, distinct(53)=25, null(53)=0, distinct(46,53)=1548.49892, null(46,53)=0, distinct(23-25,39)=958.326364, null(23-25,39)=0] - │ │ ├── fd: (1)-->(2), (11)-->(14), (36,37)-->(39), (21)==(11,37), (37)==(11,21), (20)==(1,36), (36)==(1,20), (42)-->(46), (19)==(42), (42)==(19), (11)==(21,37), (52)-->(53), (14)==(52), (52)==(14), (1)==(20,36) - │ │ ├── inner-join (hash) - │ │ │ ├── save-table-name: q9_inner_join_5 - │ │ │ ├── columns: p_partkey:1(int!null) p_name:2(varchar!null) s_suppkey:11(int!null) s_nationkey:14(int!null) l_orderkey:19(int!null) l_partkey:20(int!null) l_suppkey:21(int!null) l_quantity:23(float!null) l_extendedprice:24(float!null) l_discount:25(float!null) ps_partkey:36(int!null) ps_suppkey:37(int!null) ps_supplycost:39(float!null) o_orderkey:42(int!null) o_orderdate:46(date!null) - │ │ │ ├── multiplicity: left-rows(zero-or-more), right-rows(exactly-one) - │ │ │ ├── stats: [rows=2450.41631, distinct(1)=1223.84511, null(1)=0, distinct(2)=2405.94672, null(2)=0, distinct(11)=1224.18162, null(11)=0, distinct(14)=25, null(14)=0, distinct(19)=1227.35103, null(19)=0, distinct(20)=1223.84511, null(20)=0, distinct(21)=1224.18162, null(21)=0, distinct(23)=50, null(23)=0, distinct(24)=1058.34962, null(24)=0, distinct(25)=11, null(25)=0, distinct(36)=1058.5867, null(36)=0, distinct(37)=1058.5867, null(37)=0, distinct(39)=1056.39091, null(39)=0, distinct(42)=1227.35103, null(42)=0, distinct(46)=1056.85425, null(46)=0] - │ │ │ ├── fd: (1)-->(2), (11)-->(14), (36,37)-->(39), (21)==(11,37), (37)==(11,21), (20)==(1,36), (36)==(1,20), (42)-->(46), (19)==(42), (42)==(19), (11)==(21,37), (1)==(20,36) - │ │ │ ├── scan supplier@s_nk - │ │ │ │ ├── save-table-name: q9_scan_6 - │ │ │ │ ├── columns: s_suppkey:11(int!null) s_nationkey:14(int!null) - │ │ │ │ ├── stats: [rows=10000, distinct(11)=9920, null(11)=0, distinct(14)=25, null(14)=0] - │ │ │ │ │ histogram(11)= 0 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 50 1 50 1 50 1 50 1 50 1 50 1 50 1 50 1 50 1 50 1 50 1 50 1 50 1 50 1 50 1 50 1 50 1 50 1 50 1 50 1 50 1 50 1 50 1 50 1 50 1 50 1 50 1 50 1 50 1 50 1 50 1 50 1 50 1 50 1 50 1 50 1 50 1 50 1 50 1 50 1 50 1 50 1 50 1 50 1 50 1 50 1 50 1 50 1 50 1 - │ │ │ │ │ <--- 1 ---- 51 ---- 101 ---- 151 ---- 201 ---- 251 ---- 301 ---- 351 ---- 401 ---- 451 ---- 501 ---- 551 ---- 601 ---- 651 ---- 701 ---- 751 ---- 801 ---- 851 ---- 901 ---- 951 ---- 1001 ---- 1051 ---- 1101 ---- 1151 ---- 1201 ---- 1251 ---- 1301 ---- 1351 ---- 1401 ---- 1451 ---- 1501 ---- 1551 ---- 1601 ---- 1651 ---- 1701 ---- 1751 ---- 1801 ---- 1851 ---- 1901 ---- 1951 ---- 2001 ---- 2051 ---- 2101 ---- 2151 ---- 2201 ---- 2251 ---- 2301 ---- 2351 ---- 2401 ---- 2451 ---- 2501 ---- 2551 ---- 2601 ---- 2651 ---- 2701 ---- 2751 ---- 2801 ---- 2851 ---- 2901 ---- 2951 ---- 3001 ---- 3051 ---- 3101 ---- 3151 ---- 3201 ---- 3251 ---- 3301 ---- 3351 ---- 3401 ---- 3451 ---- 3501 ---- 3551 ---- 3601 ---- 3651 ---- 3701 ---- 3751 ---- 3801 ---- 3851 ---- 3901 ---- 3951 ---- 4001 ---- 4051 ---- 4101 ---- 4151 ---- 4201 ---- 4251 ---- 4301 ---- 4351 ---- 4401 ---- 4451 ---- 4501 ---- 4551 ---- 4601 ---- 4651 ---- 4701 ---- 4751 ---- 4801 ---- 4851 ---- 4901 ---- 4951 ---- 5001 ---- 5051 ---- 5101 ---- 5151 ---- 5201 ---- 5251 ---- 5301 ---- 5351 ---- 5401 ---- 5451 ---- 5501 ---- 5551 ---- 5601 ---- 5651 ---- 5701 ---- 5751 ---- 5801 ---- 5851 ---- 5901 ---- 5951 ---- 6001 ---- 6051 ---- 6101 ---- 6151 ---- 6201 ---- 6251 ---- 6301 ---- 6351 ---- 6401 ---- 6451 ---- 6501 ---- 6551 ---- 6601 ---- 6651 ---- 6701 ---- 6751 ---- 6801 ---- 6851 ---- 6901 ---- 6951 ---- 7001 ---- 7051 ---- 7101 ---- 7151 ---- 7201 ---- 7251 ---- 7301 ---- 7351 ---- 7401 ---- 7451 ---- 7501 ---- 7552 ---- 7603 ---- 7654 ---- 7705 ---- 7756 ---- 7807 ---- 7858 ---- 7909 ---- 7960 ---- 8011 ---- 8062 ---- 8113 ---- 8164 ---- 8215 ---- 8266 ---- 8317 ---- 8368 ---- 8419 ---- 8470 ---- 8521 ---- 8572 ---- 8623 ---- 8674 ---- 8725 ---- 8776 ---- 8827 ---- 8878 ---- 8929 ---- 8980 ---- 9031 ---- 9082 ---- 9133 ---- 9184 ---- 9235 ---- 9286 ---- 9337 ---- 9388 ---- 9439 ---- 9490 ---- 9541 ---- 9592 ---- 9643 ---- 9694 ---- 9745 ---- 9796 ---- 9847 ---- 9898 ---- 9949 ---- 10000 - │ │ │ │ │ histogram(14)= 0 420 0 413 0 397 0 412 0 415 0 380 0 402 0 396 0 415 0 405 0 393 0 438 0 377 0 362 0 376 0 373 0 406 0 421 0 407 0 398 0 411 0 399 0 401 0 390 0 393 - │ │ │ │ │ <--- 0 --- 1 --- 2 --- 3 --- 4 --- 5 --- 6 --- 7 --- 8 --- 9 --- 10 --- 11 --- 12 --- 13 --- 14 --- 15 --- 16 --- 17 --- 18 --- 19 --- 20 --- 21 --- 22 --- 23 --- 24 - │ │ │ │ ├── key: (11) - │ │ │ │ └── fd: (11)-->(14) - │ │ │ ├── inner-join (lookup orders) - │ │ │ │ ├── save-table-name: q9_lookup_join_7 - │ │ │ │ ├── columns: p_partkey:1(int!null) p_name:2(varchar!null) l_orderkey:19(int!null) l_partkey:20(int!null) l_suppkey:21(int!null) l_quantity:23(float!null) l_extendedprice:24(float!null) l_discount:25(float!null) ps_partkey:36(int!null) ps_suppkey:37(int!null) ps_supplycost:39(float!null) o_orderkey:42(int!null) o_orderdate:46(date!null) - │ │ │ │ ├── key columns: [19] = [42] - │ │ │ │ ├── lookup columns are key - │ │ │ │ ├── stats: [rows=2430.81298, distinct(1)=1535.46099, null(1)=0, distinct(2)=2387.04794, null(2)=0, distinct(19)=1535.60004, null(19)=0, distinct(20)=1535.46099, null(20)=0, distinct(21)=1220.18199, null(21)=0, distinct(23)=50, null(23)=0, distinct(24)=1219.78652, null(24)=0, distinct(25)=11, null(25)=0, distinct(36)=1220.18199, null(36)=0, distinct(37)=1220.18199, null(37)=0, distinct(39)=1216.52365, null(39)=0, distinct(42)=1535.60004, null(42)=0, distinct(46)=1217.29478, null(46)=0] - │ │ │ │ ├── fd: (1)-->(2), (36,37)-->(39), (21)==(37), (37)==(21), (20)==(1,36), (36)==(1,20), (42)-->(46), (19)==(42), (42)==(19), (1)==(20,36) - │ │ │ │ ├── inner-join (lookup lineitem) - │ │ │ │ │ ├── save-table-name: q9_lookup_join_8 - │ │ │ │ │ ├── columns: p_partkey:1(int!null) p_name:2(varchar!null) l_orderkey:19(int!null) l_partkey:20(int!null) l_suppkey:21(int!null) l_quantity:23(float!null) l_extendedprice:24(float!null) l_discount:25(float!null) ps_partkey:36(int!null) ps_suppkey:37(int!null) ps_supplycost:39(float!null) - │ │ │ │ │ ├── key columns: [19 22] = [19 22] - │ │ │ │ │ ├── lookup columns are key - │ │ │ │ │ ├── stats: [rows=2430.81298, distinct(1)=2429.06305, null(1)=0, distinct(2)=2387.04794, null(2)=0, distinct(19)=1535.60004, null(19)=0, distinct(20)=2429.06305, null(20)=0, distinct(21)=1536.11093, null(21)=0, distinct(23)=50, null(23)=0, distinct(24)=1535.26821, null(24)=0, distinct(25)=11, null(25)=0, distinct(36)=1536.11093, null(36)=0, distinct(37)=1536.11093, null(37)=0, distinct(39)=1528.33438, null(39)=0] - │ │ │ │ │ ├── fd: (1)-->(2), (36,37)-->(39), (21)==(37), (37)==(21), (20)==(1,36), (36)==(1,20), (1)==(20,36) - │ │ │ │ │ ├── inner-join (lookup lineitem@l_pk_sk) - │ │ │ │ │ │ ├── save-table-name: q9_lookup_join_9 - │ │ │ │ │ │ ├── columns: p_partkey:1(int!null) p_name:2(varchar!null) l_orderkey:19(int!null) l_partkey:20(int!null) l_suppkey:21(int!null) l_linenumber:22(int!null) ps_partkey:36(int!null) ps_suppkey:37(int!null) ps_supplycost:39(float!null) - │ │ │ │ │ │ ├── key columns: [36 37] = [20 21] - │ │ │ │ │ │ ├── stats: [rows=812.772154, distinct(1)=807.83427, null(1)=0, distinct(2)=807.74754, null(2)=0, distinct(19)=812.555998, null(19)=0, distinct(20)=812.772154, null(20)=0, distinct(21)=812.772154, null(21)=0, distinct(22)=7, null(22)=0, distinct(36)=812.772154, null(36)=0, distinct(37)=812.772154, null(37)=0, distinct(39)=809.246246, null(39)=0] - │ │ │ │ │ │ ├── key: (19,22) - │ │ │ │ │ │ ├── fd: (1)-->(2), (36,37)-->(39), (1)==(20,36), (36)==(1,20), (19,22)-->(20,21), (20)==(1,36), (21)==(37), (37)==(21) - │ │ │ │ │ │ ├── inner-join (merge) - │ │ │ │ │ │ │ ├── save-table-name: q9_merge_join_10 - │ │ │ │ │ │ │ ├── columns: p_partkey:1(int!null) p_name:2(varchar!null) ps_partkey:36(int!null) ps_suppkey:37(int!null) ps_supplycost:39(float!null) - │ │ │ │ │ │ │ ├── left ordering: +1 - │ │ │ │ │ │ │ ├── right ordering: +36 - │ │ │ │ │ │ │ ├── stats: [rows=267682.522, distinct(1)=66618.6736, null(1)=0, distinct(2)=65464.1012, null(2)=0, distinct(36)=66618.6736, null(36)=0, distinct(37)=9920, null(37)=0, distinct(39)=93404.7278, null(39)=0] - │ │ │ │ │ │ │ ├── key: (36,37) - │ │ │ │ │ │ │ ├── fd: (1)-->(2), (36,37)-->(39), (1)==(36), (36)==(1) - │ │ │ │ │ │ │ ├── select - │ │ │ │ │ │ │ │ ├── save-table-name: q9_select_11 - │ │ │ │ │ │ │ │ ├── columns: p_partkey:1(int!null) p_name:2(varchar!null) - │ │ │ │ │ │ │ │ ├── stats: [rows=66666.6667, distinct(1)=66618.6736, null(1)=0, distinct(2)=66666.6667, null(2)=0] - │ │ │ │ │ │ │ │ ├── key: (1) - │ │ │ │ │ │ │ │ ├── fd: (1)-->(2) - │ │ │ │ │ │ │ │ ├── ordering: +1 - │ │ │ │ │ │ │ │ ├── scan part - │ │ │ │ │ │ │ │ │ ├── save-table-name: q9_scan_12 - │ │ │ │ │ │ │ │ │ ├── columns: p_partkey:1(int!null) p_name:2(varchar!null) - │ │ │ │ │ │ │ │ │ ├── stats: [rows=200000, distinct(1)=199241, null(1)=0, distinct(2)=198131, null(2)=0] - │ │ │ │ │ │ │ │ │ │ histogram(1)= 0 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 1000 20 1000 20 1000 20 1000 20 1000 20 1000 20 1000 20 1000 20 1000 20 1000 20 1000 20 1000 20 1000 20 1000 20 1000 20 1000 20 1000 20 1000 20 1000 20 1000 20 1000 20 1000 20 1000 20 1000 20 1000 20 1000 20 1000 20 1000 20 1000 20 1000 20 1000 20 1000 20 1000 20 1000 20 1000 20 1000 20 1000 20 1000 20 1000 20 1000 20 1000 20 1000 20 1000 20 1000 20 1000 20 1000 20 1000 20 1000 20 1000 20 - │ │ │ │ │ │ │ │ │ │ <--- 11 ----- 728 ----- 1645 ----- 2631 ----- 3709 ----- 4776 ----- 5561 ----- 6561 ----- 7453 ----- 8507 ----- 9391 ----- 10246 ----- 11291 ----- 12247 ----- 13190 ----- 14162 ----- 15360 ----- 16279 ----- 17470 ----- 18268 ----- 19116 ----- 20021 ----- 20910 ----- 21722 ----- 22568 ----- 23525 ----- 24605 ----- 25518 ----- 26552 ----- 27774 ----- 28571 ----- 29469 ----- 30689 ----- 31727 ----- 32646 ----- 33512 ----- 34737 ----- 35503 ----- 36365 ----- 37320 ----- 38146 ----- 39374 ----- 40214 ----- 41258 ----- 42381 ----- 43414 ----- 44505 ----- 45498 ----- 46687 ----- 47357 ----- 48402 ----- 49289 ----- 50503 ----- 51267 ----- 52365 ----- 53360 ----- 54114 ----- 54992 ----- 56028 ----- 56976 ----- 57919 ----- 58684 ----- 59544 ----- 60362 ----- 61372 ----- 62402 ----- 63261 ----- 64284 ----- 65157 ----- 66431 ----- 67649 ----- 68642 ----- 69759 ----- 70717 ----- 71768 ----- 72812 ----- 73928 ----- 75069 ----- 76089 ----- 77188 ----- 78003 ----- 79079 ----- 79895 ----- 80931 ----- 81904 ----- 82866 ----- 83812 ----- 84882 ----- 85743 ----- 86558 ----- 87686 ----- 88864 ----- 89834 ----- 90952 ----- 91855 ----- 92815 ----- 93983 ----- 95122 ----- 96110 ----- 97232 ----- 98327 ----- 99529 ----- 100662 ----- 101582 ----- 102475 ----- 103543 ----- 104588 ----- 105673 ----- 106646 ----- 107885 ----- 108848 ----- 109913 ----- 111053 ----- 111992 ----- 112875 ----- 113729 ----- 114830 ----- 115985 ----- 117017 ----- 118197 ----- 119027 ----- 119897 ----- 120979 ----- 122225 ----- 123339 ----- 124326 ----- 125507 ----- 126742 ----- 127739 ----- 128929 ----- 129766 ----- 130824 ----- 131780 ----- 132832 ----- 133849 ----- 134968 ----- 135887 ----- 136981 ----- 138203 ----- 139167 ----- 140214 ----- 141310 ----- 142333 ----- 143119 ----- 144146 ----- 145323 ----- 146333 ----- 147232 ----- 148140 ----- 148972 ----- 150048 ------ 151418 ------ 152456 ------ 153742 ------ 154633 ------ 155602 ------ 156660 ------ 157544 ------ 158653 ------ 159749 ------ 160523 ------ 161563 ------ 162605 ------ 163645 ------ 164720 ------ 165585 ------ 166792 ------ 167795 ------ 168739 ------ 169589 ------ 170526 ------ 171884 ------ 172894 ------ 173761 ------ 174914 ------ 176104 ------ 177260 ------ 178143 ------ 179073 ------ 179850 ------ 180913 ------ 181781 ------ 182661 ------ 183485 ------ 184505 ------ 185790 ------ 187010 ------ 187993 ------ 188916 ------ 190000 ------ 190931 ------ 192079 ------ 193006 ------ 193932 ------ 195013 ------ 196008 ------ 196799 ------ 197766 ------ 198943 ------ 199965 - │ │ │ │ │ │ │ │ │ │ histogram(2)= 0 20 1.9996e+05 20 - │ │ │ │ │ │ │ │ │ │ <--- 'almond antique cyan lawn pale' ------------ 'yellow white ghost lavender salmon' - │ │ │ │ │ │ │ │ │ ├── key: (1) - │ │ │ │ │ │ │ │ │ ├── fd: (1)-->(2) - │ │ │ │ │ │ │ │ │ └── ordering: +1 - │ │ │ │ │ │ │ │ └── filters - │ │ │ │ │ │ │ │ └── p_name:2 LIKE '%green%' [type=bool, outer=(2), constraints=(/2: (/NULL - ])] - │ │ │ │ │ │ │ ├── scan partsupp - │ │ │ │ │ │ │ │ ├── save-table-name: q9_scan_13 - │ │ │ │ │ │ │ │ ├── columns: ps_partkey:36(int!null) ps_suppkey:37(int!null) ps_supplycost:39(float!null) - │ │ │ │ │ │ │ │ ├── stats: [rows=800000, distinct(36)=199241, null(36)=0, distinct(37)=9920, null(37)=0, distinct(39)=100379, null(39)=0] - │ │ │ │ │ │ │ │ │ histogram(36)= 0 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3840 160 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3840 160 3920 80 3920 80 3920 160 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 160 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 160 3920 80 3920 80 3920 80 3920 80 4000 80 4000 80 4000 80 4000 80 4000 80 4000 80 4000 80 4000 80 4000 80 4000 80 4000 80 4000 80 4000 80 4000 80 4000 80 4000 80 4000 80 4000 80 4000 80 4000 80 4000 80 4000 80 4000 80 4000 80 4000 80 4000 80 4000 80 4000 80 4000 80 4000 80 4000 80 4000 80 4000 80 4000 80 4000 80 4000 80 4000 80 4000 80 4000 80 4000 80 4000 80 4000 80 4000 80 4000 80 4000 80 4000 80 - │ │ │ │ │ │ │ │ │ <--- 11 ------ 765 ------ 1954 ------ 3094 ------ 4311 ------ 5377 ------ 6431 ------ 7396 ------ 8288 ------ 9272 ------ 10101 ------ 11159 ------ 12287 ------ 13216 ------ 14316 ------ 15503 ------ 16605 ------ 17726 ------ 18717 ------ 19542 ------ 20537 ------ 21666 ------ 22752 ------ 23971 ------ 24995 ------ 25994 ------ 26842 ------ 27390 ------ 28440 ------ 29526 ------ 30460 ------ 31515 ------ 32312 ------ 33159 ------ 33972 ------ 34884 ------ 35855 ------ 36884 ------ 38010 ------ 39033 ------ 39975 ------ 41212 ------ 42073 ------ 42782 ------ 43708 ------ 44715 ------ 45878 ------ 47111 ------ 48039 ------ 49002 ------ 50120 ------ 51213 ------ 52110 ------ 53025 ------ 53839 ------ 54936 ------ 55856 ------ 56820 ------ 58014 ------ 59079 ------ 59981 ------ 60972 ------ 62028 ------ 63090 ------ 64027 ------ 64909 ------ 65916 ------ 66861 ------ 67912 ------ 68977 ------ 70169 ------ 71156 ------ 72183 ------ 73210 ------ 74218 ------ 75126 ------ 76182 ------ 77201 ------ 78004 ------ 78975 ------ 79993 ------ 80986 ------ 81978 ------ 82761 ------ 83782 ------ 84946 ------ 85946 ------ 86808 ------ 87656 ------ 88587 ------ 89454 ------ 90799 ------ 91730 ------ 92853 ------ 93711 ------ 94565 ------ 95544 ------ 96591 ------ 97578 ------ 98568 ------ 99475 ------ 100626 ------ 101679 ------ 102802 ------ 103800 ------ 104901 ------ 105678 ------ 106420 ------ 107335 ------ 108666 ------ 109855 ------ 110808 ------ 111732 ------ 112497 ------ 113432 ------ 114405 ------ 115440 ------ 116504 ------ 117316 ------ 118321 ------ 119068 ------ 119846 ------ 120926 ------ 122077 ------ 122949 ------ 123943 ------ 124937 ------ 126233 ------ 127250 ------ 128140 ------ 129049 ------ 129887 ------ 130876 ------ 131726 ------ 132511 ------ 133477 ------ 134247 ------ 135281 ------ 136204 ------ 137302 ------ 138754 ------ 140003 ------ 140831 ------ 141666 ------ 142617 ------ 143565 ------ 144737 ------ 145910 ------ 146952 ------ 147912 ------ 148781 ------ 149766 ------ 150631 ------ 151819 ------ 152865 ------ 153895 ------ 154813 ------ 155710 ------ 156815 ------ 157926 ------ 159092 ------ 160005 ------ 161023 ------ 162111 ------ 163183 ------ 164159 ------ 165338 ------ 166253 ------ 167290 ------ 168099 ------ 169524 ------ 170467 ------ 171236 ------ 172225 ------ 173089 ------ 174101 ------ 175241 ------ 176102 ------ 176969 ------ 178074 ------ 178858 ------ 179838 ------ 181097 ------ 182021 ------ 182950 ------ 184039 ------ 184907 ------ 185995 ------ 187520 ------ 188513 ------ 189558 ------ 190767 ------ 192126 ------ 193405 ------ 194495 ------ 195462 ------ 196564 ------ 197793 ------ 198874 ------ 199967 - │ │ │ │ │ │ │ │ │ histogram(37)= 0 80 3840 160 3920 80 3840 160 3920 160 3920 80 3840 160 3920 240 3920 80 3920 80 3920 80 3920 240 3920 80 3760 240 3920 80 3920 80 3920 80 3920 80 3920 320 3920 80 3680 320 3920 160 3920 80 3920 80 3840 160 3920 160 3840 160 3920 80 3920 80 3920 80 3920 160 3920 240 3920 80 3840 160 3920 80 3840 240 3920 160 3920 160 3840 160 3920 240 3840 320 3760 240 3840 160 3840 160 3920 240 3920 80 3840 240 3680 480 3920 80 3920 80 3920 80 3920 160 3920 160 3920 80 3920 80 3920 160 3760 320 3840 320 3920 320 3920 80 3920 160 3920 80 3840 160 3840 160 3920 80 3920 80 3920 240 3760 240 3920 160 3920 160 3920 80 3840 160 3920 160 3840 320 3920 80 3920 80 3920 240 3920 160 3920 160 3920 240 3920 80 3920 240 3680 400 3680 320 3840 80 3840 160 3760 240 3840 80 3840 320 3840 160 3840 80 3840 240 3840 80 3840 160 3840 80 3840 240 3760 240 3760 160 3920 80 3840 240 3840 80 3920 80 3920 160 3840 160 3840 80 3760 320 3840 80 3920 80 3920 80 3920 80 3920 320 3840 80 3840 80 3840 160 3760 240 3840 160 3840 80 3920 80 3840 240 3760 160 3840 160 3840 160 3760 240 3760 240 3840 160 3840 160 3920 80 3840 160 3840 160 3840 160 3760 240 3760 240 3920 240 3840 80 3840 80 3920 80 3920 160 3760 160 3840 160 3920 80 3600 480 3760 160 3920 80 3920 80 3840 240 3840 160 3680 240 3680 320 3920 240 3760 160 3840 80 3920 160 3760 320 3840 160 3840 80 3840 80 3920 80 3920 160 3840 320 3760 160 3840 240 3840 80 3760 160 3680 240 3920 160 3840 80 3840 240 3680 240 3920 160 3840 80 3920 160 3760 160 3920 160 3840 80 3760 240 3920 160 3840 80 3920 80 3920 80 3920 80 3920 80 3680 320 3760 240 3920 80 3920 80 3920 160 3760 160 3840 240 3840 160 3840 80 3760 240 3920 80 3600 400 3920 80 3920 80 3840 160 3920 80 3920 160 3600 320 3920 80 - │ │ │ │ │ │ │ │ │ <--- 1 ------ 57 ------ 119 ------ 176 ------ 228 ------ 277 ------ 315 ------ 390 ------ 437 ------ 479 ------ 517 ------ 568 ------ 626 ------ 678 ------ 728 ------ 785 ------ 850 ------ 900 ------ 965 ------ 1015 ------ 1056 ------ 1101 ------ 1152 ------ 1194 ------ 1236 ------ 1282 ------ 1331 ------ 1389 ------ 1456 ------ 1505 ------ 1555 ------ 1605 ------ 1650 ------ 1710 ------ 1762 ------ 1806 ------ 1855 ------ 1911 ------ 1959 ------ 2021 ------ 2076 ------ 2120 ------ 2169 ------ 2218 ------ 2284 ------ 2324 ------ 2365 ------ 2412 ------ 2474 ------ 2524 ------ 2568 ------ 2620 ------ 2665 ------ 2719 ------ 2781 ------ 2831 ------ 2884 ------ 2926 ------ 2973 ------ 3012 ------ 3071 ------ 3112 ------ 3158 ------ 3209 ------ 3250 ------ 3313 ------ 3366 ------ 3414 ------ 3463 ------ 3514 ------ 3557 ------ 3608 ------ 3668 ------ 3713 ------ 3777 ------ 3827 ------ 3882 ------ 3938 ------ 3989 ------ 4036 ------ 4084 ------ 4134 ------ 4182 ------ 4231 ------ 4292 ------ 4337 ------ 4382 ------ 4426 ------ 4474 ------ 4521 ------ 4568 ------ 4614 ------ 4651 ------ 4695 ------ 4742 ------ 4800 ------ 4853 ------ 4905 ------ 4954 ------ 4997 ------ 5050 ------ 5115 ------ 5167 ------ 5231 ------ 5276 ------ 5325 ------ 5371 ------ 5419 ------ 5484 ------ 5547 ------ 5586 ------ 5636 ------ 5685 ------ 5744 ------ 5799 ------ 5855 ------ 5894 ------ 5938 ------ 5984 ------ 6038 ------ 6085 ------ 6143 ------ 6196 ------ 6257 ------ 6306 ------ 6350 ------ 6395 ------ 6445 ------ 6497 ------ 6556 ------ 6596 ------ 6636 ------ 6684 ------ 6744 ------ 6799 ------ 6844 ------ 6894 ------ 6947 ------ 6994 ------ 7048 ------ 7104 ------ 7149 ------ 7199 ------ 7248 ------ 7288 ------ 7343 ------ 7391 ------ 7446 ------ 7492 ------ 7538 ------ 7598 ------ 7650 ------ 7702 ------ 7767 ------ 7799 ------ 7849 ------ 7898 ------ 7941 ------ 7989 ------ 8041 ------ 8086 ------ 8127 ------ 8169 ------ 8216 ------ 8263 ------ 8326 ------ 8374 ------ 8413 ------ 8465 ------ 8521 ------ 8579 ------ 8631 ------ 8680 ------ 8732 ------ 8783 ------ 8832 ------ 8888 ------ 8945 ------ 8997 ------ 9052 ------ 9106 ------ 9136 ------ 9193 ------ 9234 ------ 9279 ------ 9326 ------ 9381 ------ 9426 ------ 9471 ------ 9519 ------ 9552 ------ 9609 ------ 9660 ------ 9716 ------ 9762 ------ 9815 ------ 9863 ------ 9910 ------ 9948 ------ 10000 - │ │ │ │ │ │ │ │ │ histogram(39)= 0 80 7.9984e+05 80 - │ │ │ │ │ │ │ │ │ <--- 1.37 ------------ 1000.0 - │ │ │ │ │ │ │ │ ├── key: (36,37) - │ │ │ │ │ │ │ │ ├── fd: (36,37)-->(39) - │ │ │ │ │ │ │ │ └── ordering: +36 - │ │ │ │ │ │ │ └── filters (true) - │ │ │ │ │ │ └── filters (true) - │ │ │ │ │ └── filters (true) - │ │ │ │ └── filters (true) - │ │ │ └── filters - │ │ │ └── s_suppkey:11 = l_suppkey:21 [type=bool, outer=(11,21), constraints=(/11: (/NULL - ]; /21: (/NULL - ]), fd=(11)==(21), (21)==(11)] - │ │ ├── scan nation - │ │ │ ├── save-table-name: q9_scan_14 - │ │ │ ├── columns: n_nationkey:52(int!null) n_name:53(char!null) - │ │ │ ├── stats: [rows=25, distinct(52)=25, null(52)=0, distinct(53)=25, null(53)=0] - │ │ │ │ histogram(52)= 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 - │ │ │ │ <--- 0 --- 1 --- 2 --- 3 --- 4 --- 5 --- 6 --- 7 --- 8 --- 9 --- 10 --- 11 --- 12 --- 13 --- 14 --- 15 --- 16 --- 17 --- 18 --- 19 --- 20 --- 21 --- 22 --- 23 --- 24 - │ │ │ │ histogram(53)= 0 1 23 1 - │ │ │ │ <--- 'ALGERIA' ---- 'VIETNAM' - │ │ │ ├── key: (52) - │ │ │ └── fd: (52)-->(53) - │ │ └── filters - │ │ └── s_nationkey:14 = n_nationkey:52 [type=bool, outer=(14,52), constraints=(/14: (/NULL - ]; /52: (/NULL - ]), fd=(14)==(52), (52)==(14)] - │ └── projections - │ ├── extract('year', o_orderdate:46) [as=o_year:57, type=float, outer=(46), immutable] - │ └── (l_extendedprice:24 * (1.0 - l_discount:25)) - (ps_supplycost:39 * l_quantity:23) [as=amount:58, type=float, outer=(23-25,39), immutable] - └── aggregations - └── sum [as=sum:59, type=float, outer=(58)] - └── amount:58 [type=float] + ├── sort + │ ├── save-table-name: q9_sort_2 + │ ├── columns: n_name:53(char!null) o_year:57(float) amount:58(float!null) + │ ├── immutable + │ ├── stats: [rows=2450.41631, distinct(53)=25, null(53)=0, distinct(57)=2406, null(57)=0, distinct(58)=2429.06305, null(58)=0, distinct(53,57)=2448.65227, null(53,57)=0] + │ ├── ordering: +53,-57 + │ └── project + │ ├── save-table-name: q9_project_3 + │ ├── columns: o_year:57(float) amount:58(float!null) n_name:53(char!null) + │ ├── immutable + │ ├── stats: [rows=2450.41631, distinct(53)=25, null(53)=0, distinct(57)=2406, null(57)=0, distinct(58)=2429.06305, null(58)=0, distinct(53,57)=2448.65227, null(53,57)=0] + │ ├── inner-join (hash) + │ │ ├── save-table-name: q9_inner_join_4 + │ │ ├── columns: p_partkey:1(int!null) p_name:2(varchar!null) s_suppkey:11(int!null) s_nationkey:14(int!null) l_orderkey:19(int!null) l_partkey:20(int!null) l_suppkey:21(int!null) l_quantity:23(float!null) l_extendedprice:24(float!null) l_discount:25(float!null) ps_partkey:36(int!null) ps_suppkey:37(int!null) ps_supplycost:39(float!null) o_orderkey:42(int!null) o_orderdate:46(date!null) n_nationkey:52(int!null) n_name:53(char!null) + │ │ ├── multiplicity: left-rows(exactly-one), right-rows(zero-or-more) + │ │ ├── stats: [rows=2450.41631, distinct(1)=2429.06305, null(1)=0, distinct(2)=2450.41631, null(2)=0, distinct(11)=2429.06305, null(11)=0, distinct(14)=25, null(14)=0, distinct(19)=2429.06305, null(19)=0, distinct(20)=2429.06305, null(20)=0, distinct(21)=2429.06305, null(21)=0, distinct(23)=50, null(23)=0, distinct(24)=2429.06305, null(24)=0, distinct(25)=11, null(25)=0, distinct(36)=2429.06305, null(36)=0, distinct(37)=2429.06305, null(37)=0, distinct(39)=2429.06305, null(39)=0, distinct(42)=2429.06305, null(42)=0, distinct(46)=2406, null(46)=0, distinct(52)=25, null(52)=0, distinct(53)=25, null(53)=0, distinct(46,53)=2448.65227, null(46,53)=0, distinct(23-25,39)=2429.06305, null(23-25,39)=0] + │ │ ├── fd: (1)-->(2), (11)-->(14), (36,37)-->(39), (21)==(11,37), (37)==(11,21), (20)==(1,36), (36)==(1,20), (42)-->(46), (19)==(42), (42)==(19), (11)==(21,37), (52)-->(53), (14)==(52), (52)==(14), (1)==(20,36) + │ │ ├── inner-join (hash) + │ │ │ ├── save-table-name: q9_inner_join_5 + │ │ │ ├── columns: p_partkey:1(int!null) p_name:2(varchar!null) s_suppkey:11(int!null) s_nationkey:14(int!null) l_orderkey:19(int!null) l_partkey:20(int!null) l_suppkey:21(int!null) l_quantity:23(float!null) l_extendedprice:24(float!null) l_discount:25(float!null) ps_partkey:36(int!null) ps_suppkey:37(int!null) ps_supplycost:39(float!null) o_orderkey:42(int!null) o_orderdate:46(date!null) + │ │ │ ├── multiplicity: left-rows(zero-or-more), right-rows(exactly-one) + │ │ │ ├── stats: [rows=2450.41631, distinct(1)=2429.06305, null(1)=0, distinct(2)=2450.41631, null(2)=0, distinct(11)=2429.06305, null(11)=0, distinct(14)=25, null(14)=0, distinct(19)=2429.06305, null(19)=0, distinct(20)=2429.06305, null(20)=0, distinct(21)=2429.06305, null(21)=0, distinct(23)=50, null(23)=0, distinct(24)=2429.06305, null(24)=0, distinct(25)=11, null(25)=0, distinct(36)=2429.06305, null(36)=0, distinct(37)=2429.06305, null(37)=0, distinct(39)=2429.06305, null(39)=0, distinct(42)=2429.06305, null(42)=0, distinct(46)=2406, null(46)=0] + │ │ │ ├── fd: (1)-->(2), (11)-->(14), (36,37)-->(39), (21)==(11,37), (37)==(11,21), (20)==(1,36), (36)==(1,20), (42)-->(46), (19)==(42), (42)==(19), (11)==(21,37), (1)==(20,36) + │ │ │ ├── scan supplier@s_nk + │ │ │ │ ├── save-table-name: q9_scan_6 + │ │ │ │ ├── columns: s_suppkey:11(int!null) s_nationkey:14(int!null) + │ │ │ │ ├── stats: [rows=10000, distinct(11)=9920, null(11)=0, distinct(14)=25, null(14)=0] + │ │ │ │ │ histogram(11)= 0 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 49 1 50 1 50 1 50 1 50 1 50 1 50 1 50 1 50 1 50 1 50 1 50 1 50 1 50 1 50 1 50 1 50 1 50 1 50 1 50 1 50 1 50 1 50 1 50 1 50 1 50 1 50 1 50 1 50 1 50 1 50 1 50 1 50 1 50 1 50 1 50 1 50 1 50 1 50 1 50 1 50 1 50 1 50 1 50 1 50 1 50 1 50 1 50 1 50 1 50 1 + │ │ │ │ │ <--- 1 ---- 51 ---- 101 ---- 151 ---- 201 ---- 251 ---- 301 ---- 351 ---- 401 ---- 451 ---- 501 ---- 551 ---- 601 ---- 651 ---- 701 ---- 751 ---- 801 ---- 851 ---- 901 ---- 951 ---- 1001 ---- 1051 ---- 1101 ---- 1151 ---- 1201 ---- 1251 ---- 1301 ---- 1351 ---- 1401 ---- 1451 ---- 1501 ---- 1551 ---- 1601 ---- 1651 ---- 1701 ---- 1751 ---- 1801 ---- 1851 ---- 1901 ---- 1951 ---- 2001 ---- 2051 ---- 2101 ---- 2151 ---- 2201 ---- 2251 ---- 2301 ---- 2351 ---- 2401 ---- 2451 ---- 2501 ---- 2551 ---- 2601 ---- 2651 ---- 2701 ---- 2751 ---- 2801 ---- 2851 ---- 2901 ---- 2951 ---- 3001 ---- 3051 ---- 3101 ---- 3151 ---- 3201 ---- 3251 ---- 3301 ---- 3351 ---- 3401 ---- 3451 ---- 3501 ---- 3551 ---- 3601 ---- 3651 ---- 3701 ---- 3751 ---- 3801 ---- 3851 ---- 3901 ---- 3951 ---- 4001 ---- 4051 ---- 4101 ---- 4151 ---- 4201 ---- 4251 ---- 4301 ---- 4351 ---- 4401 ---- 4451 ---- 4501 ---- 4551 ---- 4601 ---- 4651 ---- 4701 ---- 4751 ---- 4801 ---- 4851 ---- 4901 ---- 4951 ---- 5001 ---- 5051 ---- 5101 ---- 5151 ---- 5201 ---- 5251 ---- 5301 ---- 5351 ---- 5401 ---- 5451 ---- 5501 ---- 5551 ---- 5601 ---- 5651 ---- 5701 ---- 5751 ---- 5801 ---- 5851 ---- 5901 ---- 5951 ---- 6001 ---- 6051 ---- 6101 ---- 6151 ---- 6201 ---- 6251 ---- 6301 ---- 6351 ---- 6401 ---- 6451 ---- 6501 ---- 6551 ---- 6601 ---- 6651 ---- 6701 ---- 6751 ---- 6801 ---- 6851 ---- 6901 ---- 6951 ---- 7001 ---- 7051 ---- 7101 ---- 7151 ---- 7201 ---- 7251 ---- 7301 ---- 7351 ---- 7401 ---- 7451 ---- 7501 ---- 7552 ---- 7603 ---- 7654 ---- 7705 ---- 7756 ---- 7807 ---- 7858 ---- 7909 ---- 7960 ---- 8011 ---- 8062 ---- 8113 ---- 8164 ---- 8215 ---- 8266 ---- 8317 ---- 8368 ---- 8419 ---- 8470 ---- 8521 ---- 8572 ---- 8623 ---- 8674 ---- 8725 ---- 8776 ---- 8827 ---- 8878 ---- 8929 ---- 8980 ---- 9031 ---- 9082 ---- 9133 ---- 9184 ---- 9235 ---- 9286 ---- 9337 ---- 9388 ---- 9439 ---- 9490 ---- 9541 ---- 9592 ---- 9643 ---- 9694 ---- 9745 ---- 9796 ---- 9847 ---- 9898 ---- 9949 ---- 10000 + │ │ │ │ │ histogram(14)= 0 420 0 413 0 397 0 412 0 415 0 380 0 402 0 396 0 415 0 405 0 393 0 438 0 377 0 362 0 376 0 373 0 406 0 421 0 407 0 398 0 411 0 399 0 401 0 390 0 393 + │ │ │ │ │ <--- 0 --- 1 --- 2 --- 3 --- 4 --- 5 --- 6 --- 7 --- 8 --- 9 --- 10 --- 11 --- 12 --- 13 --- 14 --- 15 --- 16 --- 17 --- 18 --- 19 --- 20 --- 21 --- 22 --- 23 --- 24 + │ │ │ │ ├── key: (11) + │ │ │ │ └── fd: (11)-->(14) + │ │ │ ├── inner-join (lookup orders) + │ │ │ │ ├── save-table-name: q9_lookup_join_7 + │ │ │ │ ├── columns: p_partkey:1(int!null) p_name:2(varchar!null) l_orderkey:19(int!null) l_partkey:20(int!null) l_suppkey:21(int!null) l_quantity:23(float!null) l_extendedprice:24(float!null) l_discount:25(float!null) ps_partkey:36(int!null) ps_suppkey:37(int!null) ps_supplycost:39(float!null) o_orderkey:42(int!null) o_orderdate:46(date!null) + │ │ │ │ ├── key columns: [19] = [42] + │ │ │ │ ├── lookup columns are key + │ │ │ │ ├── stats: [rows=2430.81298, distinct(1)=2429.06305, null(1)=0, distinct(2)=2430.81298, null(2)=0, distinct(19)=2429.06305, null(19)=0, distinct(20)=2429.06305, null(20)=0, distinct(21)=2429.06305, null(21)=0, distinct(23)=50, null(23)=0, distinct(24)=2429.06305, null(24)=0, distinct(25)=11, null(25)=0, distinct(36)=2429.06305, null(36)=0, distinct(37)=2429.06305, null(37)=0, distinct(39)=2429.06305, null(39)=0, distinct(42)=2429.06305, null(42)=0, distinct(46)=2406, null(46)=0] + │ │ │ │ ├── fd: (1)-->(2), (36,37)-->(39), (21)==(37), (37)==(21), (20)==(1,36), (36)==(1,20), (42)-->(46), (19)==(42), (42)==(19), (1)==(20,36) + │ │ │ │ ├── inner-join (lookup lineitem) + │ │ │ │ │ ├── save-table-name: q9_lookup_join_8 + │ │ │ │ │ ├── columns: p_partkey:1(int!null) p_name:2(varchar!null) l_orderkey:19(int!null) l_partkey:20(int!null) l_suppkey:21(int!null) l_quantity:23(float!null) l_extendedprice:24(float!null) l_discount:25(float!null) ps_partkey:36(int!null) ps_suppkey:37(int!null) ps_supplycost:39(float!null) + │ │ │ │ │ ├── key columns: [19 22] = [19 22] + │ │ │ │ │ ├── lookup columns are key + │ │ │ │ │ ├── stats: [rows=2430.81298, distinct(1)=2429.06305, null(1)=0, distinct(2)=2430.81298, null(2)=0, distinct(19)=2429.06305, null(19)=0, distinct(20)=2429.06305, null(20)=0, distinct(21)=2429.06305, null(21)=0, distinct(23)=50, null(23)=0, distinct(24)=2429.06305, null(24)=0, distinct(25)=11, null(25)=0, distinct(36)=2429.06305, null(36)=0, distinct(37)=2429.06305, null(37)=0, distinct(39)=2429.06305, null(39)=0] + │ │ │ │ │ ├── fd: (1)-->(2), (36,37)-->(39), (21)==(37), (37)==(21), (20)==(1,36), (36)==(1,20), (1)==(20,36) + │ │ │ │ │ ├── inner-join (lookup lineitem@l_pk_sk) + │ │ │ │ │ │ ├── save-table-name: q9_lookup_join_9 + │ │ │ │ │ │ ├── columns: p_partkey:1(int!null) p_name:2(varchar!null) l_orderkey:19(int!null) l_partkey:20(int!null) l_suppkey:21(int!null) l_linenumber:22(int!null) ps_partkey:36(int!null) ps_suppkey:37(int!null) ps_supplycost:39(float!null) + │ │ │ │ │ │ ├── key columns: [36 37] = [20 21] + │ │ │ │ │ │ ├── stats: [rows=812.772154, distinct(1)=812.772154, null(1)=0, distinct(2)=812.772154, null(2)=0, distinct(19)=812.772154, null(19)=0, distinct(20)=812.772154, null(20)=0, distinct(21)=812.772154, null(21)=0, distinct(22)=7, null(22)=0, distinct(36)=812.772154, null(36)=0, distinct(37)=812.772154, null(37)=0, distinct(39)=812.772154, null(39)=0] + │ │ │ │ │ │ ├── key: (19,22) + │ │ │ │ │ │ ├── fd: (1)-->(2), (36,37)-->(39), (1)==(20,36), (36)==(1,20), (19,22)-->(20,21), (20)==(1,36), (21)==(37), (37)==(21) + │ │ │ │ │ │ ├── inner-join (merge) + │ │ │ │ │ │ │ ├── save-table-name: q9_merge_join_10 + │ │ │ │ │ │ │ ├── columns: p_partkey:1(int!null) p_name:2(varchar!null) ps_partkey:36(int!null) ps_suppkey:37(int!null) ps_supplycost:39(float!null) + │ │ │ │ │ │ │ ├── left ordering: +1 + │ │ │ │ │ │ │ ├── right ordering: +36 + │ │ │ │ │ │ │ ├── stats: [rows=267682.522, distinct(1)=66618.6736, null(1)=0, distinct(2)=66666.6667, null(2)=0, distinct(36)=66618.6736, null(36)=0, distinct(37)=9920, null(37)=0, distinct(39)=100379, null(39)=0] + │ │ │ │ │ │ │ ├── key: (36,37) + │ │ │ │ │ │ │ ├── fd: (1)-->(2), (36,37)-->(39), (1)==(36), (36)==(1) + │ │ │ │ │ │ │ ├── select + │ │ │ │ │ │ │ │ ├── save-table-name: q9_select_11 + │ │ │ │ │ │ │ │ ├── columns: p_partkey:1(int!null) p_name:2(varchar!null) + │ │ │ │ │ │ │ │ ├── stats: [rows=66666.6667, distinct(1)=66618.6736, null(1)=0, distinct(2)=66666.6667, null(2)=0] + │ │ │ │ │ │ │ │ ├── key: (1) + │ │ │ │ │ │ │ │ ├── fd: (1)-->(2) + │ │ │ │ │ │ │ │ ├── ordering: +1 + │ │ │ │ │ │ │ │ ├── scan part + │ │ │ │ │ │ │ │ │ ├── save-table-name: q9_scan_12 + │ │ │ │ │ │ │ │ │ ├── columns: p_partkey:1(int!null) p_name:2(varchar!null) + │ │ │ │ │ │ │ │ │ ├── stats: [rows=200000, distinct(1)=199241, null(1)=0, distinct(2)=198131, null(2)=0] + │ │ │ │ │ │ │ │ │ │ histogram(1)= 0 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 980 20 1000 20 1000 20 1000 20 1000 20 1000 20 1000 20 1000 20 1000 20 1000 20 1000 20 1000 20 1000 20 1000 20 1000 20 1000 20 1000 20 1000 20 1000 20 1000 20 1000 20 1000 20 1000 20 1000 20 1000 20 1000 20 1000 20 1000 20 1000 20 1000 20 1000 20 1000 20 1000 20 1000 20 1000 20 1000 20 1000 20 1000 20 1000 20 1000 20 1000 20 1000 20 1000 20 1000 20 1000 20 1000 20 1000 20 1000 20 1000 20 1000 20 + │ │ │ │ │ │ │ │ │ │ <--- 11 ----- 728 ----- 1645 ----- 2631 ----- 3709 ----- 4776 ----- 5561 ----- 6561 ----- 7453 ----- 8507 ----- 9391 ----- 10246 ----- 11291 ----- 12247 ----- 13190 ----- 14162 ----- 15360 ----- 16279 ----- 17470 ----- 18268 ----- 19116 ----- 20021 ----- 20910 ----- 21722 ----- 22568 ----- 23525 ----- 24605 ----- 25518 ----- 26552 ----- 27774 ----- 28571 ----- 29469 ----- 30689 ----- 31727 ----- 32646 ----- 33512 ----- 34737 ----- 35503 ----- 36365 ----- 37320 ----- 38146 ----- 39374 ----- 40214 ----- 41258 ----- 42381 ----- 43414 ----- 44505 ----- 45498 ----- 46687 ----- 47357 ----- 48402 ----- 49289 ----- 50503 ----- 51267 ----- 52365 ----- 53360 ----- 54114 ----- 54992 ----- 56028 ----- 56976 ----- 57919 ----- 58684 ----- 59544 ----- 60362 ----- 61372 ----- 62402 ----- 63261 ----- 64284 ----- 65157 ----- 66431 ----- 67649 ----- 68642 ----- 69759 ----- 70717 ----- 71768 ----- 72812 ----- 73928 ----- 75069 ----- 76089 ----- 77188 ----- 78003 ----- 79079 ----- 79895 ----- 80931 ----- 81904 ----- 82866 ----- 83812 ----- 84882 ----- 85743 ----- 86558 ----- 87686 ----- 88864 ----- 89834 ----- 90952 ----- 91855 ----- 92815 ----- 93983 ----- 95122 ----- 96110 ----- 97232 ----- 98327 ----- 99529 ----- 100662 ----- 101582 ----- 102475 ----- 103543 ----- 104588 ----- 105673 ----- 106646 ----- 107885 ----- 108848 ----- 109913 ----- 111053 ----- 111992 ----- 112875 ----- 113729 ----- 114830 ----- 115985 ----- 117017 ----- 118197 ----- 119027 ----- 119897 ----- 120979 ----- 122225 ----- 123339 ----- 124326 ----- 125507 ----- 126742 ----- 127739 ----- 128929 ----- 129766 ----- 130824 ----- 131780 ----- 132832 ----- 133849 ----- 134968 ----- 135887 ----- 136981 ----- 138203 ----- 139167 ----- 140214 ----- 141310 ----- 142333 ----- 143119 ----- 144146 ----- 145323 ----- 146333 ----- 147232 ----- 148140 ----- 148972 ----- 150048 ------ 151418 ------ 152456 ------ 153742 ------ 154633 ------ 155602 ------ 156660 ------ 157544 ------ 158653 ------ 159749 ------ 160523 ------ 161563 ------ 162605 ------ 163645 ------ 164720 ------ 165585 ------ 166792 ------ 167795 ------ 168739 ------ 169589 ------ 170526 ------ 171884 ------ 172894 ------ 173761 ------ 174914 ------ 176104 ------ 177260 ------ 178143 ------ 179073 ------ 179850 ------ 180913 ------ 181781 ------ 182661 ------ 183485 ------ 184505 ------ 185790 ------ 187010 ------ 187993 ------ 188916 ------ 190000 ------ 190931 ------ 192079 ------ 193006 ------ 193932 ------ 195013 ------ 196008 ------ 196799 ------ 197766 ------ 198943 ------ 199965 + │ │ │ │ │ │ │ │ │ │ histogram(2)= 0 20 1.9996e+05 20 + │ │ │ │ │ │ │ │ │ │ <--- 'almond antique cyan lawn pale' ------------ 'yellow white ghost lavender salmon' + │ │ │ │ │ │ │ │ │ ├── key: (1) + │ │ │ │ │ │ │ │ │ ├── fd: (1)-->(2) + │ │ │ │ │ │ │ │ │ └── ordering: +1 + │ │ │ │ │ │ │ │ └── filters + │ │ │ │ │ │ │ │ └── p_name:2 LIKE '%green%' [type=bool, outer=(2), constraints=(/2: (/NULL - ])] + │ │ │ │ │ │ │ ├── scan partsupp + │ │ │ │ │ │ │ │ ├── save-table-name: q9_scan_13 + │ │ │ │ │ │ │ │ ├── columns: ps_partkey:36(int!null) ps_suppkey:37(int!null) ps_supplycost:39(float!null) + │ │ │ │ │ │ │ │ ├── stats: [rows=800000, distinct(36)=199241, null(36)=0, distinct(37)=9920, null(37)=0, distinct(39)=100379, null(39)=0] + │ │ │ │ │ │ │ │ │ histogram(36)= 0 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3840 160 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3840 160 3920 80 3920 80 3920 160 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 160 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 80 3920 160 3920 80 3920 80 3920 80 3920 80 4000 80 4000 80 4000 80 4000 80 4000 80 4000 80 4000 80 4000 80 4000 80 4000 80 4000 80 4000 80 4000 80 4000 80 4000 80 4000 80 4000 80 4000 80 4000 80 4000 80 4000 80 4000 80 4000 80 4000 80 4000 80 4000 80 4000 80 4000 80 4000 80 4000 80 4000 80 4000 80 4000 80 4000 80 4000 80 4000 80 4000 80 4000 80 4000 80 4000 80 4000 80 4000 80 4000 80 4000 80 4000 80 4000 80 + │ │ │ │ │ │ │ │ │ <--- 11 ------ 765 ------ 1954 ------ 3094 ------ 4311 ------ 5377 ------ 6431 ------ 7396 ------ 8288 ------ 9272 ------ 10101 ------ 11159 ------ 12287 ------ 13216 ------ 14316 ------ 15503 ------ 16605 ------ 17726 ------ 18717 ------ 19542 ------ 20537 ------ 21666 ------ 22752 ------ 23971 ------ 24995 ------ 25994 ------ 26842 ------ 27390 ------ 28440 ------ 29526 ------ 30460 ------ 31515 ------ 32312 ------ 33159 ------ 33972 ------ 34884 ------ 35855 ------ 36884 ------ 38010 ------ 39033 ------ 39975 ------ 41212 ------ 42073 ------ 42782 ------ 43708 ------ 44715 ------ 45878 ------ 47111 ------ 48039 ------ 49002 ------ 50120 ------ 51213 ------ 52110 ------ 53025 ------ 53839 ------ 54936 ------ 55856 ------ 56820 ------ 58014 ------ 59079 ------ 59981 ------ 60972 ------ 62028 ------ 63090 ------ 64027 ------ 64909 ------ 65916 ------ 66861 ------ 67912 ------ 68977 ------ 70169 ------ 71156 ------ 72183 ------ 73210 ------ 74218 ------ 75126 ------ 76182 ------ 77201 ------ 78004 ------ 78975 ------ 79993 ------ 80986 ------ 81978 ------ 82761 ------ 83782 ------ 84946 ------ 85946 ------ 86808 ------ 87656 ------ 88587 ------ 89454 ------ 90799 ------ 91730 ------ 92853 ------ 93711 ------ 94565 ------ 95544 ------ 96591 ------ 97578 ------ 98568 ------ 99475 ------ 100626 ------ 101679 ------ 102802 ------ 103800 ------ 104901 ------ 105678 ------ 106420 ------ 107335 ------ 108666 ------ 109855 ------ 110808 ------ 111732 ------ 112497 ------ 113432 ------ 114405 ------ 115440 ------ 116504 ------ 117316 ------ 118321 ------ 119068 ------ 119846 ------ 120926 ------ 122077 ------ 122949 ------ 123943 ------ 124937 ------ 126233 ------ 127250 ------ 128140 ------ 129049 ------ 129887 ------ 130876 ------ 131726 ------ 132511 ------ 133477 ------ 134247 ------ 135281 ------ 136204 ------ 137302 ------ 138754 ------ 140003 ------ 140831 ------ 141666 ------ 142617 ------ 143565 ------ 144737 ------ 145910 ------ 146952 ------ 147912 ------ 148781 ------ 149766 ------ 150631 ------ 151819 ------ 152865 ------ 153895 ------ 154813 ------ 155710 ------ 156815 ------ 157926 ------ 159092 ------ 160005 ------ 161023 ------ 162111 ------ 163183 ------ 164159 ------ 165338 ------ 166253 ------ 167290 ------ 168099 ------ 169524 ------ 170467 ------ 171236 ------ 172225 ------ 173089 ------ 174101 ------ 175241 ------ 176102 ------ 176969 ------ 178074 ------ 178858 ------ 179838 ------ 181097 ------ 182021 ------ 182950 ------ 184039 ------ 184907 ------ 185995 ------ 187520 ------ 188513 ------ 189558 ------ 190767 ------ 192126 ------ 193405 ------ 194495 ------ 195462 ------ 196564 ------ 197793 ------ 198874 ------ 199967 + │ │ │ │ │ │ │ │ │ histogram(37)= 0 80 3840 160 3920 80 3840 160 3920 160 3920 80 3840 160 3920 240 3920 80 3920 80 3920 80 3920 240 3920 80 3760 240 3920 80 3920 80 3920 80 3920 80 3920 320 3920 80 3680 320 3920 160 3920 80 3920 80 3840 160 3920 160 3840 160 3920 80 3920 80 3920 80 3920 160 3920 240 3920 80 3840 160 3920 80 3840 240 3920 160 3920 160 3840 160 3920 240 3840 320 3760 240 3840 160 3840 160 3920 240 3920 80 3840 240 3680 480 3920 80 3920 80 3920 80 3920 160 3920 160 3920 80 3920 80 3920 160 3760 320 3840 320 3920 320 3920 80 3920 160 3920 80 3840 160 3840 160 3920 80 3920 80 3920 240 3760 240 3920 160 3920 160 3920 80 3840 160 3920 160 3840 320 3920 80 3920 80 3920 240 3920 160 3920 160 3920 240 3920 80 3920 240 3680 400 3680 320 3840 80 3840 160 3760 240 3840 80 3840 320 3840 160 3840 80 3840 240 3840 80 3840 160 3840 80 3840 240 3760 240 3760 160 3920 80 3840 240 3840 80 3920 80 3920 160 3840 160 3840 80 3760 320 3840 80 3920 80 3920 80 3920 80 3920 320 3840 80 3840 80 3840 160 3760 240 3840 160 3840 80 3920 80 3840 240 3760 160 3840 160 3840 160 3760 240 3760 240 3840 160 3840 160 3920 80 3840 160 3840 160 3840 160 3760 240 3760 240 3920 240 3840 80 3840 80 3920 80 3920 160 3760 160 3840 160 3920 80 3600 480 3760 160 3920 80 3920 80 3840 240 3840 160 3680 240 3680 320 3920 240 3760 160 3840 80 3920 160 3760 320 3840 160 3840 80 3840 80 3920 80 3920 160 3840 320 3760 160 3840 240 3840 80 3760 160 3680 240 3920 160 3840 80 3840 240 3680 240 3920 160 3840 80 3920 160 3760 160 3920 160 3840 80 3760 240 3920 160 3840 80 3920 80 3920 80 3920 80 3920 80 3680 320 3760 240 3920 80 3920 80 3920 160 3760 160 3840 240 3840 160 3840 80 3760 240 3920 80 3600 400 3920 80 3920 80 3840 160 3920 80 3920 160 3600 320 3920 80 + │ │ │ │ │ │ │ │ │ <--- 1 ------ 57 ------ 119 ------ 176 ------ 228 ------ 277 ------ 315 ------ 390 ------ 437 ------ 479 ------ 517 ------ 568 ------ 626 ------ 678 ------ 728 ------ 785 ------ 850 ------ 900 ------ 965 ------ 1015 ------ 1056 ------ 1101 ------ 1152 ------ 1194 ------ 1236 ------ 1282 ------ 1331 ------ 1389 ------ 1456 ------ 1505 ------ 1555 ------ 1605 ------ 1650 ------ 1710 ------ 1762 ------ 1806 ------ 1855 ------ 1911 ------ 1959 ------ 2021 ------ 2076 ------ 2120 ------ 2169 ------ 2218 ------ 2284 ------ 2324 ------ 2365 ------ 2412 ------ 2474 ------ 2524 ------ 2568 ------ 2620 ------ 2665 ------ 2719 ------ 2781 ------ 2831 ------ 2884 ------ 2926 ------ 2973 ------ 3012 ------ 3071 ------ 3112 ------ 3158 ------ 3209 ------ 3250 ------ 3313 ------ 3366 ------ 3414 ------ 3463 ------ 3514 ------ 3557 ------ 3608 ------ 3668 ------ 3713 ------ 3777 ------ 3827 ------ 3882 ------ 3938 ------ 3989 ------ 4036 ------ 4084 ------ 4134 ------ 4182 ------ 4231 ------ 4292 ------ 4337 ------ 4382 ------ 4426 ------ 4474 ------ 4521 ------ 4568 ------ 4614 ------ 4651 ------ 4695 ------ 4742 ------ 4800 ------ 4853 ------ 4905 ------ 4954 ------ 4997 ------ 5050 ------ 5115 ------ 5167 ------ 5231 ------ 5276 ------ 5325 ------ 5371 ------ 5419 ------ 5484 ------ 5547 ------ 5586 ------ 5636 ------ 5685 ------ 5744 ------ 5799 ------ 5855 ------ 5894 ------ 5938 ------ 5984 ------ 6038 ------ 6085 ------ 6143 ------ 6196 ------ 6257 ------ 6306 ------ 6350 ------ 6395 ------ 6445 ------ 6497 ------ 6556 ------ 6596 ------ 6636 ------ 6684 ------ 6744 ------ 6799 ------ 6844 ------ 6894 ------ 6947 ------ 6994 ------ 7048 ------ 7104 ------ 7149 ------ 7199 ------ 7248 ------ 7288 ------ 7343 ------ 7391 ------ 7446 ------ 7492 ------ 7538 ------ 7598 ------ 7650 ------ 7702 ------ 7767 ------ 7799 ------ 7849 ------ 7898 ------ 7941 ------ 7989 ------ 8041 ------ 8086 ------ 8127 ------ 8169 ------ 8216 ------ 8263 ------ 8326 ------ 8374 ------ 8413 ------ 8465 ------ 8521 ------ 8579 ------ 8631 ------ 8680 ------ 8732 ------ 8783 ------ 8832 ------ 8888 ------ 8945 ------ 8997 ------ 9052 ------ 9106 ------ 9136 ------ 9193 ------ 9234 ------ 9279 ------ 9326 ------ 9381 ------ 9426 ------ 9471 ------ 9519 ------ 9552 ------ 9609 ------ 9660 ------ 9716 ------ 9762 ------ 9815 ------ 9863 ------ 9910 ------ 9948 ------ 10000 + │ │ │ │ │ │ │ │ │ histogram(39)= 0 80 7.9984e+05 80 + │ │ │ │ │ │ │ │ │ <--- 1.37 ------------ 1000.0 + │ │ │ │ │ │ │ │ ├── key: (36,37) + │ │ │ │ │ │ │ │ ├── fd: (36,37)-->(39) + │ │ │ │ │ │ │ │ └── ordering: +36 + │ │ │ │ │ │ │ └── filters (true) + │ │ │ │ │ │ └── filters (true) + │ │ │ │ │ └── filters (true) + │ │ │ │ └── filters (true) + │ │ │ └── filters + │ │ │ └── s_suppkey:11 = l_suppkey:21 [type=bool, outer=(11,21), constraints=(/11: (/NULL - ]; /21: (/NULL - ]), fd=(11)==(21), (21)==(11)] + │ │ ├── scan nation + │ │ │ ├── save-table-name: q9_scan_14 + │ │ │ ├── columns: n_nationkey:52(int!null) n_name:53(char!null) + │ │ │ ├── stats: [rows=25, distinct(52)=25, null(52)=0, distinct(53)=25, null(53)=0] + │ │ │ │ histogram(52)= 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 + │ │ │ │ <--- 0 --- 1 --- 2 --- 3 --- 4 --- 5 --- 6 --- 7 --- 8 --- 9 --- 10 --- 11 --- 12 --- 13 --- 14 --- 15 --- 16 --- 17 --- 18 --- 19 --- 20 --- 21 --- 22 --- 23 --- 24 + │ │ │ │ histogram(53)= 0 1 23 1 + │ │ │ │ <--- 'ALGERIA' ---- 'VIETNAM' + │ │ │ ├── key: (52) + │ │ │ └── fd: (52)-->(53) + │ │ └── filters + │ │ └── s_nationkey:14 = n_nationkey:52 [type=bool, outer=(14,52), constraints=(/14: (/NULL - ]; /52: (/NULL - ]), fd=(14)==(52), (52)==(14)] + │ └── projections + │ ├── extract('year', o_orderdate:46) [as=o_year:57, type=float, outer=(46), immutable] + │ └── (l_extendedprice:24 * (1.0 - l_discount:25)) - (ps_supplycost:39 * l_quantity:23) [as=amount:58, type=float, outer=(23-25,39), immutable] + └── aggregations + └── sum [as=sum:59, type=float, outer=(58)] + └── amount:58 [type=float] -----Stats for q9_sort_1---- +----Stats for q9_group_by_1---- column_names row_count distinct_count null_count -{nation} 175 25 0 -{o_year} 175 7 0 -{sum_profit} 175 175 0 +{nation} 0 0 0 +{o_year} 0 0 0 +{sum_profit} 0 0 0 ~~~~ column_names row_count_est row_count_err distinct_count_est distinct_count_err null_count_est null_count_err -{nation} 1548.00 8.85 <== 25.00 1.00 0.00 1.00 -{o_year} 1548.00 8.85 <== 957.00 136.71 <== 0.00 1.00 -{sum_profit} 1548.00 8.85 <== 1548.00 8.85 <== 0.00 1.00 +{nation} 2449.00 +Inf <== 25.00 +Inf <== 0.00 1.00 +{o_year} 2449.00 +Inf <== 2406.00 +Inf <== 0.00 1.00 +{sum_profit} 2449.00 +Inf <== 2449.00 +Inf <== 0.00 1.00 -----Stats for q9_group_by_2---- +----Stats for q9_sort_2---- column_names row_count distinct_count null_count -{n_name} 175 25 0 -{o_year} 175 7 0 -{sum} 175 175 0 +{amount} 0 0 0 +{n_name} 0 0 0 +{o_year} 0 0 0 ~~~~ column_names row_count_est row_count_err distinct_count_est distinct_count_err null_count_est null_count_err -{n_name} 1548.00 8.85 <== 25.00 1.00 0.00 1.00 -{o_year} 1548.00 8.85 <== 957.00 136.71 <== 0.00 1.00 -{sum} 1548.00 8.85 <== 1548.00 8.85 <== 0.00 1.00 +{amount} 2450.00 +Inf <== 2429.00 +Inf <== 0.00 1.00 +{n_name} 2450.00 +Inf <== 25.00 +Inf <== 0.00 1.00 +{o_year} 2450.00 +Inf <== 2406.00 +Inf <== 0.00 1.00 ----Stats for q9_project_3---- column_names row_count distinct_count null_count -{amount} 319404 315234 0 -{n_name} 319404 25 0 -{o_year} 319404 7 0 +{amount} 0 0 0 +{n_name} 0 0 0 +{o_year} 0 0 0 ~~~~ column_names row_count_est row_count_err distinct_count_est distinct_count_err null_count_est null_count_err -{amount} 2450.00 130.37 <== 958.00 329.05 <== 0.00 1.00 -{n_name} 2450.00 130.37 <== 25.00 1.00 0.00 1.00 -{o_year} 2450.00 130.37 <== 957.00 136.71 <== 0.00 1.00 +{amount} 2450.00 +Inf <== 2429.00 +Inf <== 0.00 1.00 +{n_name} 2450.00 +Inf <== 25.00 +Inf <== 0.00 1.00 +{o_year} 2450.00 +Inf <== 2406.00 +Inf <== 0.00 1.00 ----Stats for q9_inner_join_4---- column_names row_count distinct_count null_count -{l_discount} 319404 11 0 -{l_extendedprice} 319404 212580 0 -{l_orderkey} 319404 288573 0 -{l_partkey} 319404 10632 0 -{l_quantity} 319404 50 0 -{l_suppkey} 319404 9799 0 -{n_name} 319404 25 0 -{n_nationkey} 319404 25 0 -{o_orderdate} 319404 2406 0 -{o_orderkey} 319404 288573 0 -{p_name} 319404 10680 0 -{p_partkey} 319404 10632 0 -{ps_partkey} 319404 10632 0 -{ps_suppkey} 319404 9799 0 -{ps_supplycost} 319404 34839 0 -{s_nationkey} 319404 25 0 -{s_suppkey} 319404 9799 0 +{l_discount} 0 0 0 +{l_extendedprice} 0 0 0 +{l_orderkey} 0 0 0 +{l_partkey} 0 0 0 +{l_quantity} 0 0 0 +{l_suppkey} 0 0 0 +{n_name} 0 0 0 +{n_nationkey} 0 0 0 +{o_orderdate} 0 0 0 +{o_orderkey} 0 0 0 +{p_name} 0 0 0 +{p_partkey} 0 0 0 +{ps_partkey} 0 0 0 +{ps_suppkey} 0 0 0 +{ps_supplycost} 0 0 0 +{s_nationkey} 0 0 0 +{s_suppkey} 0 0 0 ~~~~ column_names row_count_est row_count_err distinct_count_est distinct_count_err null_count_est null_count_err -{l_discount} 2450.00 130.37 <== 11.00 1.00 0.00 1.00 -{l_extendedprice} 2450.00 130.37 <== 958.00 221.90 <== 0.00 1.00 -{l_orderkey} 2450.00 130.37 <== 1066.00 270.71 <== 0.00 1.00 -{l_partkey} 2450.00 130.37 <== 1065.00 9.98 <== 0.00 1.00 -{l_quantity} 2450.00 130.37 <== 50.00 1.00 0.00 1.00 -{l_suppkey} 2450.00 130.37 <== 1065.00 9.20 <== 0.00 1.00 -{n_name} 2450.00 130.37 <== 25.00 1.00 0.00 1.00 -{n_nationkey} 2450.00 130.37 <== 25.00 1.00 0.00 1.00 -{o_orderdate} 2450.00 130.37 <== 957.00 2.51 <== 0.00 1.00 -{o_orderkey} 2450.00 130.37 <== 1066.00 270.71 <== 0.00 1.00 -{p_name} 2450.00 130.37 <== 2406.00 4.44 <== 0.00 1.00 -{p_partkey} 2450.00 130.37 <== 1065.00 9.98 <== 0.00 1.00 -{ps_partkey} 2450.00 130.37 <== 958.00 11.10 <== 0.00 1.00 -{ps_suppkey} 2450.00 130.37 <== 958.00 10.23 <== 0.00 1.00 -{ps_supplycost} 2450.00 130.37 <== 957.00 36.40 <== 0.00 1.00 -{s_nationkey} 2450.00 130.37 <== 25.00 1.00 0.00 1.00 -{s_suppkey} 2450.00 130.37 <== 1065.00 9.20 <== 0.00 1.00 +{l_discount} 2450.00 +Inf <== 11.00 +Inf <== 0.00 1.00 +{l_extendedprice} 2450.00 +Inf <== 2429.00 +Inf <== 0.00 1.00 +{l_orderkey} 2450.00 +Inf <== 2429.00 +Inf <== 0.00 1.00 +{l_partkey} 2450.00 +Inf <== 2429.00 +Inf <== 0.00 1.00 +{l_quantity} 2450.00 +Inf <== 50.00 +Inf <== 0.00 1.00 +{l_suppkey} 2450.00 +Inf <== 2429.00 +Inf <== 0.00 1.00 +{n_name} 2450.00 +Inf <== 25.00 +Inf <== 0.00 1.00 +{n_nationkey} 2450.00 +Inf <== 25.00 +Inf <== 0.00 1.00 +{o_orderdate} 2450.00 +Inf <== 2406.00 +Inf <== 0.00 1.00 +{o_orderkey} 2450.00 +Inf <== 2429.00 +Inf <== 0.00 1.00 +{p_name} 2450.00 +Inf <== 2450.00 +Inf <== 0.00 1.00 +{p_partkey} 2450.00 +Inf <== 2429.00 +Inf <== 0.00 1.00 +{ps_partkey} 2450.00 +Inf <== 2429.00 +Inf <== 0.00 1.00 +{ps_suppkey} 2450.00 +Inf <== 2429.00 +Inf <== 0.00 1.00 +{ps_supplycost} 2450.00 +Inf <== 2429.00 +Inf <== 0.00 1.00 +{s_nationkey} 2450.00 +Inf <== 25.00 +Inf <== 0.00 1.00 +{s_suppkey} 2450.00 +Inf <== 2429.00 +Inf <== 0.00 1.00 ----Stats for q9_inner_join_5---- column_names row_count distinct_count null_count -{l_discount} 319404 11 0 -{l_extendedprice} 319404 212580 0 -{l_orderkey} 319404 288573 0 -{l_partkey} 319404 10632 0 -{l_quantity} 319404 50 0 -{l_suppkey} 319404 9799 0 -{o_orderdate} 319404 2406 0 -{o_orderkey} 319404 288573 0 -{p_name} 319404 10680 0 -{p_partkey} 319404 10632 0 -{ps_partkey} 319404 10632 0 -{ps_suppkey} 319404 9799 0 -{ps_supplycost} 319404 34839 0 -{s_nationkey} 319404 25 0 -{s_suppkey} 319404 9799 0 +{l_discount} 0 0 0 +{l_extendedprice} 0 0 0 +{l_orderkey} 0 0 0 +{l_partkey} 0 0 0 +{l_quantity} 0 0 0 +{l_suppkey} 0 0 0 +{o_orderdate} 0 0 0 +{o_orderkey} 0 0 0 +{p_name} 0 0 0 +{p_partkey} 0 0 0 +{ps_partkey} 0 0 0 +{ps_suppkey} 0 0 0 +{ps_supplycost} 0 0 0 +{s_nationkey} 0 0 0 +{s_suppkey} 0 0 0 ~~~~ column_names row_count_est row_count_err distinct_count_est distinct_count_err null_count_est null_count_err -{l_discount} 2450.00 130.37 <== 11.00 1.00 0.00 1.00 -{l_extendedprice} 2450.00 130.37 <== 1058.00 200.93 <== 0.00 1.00 -{l_orderkey} 2450.00 130.37 <== 1227.00 235.19 <== 0.00 1.00 -{l_partkey} 2450.00 130.37 <== 1224.00 8.69 <== 0.00 1.00 -{l_quantity} 2450.00 130.37 <== 50.00 1.00 0.00 1.00 -{l_suppkey} 2450.00 130.37 <== 1224.00 8.01 <== 0.00 1.00 -{o_orderdate} 2450.00 130.37 <== 1057.00 2.28 <== 0.00 1.00 -{o_orderkey} 2450.00 130.37 <== 1227.00 235.19 <== 0.00 1.00 -{p_name} 2450.00 130.37 <== 2406.00 4.44 <== 0.00 1.00 -{p_partkey} 2450.00 130.37 <== 1224.00 8.69 <== 0.00 1.00 -{ps_partkey} 2450.00 130.37 <== 1059.00 10.04 <== 0.00 1.00 -{ps_suppkey} 2450.00 130.37 <== 1059.00 9.25 <== 0.00 1.00 -{ps_supplycost} 2450.00 130.37 <== 1056.00 32.99 <== 0.00 1.00 -{s_nationkey} 2450.00 130.37 <== 25.00 1.00 0.00 1.00 -{s_suppkey} 2450.00 130.37 <== 1224.00 8.01 <== 0.00 1.00 +{l_discount} 2450.00 +Inf <== 11.00 +Inf <== 0.00 1.00 +{l_extendedprice} 2450.00 +Inf <== 2429.00 +Inf <== 0.00 1.00 +{l_orderkey} 2450.00 +Inf <== 2429.00 +Inf <== 0.00 1.00 +{l_partkey} 2450.00 +Inf <== 2429.00 +Inf <== 0.00 1.00 +{l_quantity} 2450.00 +Inf <== 50.00 +Inf <== 0.00 1.00 +{l_suppkey} 2450.00 +Inf <== 2429.00 +Inf <== 0.00 1.00 +{o_orderdate} 2450.00 +Inf <== 2406.00 +Inf <== 0.00 1.00 +{o_orderkey} 2450.00 +Inf <== 2429.00 +Inf <== 0.00 1.00 +{p_name} 2450.00 +Inf <== 2450.00 +Inf <== 0.00 1.00 +{p_partkey} 2450.00 +Inf <== 2429.00 +Inf <== 0.00 1.00 +{ps_partkey} 2450.00 +Inf <== 2429.00 +Inf <== 0.00 1.00 +{ps_suppkey} 2450.00 +Inf <== 2429.00 +Inf <== 0.00 1.00 +{ps_supplycost} 2450.00 +Inf <== 2429.00 +Inf <== 0.00 1.00 +{s_nationkey} 2450.00 +Inf <== 25.00 +Inf <== 0.00 1.00 +{s_suppkey} 2450.00 +Inf <== 2429.00 +Inf <== 0.00 1.00 ----Stats for q9_scan_6---- column_names row_count distinct_count null_count -{s_nationkey} 10000 25 0 -{s_suppkey} 10000 9920 0 +{s_nationkey} 0 0 0 +{s_suppkey} 0 0 0 ~~~~ column_names row_count_est row_count_err distinct_count_est distinct_count_err null_count_est null_count_err -{s_nationkey} 10000.00 1.00 25.00 1.00 0.00 1.00 -{s_suppkey} 10000.00 1.00 9920.00 1.00 0.00 1.00 +{s_nationkey} 10000.00 +Inf <== 25.00 +Inf <== 0.00 1.00 +{s_suppkey} 10000.00 +Inf <== 9920.00 +Inf <== 0.00 1.00 ----Stats for q9_lookup_join_7---- column_names row_count distinct_count null_count -{l_discount} 319404 11 0 -{l_extendedprice} 319404 212580 0 -{l_orderkey} 319404 288573 0 -{l_partkey} 319404 10632 0 -{l_quantity} 319404 50 0 -{l_suppkey} 319404 9799 0 -{o_orderdate} 319404 2406 0 -{o_orderkey} 319404 288573 0 -{p_name} 319404 10680 0 -{p_partkey} 319404 10632 0 -{ps_partkey} 319404 10632 0 -{ps_suppkey} 319404 9799 0 -{ps_supplycost} 319404 34839 0 +{l_discount} 0 0 0 +{l_extendedprice} 0 0 0 +{l_orderkey} 0 0 0 +{l_partkey} 0 0 0 +{l_quantity} 0 0 0 +{l_suppkey} 0 0 0 +{o_orderdate} 0 0 0 +{o_orderkey} 0 0 0 +{p_name} 0 0 0 +{p_partkey} 0 0 0 +{ps_partkey} 0 0 0 +{ps_suppkey} 0 0 0 +{ps_supplycost} 0 0 0 ~~~~ column_names row_count_est row_count_err distinct_count_est distinct_count_err null_count_est null_count_err -{l_discount} 2431.00 131.39 <== 11.00 1.00 0.00 1.00 -{l_extendedprice} 2431.00 131.39 <== 1220.00 174.25 <== 0.00 1.00 -{l_orderkey} 2431.00 131.39 <== 1536.00 187.87 <== 0.00 1.00 -{l_partkey} 2431.00 131.39 <== 1535.00 6.93 <== 0.00 1.00 -{l_quantity} 2431.00 131.39 <== 50.00 1.00 0.00 1.00 -{l_suppkey} 2431.00 131.39 <== 1220.00 8.03 <== 0.00 1.00 -{o_orderdate} 2431.00 131.39 <== 1217.00 1.98 <== 0.00 1.00 -{o_orderkey} 2431.00 131.39 <== 1536.00 187.87 <== 0.00 1.00 -{p_name} 2431.00 131.39 <== 2387.00 4.47 <== 0.00 1.00 -{p_partkey} 2431.00 131.39 <== 1535.00 6.93 <== 0.00 1.00 -{ps_partkey} 2431.00 131.39 <== 1220.00 8.71 <== 0.00 1.00 -{ps_suppkey} 2431.00 131.39 <== 1220.00 8.03 <== 0.00 1.00 -{ps_supplycost} 2431.00 131.39 <== 1217.00 28.63 <== 0.00 1.00 +{l_discount} 2431.00 +Inf <== 11.00 +Inf <== 0.00 1.00 +{l_extendedprice} 2431.00 +Inf <== 2429.00 +Inf <== 0.00 1.00 +{l_orderkey} 2431.00 +Inf <== 2429.00 +Inf <== 0.00 1.00 +{l_partkey} 2431.00 +Inf <== 2429.00 +Inf <== 0.00 1.00 +{l_quantity} 2431.00 +Inf <== 50.00 +Inf <== 0.00 1.00 +{l_suppkey} 2431.00 +Inf <== 2429.00 +Inf <== 0.00 1.00 +{o_orderdate} 2431.00 +Inf <== 2406.00 +Inf <== 0.00 1.00 +{o_orderkey} 2431.00 +Inf <== 2429.00 +Inf <== 0.00 1.00 +{p_name} 2431.00 +Inf <== 2431.00 +Inf <== 0.00 1.00 +{p_partkey} 2431.00 +Inf <== 2429.00 +Inf <== 0.00 1.00 +{ps_partkey} 2431.00 +Inf <== 2429.00 +Inf <== 0.00 1.00 +{ps_suppkey} 2431.00 +Inf <== 2429.00 +Inf <== 0.00 1.00 +{ps_supplycost} 2431.00 +Inf <== 2429.00 +Inf <== 0.00 1.00 ----Stats for q9_lookup_join_8---- column_names row_count distinct_count null_count -{l_discount} 319404 11 0 -{l_extendedprice} 319404 212580 0 -{l_orderkey} 319404 288573 0 -{l_partkey} 319404 10632 0 -{l_quantity} 319404 50 0 -{l_suppkey} 319404 9799 0 -{p_name} 319404 10680 0 -{p_partkey} 319404 10632 0 -{ps_partkey} 319404 10632 0 -{ps_suppkey} 319404 9799 0 -{ps_supplycost} 319404 34839 0 +{l_discount} 0 0 0 +{l_extendedprice} 0 0 0 +{l_orderkey} 0 0 0 +{l_partkey} 0 0 0 +{l_quantity} 0 0 0 +{l_suppkey} 0 0 0 +{p_name} 0 0 0 +{p_partkey} 0 0 0 +{ps_partkey} 0 0 0 +{ps_suppkey} 0 0 0 +{ps_supplycost} 0 0 0 ~~~~ column_names row_count_est row_count_err distinct_count_est distinct_count_err null_count_est null_count_err -{l_discount} 2431.00 131.39 <== 11.00 1.00 0.00 1.00 -{l_extendedprice} 2431.00 131.39 <== 1535.00 138.49 <== 0.00 1.00 -{l_orderkey} 2431.00 131.39 <== 1536.00 187.87 <== 0.00 1.00 -{l_partkey} 2431.00 131.39 <== 2429.00 4.38 <== 0.00 1.00 -{l_quantity} 2431.00 131.39 <== 50.00 1.00 0.00 1.00 -{l_suppkey} 2431.00 131.39 <== 1536.00 6.38 <== 0.00 1.00 -{p_name} 2431.00 131.39 <== 2387.00 4.47 <== 0.00 1.00 -{p_partkey} 2431.00 131.39 <== 2429.00 4.38 <== 0.00 1.00 -{ps_partkey} 2431.00 131.39 <== 1536.00 6.92 <== 0.00 1.00 -{ps_suppkey} 2431.00 131.39 <== 1536.00 6.38 <== 0.00 1.00 -{ps_supplycost} 2431.00 131.39 <== 1528.00 22.80 <== 0.00 1.00 +{l_discount} 2431.00 +Inf <== 11.00 +Inf <== 0.00 1.00 +{l_extendedprice} 2431.00 +Inf <== 2429.00 +Inf <== 0.00 1.00 +{l_orderkey} 2431.00 +Inf <== 2429.00 +Inf <== 0.00 1.00 +{l_partkey} 2431.00 +Inf <== 2429.00 +Inf <== 0.00 1.00 +{l_quantity} 2431.00 +Inf <== 50.00 +Inf <== 0.00 1.00 +{l_suppkey} 2431.00 +Inf <== 2429.00 +Inf <== 0.00 1.00 +{p_name} 2431.00 +Inf <== 2431.00 +Inf <== 0.00 1.00 +{p_partkey} 2431.00 +Inf <== 2429.00 +Inf <== 0.00 1.00 +{ps_partkey} 2431.00 +Inf <== 2429.00 +Inf <== 0.00 1.00 +{ps_suppkey} 2431.00 +Inf <== 2429.00 +Inf <== 0.00 1.00 +{ps_supplycost} 2431.00 +Inf <== 2429.00 +Inf <== 0.00 1.00 ----Stats for q9_lookup_join_9---- column_names row_count distinct_count null_count -{l_linenumber} 319404 7 0 -{l_orderkey} 319404 288573 0 -{l_partkey} 319404 10632 0 -{l_suppkey} 319404 9799 0 -{p_name} 319404 10680 0 -{p_partkey} 319404 10632 0 -{ps_partkey} 319404 10632 0 -{ps_suppkey} 319404 9799 0 -{ps_supplycost} 319404 34839 0 +{l_linenumber} 0 0 0 +{l_orderkey} 0 0 0 +{l_partkey} 0 0 0 +{l_suppkey} 0 0 0 +{p_name} 0 0 0 +{p_partkey} 0 0 0 +{ps_partkey} 0 0 0 +{ps_suppkey} 0 0 0 +{ps_supplycost} 0 0 0 ~~~~ column_names row_count_est row_count_err distinct_count_est distinct_count_err null_count_est null_count_err -{l_linenumber} 813.00 392.87 <== 7.00 1.00 0.00 1.00 -{l_orderkey} 813.00 392.87 <== 813.00 354.95 <== 0.00 1.00 -{l_partkey} 813.00 392.87 <== 813.00 13.08 <== 0.00 1.00 -{l_suppkey} 813.00 392.87 <== 813.00 12.05 <== 0.00 1.00 -{p_name} 813.00 392.87 <== 808.00 13.22 <== 0.00 1.00 -{p_partkey} 813.00 392.87 <== 808.00 13.16 <== 0.00 1.00 -{ps_partkey} 813.00 392.87 <== 813.00 13.08 <== 0.00 1.00 -{ps_suppkey} 813.00 392.87 <== 813.00 12.05 <== 0.00 1.00 -{ps_supplycost} 813.00 392.87 <== 809.00 43.06 <== 0.00 1.00 +{l_linenumber} 813.00 +Inf <== 7.00 +Inf <== 0.00 1.00 +{l_orderkey} 813.00 +Inf <== 813.00 +Inf <== 0.00 1.00 +{l_partkey} 813.00 +Inf <== 813.00 +Inf <== 0.00 1.00 +{l_suppkey} 813.00 +Inf <== 813.00 +Inf <== 0.00 1.00 +{p_name} 813.00 +Inf <== 813.00 +Inf <== 0.00 1.00 +{p_partkey} 813.00 +Inf <== 813.00 +Inf <== 0.00 1.00 +{ps_partkey} 813.00 +Inf <== 813.00 +Inf <== 0.00 1.00 +{ps_suppkey} 813.00 +Inf <== 813.00 +Inf <== 0.00 1.00 +{ps_supplycost} 813.00 +Inf <== 813.00 +Inf <== 0.00 1.00 ----Stats for q9_merge_join_10---- column_names row_count distinct_count null_count -{p_name} 42656 10680 0 -{p_partkey} 42656 10632 0 -{ps_partkey} 42656 10632 0 -{ps_suppkey} 42656 9801 0 -{ps_supplycost} 42656 34850 0 +{p_name} 0 0 0 +{p_partkey} 0 0 0 +{ps_partkey} 0 0 0 +{ps_suppkey} 0 0 0 +{ps_supplycost} 0 0 0 ~~~~ column_names row_count_est row_count_err distinct_count_est distinct_count_err null_count_est null_count_err -{p_name} 267683.00 6.28 <== 65464.00 6.13 <== 0.00 1.00 -{p_partkey} 267683.00 6.28 <== 66619.00 6.27 <== 0.00 1.00 -{ps_partkey} 267683.00 6.28 <== 66619.00 6.27 <== 0.00 1.00 -{ps_suppkey} 267683.00 6.28 <== 9920.00 1.01 0.00 1.00 -{ps_supplycost} 267683.00 6.28 <== 93405.00 2.68 <== 0.00 1.00 +{p_name} 267683.00 +Inf <== 66667.00 +Inf <== 0.00 1.00 +{p_partkey} 267683.00 +Inf <== 66619.00 +Inf <== 0.00 1.00 +{ps_partkey} 267683.00 +Inf <== 66619.00 +Inf <== 0.00 1.00 +{ps_suppkey} 267683.00 +Inf <== 9920.00 +Inf <== 0.00 1.00 +{ps_supplycost} 267683.00 +Inf <== 100379.00 +Inf <== 0.00 1.00 ----Stats for q9_select_11---- column_names row_count distinct_count null_count -{p_name} 10664 10680 0 -{p_partkey} 10664 10632 0 +{p_name} 0 0 0 +{p_partkey} 0 0 0 ~~~~ column_names row_count_est row_count_err distinct_count_est distinct_count_err null_count_est null_count_err -{p_name} 66667.00 6.25 <== 66667.00 6.24 <== 0.00 1.00 -{p_partkey} 66667.00 6.25 <== 66619.00 6.27 <== 0.00 1.00 +{p_name} 66667.00 +Inf <== 66667.00 +Inf <== 0.00 1.00 +{p_partkey} 66667.00 +Inf <== 66619.00 +Inf <== 0.00 1.00 ----Stats for q9_scan_12---- column_names row_count distinct_count null_count -{p_name} 200000 198131 0 +{p_name} 200000 120 0 {p_partkey} 200000 199241 0 ~~~~ column_names row_count_est row_count_err distinct_count_est distinct_count_err null_count_est null_count_err -{p_name} 200000.00 1.00 198131.00 1.00 0.00 1.00 +{p_name} 200000.00 1.00 198131.00 1651.09 <== 0.00 1.00 {p_partkey} 200000.00 1.00 199241.00 1.00 0.00 1.00 ----Stats for q9_scan_13---- column_names row_count distinct_count null_count -{ps_partkey} 800000 199241 0 -{ps_suppkey} 800000 9920 0 -{ps_supplycost} 800000 100379 0 +{ps_partkey} 0 0 0 +{ps_suppkey} 0 0 0 +{ps_supplycost} 0 0 0 ~~~~ column_names row_count_est row_count_err distinct_count_est distinct_count_err null_count_est null_count_err -{ps_partkey} 800000.00 1.00 199241.00 1.00 0.00 1.00 -{ps_suppkey} 800000.00 1.00 9920.00 1.00 0.00 1.00 -{ps_supplycost} 800000.00 1.00 100379.00 1.00 0.00 1.00 +{ps_partkey} 800000.00 +Inf <== 199241.00 +Inf <== 0.00 1.00 +{ps_suppkey} 800000.00 +Inf <== 9920.00 +Inf <== 0.00 1.00 +{ps_supplycost} 800000.00 +Inf <== 100379.00 +Inf <== 0.00 1.00 ----Stats for q9_scan_14---- column_names row_count distinct_count null_count diff --git a/pkg/sql/opt/memo/testdata/stats_quality/tpch/q10 b/pkg/sql/opt/memo/testdata/stats_quality/tpch/q10 index 0ec66d3ae389..e1c1f3a10381 100644 --- a/pkg/sql/opt/memo/testdata/stats_quality/tpch/q10 +++ b/pkg/sql/opt/memo/testdata/stats_quality/tpch/q10 @@ -67,7 +67,7 @@ limit │ ├── save-table-name: q10_sort_2 │ ├── columns: c_custkey:1(int!null) c_name:2(varchar!null) c_address:3(varchar!null) c_phone:5(char!null) c_acctbal:6(float!null) c_comment:8(varchar!null) n_name:38(char!null) sum:43(float!null) │ ├── immutable - │ ├── stats: [rows=33172.4448, distinct(1)=33172.4448, null(1)=0, distinct(2)=33172.4448, null(2)=0, distinct(3)=33172.4448, null(3)=0, distinct(5)=33172.4448, null(5)=0, distinct(6)=33172.4448, null(6)=0, distinct(8)=33172.4448, null(8)=0, distinct(38)=33172.4448, null(38)=0, distinct(43)=33172.4448, null(43)=0] + │ ├── stats: [rows=43895.519, distinct(1)=43895.519, null(1)=0, distinct(2)=43895.519, null(2)=0, distinct(3)=43895.519, null(3)=0, distinct(5)=43895.519, null(5)=0, distinct(6)=43895.519, null(6)=0, distinct(8)=43895.519, null(8)=0, distinct(38)=43895.519, null(38)=0, distinct(43)=43895.519, null(43)=0] │ ├── key: (1) │ ├── fd: (1)-->(2,3,5,6,8,38,43) │ ├── ordering: -43 @@ -77,26 +77,26 @@ limit │ ├── columns: c_custkey:1(int!null) c_name:2(varchar!null) c_address:3(varchar!null) c_phone:5(char!null) c_acctbal:6(float!null) c_comment:8(varchar!null) n_name:38(char!null) sum:43(float!null) │ ├── grouping columns: c_custkey:1(int!null) │ ├── immutable - │ ├── stats: [rows=33172.4448, distinct(1)=33172.4448, null(1)=0, distinct(2)=33172.4448, null(2)=0, distinct(3)=33172.4448, null(3)=0, distinct(5)=33172.4448, null(5)=0, distinct(6)=33172.4448, null(6)=0, distinct(8)=33172.4448, null(8)=0, distinct(38)=33172.4448, null(38)=0, distinct(43)=33172.4448, null(43)=0] + │ ├── stats: [rows=43895.519, distinct(1)=43895.519, null(1)=0, distinct(2)=43895.519, null(2)=0, distinct(3)=43895.519, null(3)=0, distinct(5)=43895.519, null(5)=0, distinct(6)=43895.519, null(6)=0, distinct(8)=43895.519, null(8)=0, distinct(38)=43895.519, null(38)=0, distinct(43)=43895.519, null(43)=0] │ ├── key: (1) │ ├── fd: (1)-->(2,3,5,6,8,38,43) │ ├── project │ │ ├── save-table-name: q10_project_4 │ │ ├── columns: column42:42(float!null) c_custkey:1(int!null) c_name:2(varchar!null) c_address:3(varchar!null) c_phone:5(char!null) c_acctbal:6(float!null) c_comment:8(varchar!null) n_name:38(char!null) │ │ ├── immutable - │ │ ├── stats: [rows=82076.3181, distinct(1)=33172.4448, null(1)=0, distinct(2)=46412.2874, null(2)=0, distinct(3)=46409.7632, null(3)=0, distinct(5)=46412.2874, null(5)=0, distinct(6)=46012.5171, null(6)=0, distinct(8)=46385.053, null(8)=0, distinct(38)=25, null(38)=0, distinct(42)=41180.4573, null(42)=0] + │ │ ├── stats: [rows=82076.3181, distinct(1)=43895.519, null(1)=0, distinct(2)=82076.3181, null(2)=0, distinct(3)=82076.3181, null(3)=0, distinct(5)=82076.3181, null(5)=0, distinct(6)=82076.3181, null(6)=0, distinct(8)=82076.3181, null(8)=0, distinct(38)=25, null(38)=0, distinct(42)=81426.8208, null(42)=0] │ │ ├── fd: (1)-->(2,3,5,6,8,38) │ │ ├── inner-join (hash) │ │ │ ├── save-table-name: q10_inner_join_5 │ │ │ ├── columns: c_custkey:1(int!null) c_name:2(varchar!null) c_address:3(varchar!null) c_nationkey:4(int!null) c_phone:5(char!null) c_acctbal:6(float!null) c_comment:8(varchar!null) o_orderkey:10(int!null) o_custkey:11(int!null) o_orderdate:14(date!null) l_orderkey:20(int!null) l_extendedprice:25(float!null) l_discount:26(float!null) l_returnflag:28(char!null) n_nationkey:37(int!null) n_name:38(char!null) │ │ │ ├── multiplicity: left-rows(exactly-one), right-rows(zero-or-more) - │ │ │ ├── stats: [rows=82076.3181, distinct(1)=33172.4448, null(1)=0, distinct(2)=46412.2874, null(2)=0, distinct(3)=46409.7632, null(3)=0, distinct(4)=25, null(4)=0, distinct(5)=46412.2874, null(5)=0, distinct(6)=46012.5171, null(6)=0, distinct(8)=46385.053, null(8)=0, distinct(10)=37088.4198, null(10)=0, distinct(11)=33172.4448, null(11)=0, distinct(14)=92, null(14)=0, distinct(20)=37088.4198, null(20)=0, distinct(25)=40916.4266, null(25)=0, distinct(26)=11, null(26)=0, distinct(28)=1, null(28)=0, distinct(37)=25, null(37)=0, distinct(38)=25, null(38)=0, distinct(25,26)=41180.4573, null(25,26)=0] + │ │ │ ├── stats: [rows=82076.3181, distinct(1)=43895.519, null(1)=0, distinct(2)=82076.3181, null(2)=0, distinct(3)=82076.3181, null(3)=0, distinct(4)=25, null(4)=0, distinct(5)=82076.3181, null(5)=0, distinct(6)=82076.3181, null(6)=0, distinct(8)=82076.3181, null(8)=0, distinct(10)=56726.5385, null(10)=0, distinct(11)=43895.519, null(11)=0, distinct(14)=92, null(14)=0, distinct(20)=56726.5385, null(20)=0, distinct(25)=81426.8208, null(25)=0, distinct(26)=11, null(26)=0, distinct(28)=1, null(28)=0, distinct(37)=25, null(37)=0, distinct(38)=25, null(38)=0, distinct(25,26)=81426.8208, null(25,26)=0] │ │ │ ├── fd: ()-->(28), (1)-->(2-6,8), (10)-->(11,14), (10)==(20), (20)==(10), (1)==(11), (11)==(1), (37)-->(38), (4)==(37), (37)==(4) │ │ │ ├── inner-join (hash) │ │ │ │ ├── save-table-name: q10_inner_join_6 │ │ │ │ ├── columns: c_custkey:1(int!null) c_name:2(varchar!null) c_address:3(varchar!null) c_nationkey:4(int!null) c_phone:5(char!null) c_acctbal:6(float!null) c_comment:8(varchar!null) o_orderkey:10(int!null) o_custkey:11(int!null) o_orderdate:14(date!null) l_orderkey:20(int!null) l_extendedprice:25(float!null) l_discount:26(float!null) l_returnflag:28(char!null) │ │ │ │ ├── multiplicity: left-rows(zero-or-more), right-rows(exactly-one) - │ │ │ │ ├── stats: [rows=82076.3181, distinct(1)=37028.0412, null(1)=0, distinct(2)=63212.8993, null(2)=0, distinct(3)=63206.2925, null(3)=0, distinct(4)=25, null(4)=0, distinct(5)=63212.8993, null(5)=0, distinct(6)=62176.9567, null(6)=0, distinct(8)=63141.6616, null(8)=0, distinct(10)=43378.6208, null(10)=0, distinct(11)=37028.0412, null(11)=0, distinct(14)=92, null(14)=0, distinct(20)=43378.6208, null(20)=0, distinct(25)=50563.2192, null(25)=0, distinct(26)=11, null(26)=0, distinct(28)=1, null(28)=0, distinct(25,26)=51101.6377, null(25,26)=0] + │ │ │ │ ├── stats: [rows=82076.3181, distinct(1)=43895.519, null(1)=0, distinct(2)=82076.3181, null(2)=0, distinct(3)=82076.3181, null(3)=0, distinct(4)=25, null(4)=0, distinct(5)=82076.3181, null(5)=0, distinct(6)=82076.3181, null(6)=0, distinct(8)=82076.3181, null(8)=0, distinct(10)=56726.5385, null(10)=0, distinct(11)=43895.519, null(11)=0, distinct(14)=92, null(14)=0, distinct(20)=56726.5385, null(20)=0, distinct(25)=81426.8208, null(25)=0, distinct(26)=11, null(26)=0, distinct(28)=1, null(28)=0, distinct(25,26)=81426.8208, null(25,26)=0] │ │ │ │ ├── fd: ()-->(28), (1)-->(2-6,8), (10)-->(11,14), (10)==(20), (20)==(10), (1)==(11), (11)==(1) │ │ │ │ ├── scan customer │ │ │ │ │ ├── save-table-name: q10_scan_7 @@ -122,7 +122,7 @@ limit │ │ │ │ │ ├── save-table-name: q10_lookup_join_8 │ │ │ │ │ ├── columns: o_orderkey:10(int!null) o_custkey:11(int!null) o_orderdate:14(date!null) l_orderkey:20(int!null) l_extendedprice:25(float!null) l_discount:26(float!null) l_returnflag:28(char!null) │ │ │ │ │ ├── key columns: [10] = [20] - │ │ │ │ │ ├── stats: [rows=81426.8208, distinct(10)=56726.5385, null(10)=0, distinct(11)=37028.0412, null(11)=0, distinct(14)=92, null(14)=0, distinct(20)=56726.5385, null(20)=0, distinct(25)=77287.0368, null(25)=0, distinct(26)=11, null(26)=0, distinct(28)=1, null(28)=0, distinct(25,26)=79194.3703, null(25,26)=0] + │ │ │ │ │ ├── stats: [rows=81426.8208, distinct(10)=56726.5385, null(10)=0, distinct(11)=43895.519, null(11)=0, distinct(14)=92, null(14)=0, distinct(20)=56726.5385, null(20)=0, distinct(25)=81426.8208, null(25)=0, distinct(26)=11, null(26)=0, distinct(28)=1, null(28)=0, distinct(25,26)=81426.8208, null(25,26)=0] │ │ │ │ │ ├── fd: ()-->(28), (10)-->(11,14), (10)==(20), (20)==(10) │ │ │ │ │ ├── index-join orders │ │ │ │ │ │ ├── save-table-name: q10_index_join_9 @@ -211,14 +211,14 @@ column_names row_count distinct_count null_count {sum} 0 0 0 ~~~~ column_names row_count_est row_count_err distinct_count_est distinct_count_err null_count_est null_count_err -{c_acctbal} 33172.00 +Inf <== 33172.00 +Inf <== 0.00 1.00 -{c_address} 33172.00 +Inf <== 33172.00 +Inf <== 0.00 1.00 -{c_comment} 33172.00 +Inf <== 33172.00 +Inf <== 0.00 1.00 -{c_custkey} 33172.00 +Inf <== 33172.00 +Inf <== 0.00 1.00 -{c_name} 33172.00 +Inf <== 33172.00 +Inf <== 0.00 1.00 -{c_phone} 33172.00 +Inf <== 33172.00 +Inf <== 0.00 1.00 -{n_name} 33172.00 +Inf <== 33172.00 +Inf <== 0.00 1.00 -{sum} 33172.00 +Inf <== 33172.00 +Inf <== 0.00 1.00 +{c_acctbal} 43896.00 +Inf <== 43896.00 +Inf <== 0.00 1.00 +{c_address} 43896.00 +Inf <== 43896.00 +Inf <== 0.00 1.00 +{c_comment} 43896.00 +Inf <== 43896.00 +Inf <== 0.00 1.00 +{c_custkey} 43896.00 +Inf <== 43896.00 +Inf <== 0.00 1.00 +{c_name} 43896.00 +Inf <== 43896.00 +Inf <== 0.00 1.00 +{c_phone} 43896.00 +Inf <== 43896.00 +Inf <== 0.00 1.00 +{n_name} 43896.00 +Inf <== 43896.00 +Inf <== 0.00 1.00 +{sum} 43896.00 +Inf <== 43896.00 +Inf <== 0.00 1.00 ----Stats for q10_group_by_3---- column_names row_count distinct_count null_count @@ -232,14 +232,14 @@ column_names row_count distinct_count null_count {sum} 37967 37881 0 ~~~~ column_names row_count_est row_count_err distinct_count_est distinct_count_err null_count_est null_count_err -{c_acctbal} 33172.00 1.14 33172.00 1.14 0.00 1.00 -{c_address} 33172.00 1.14 33172.00 1.15 0.00 1.00 -{c_comment} 33172.00 1.14 33172.00 1.15 0.00 1.00 -{c_custkey} 33172.00 1.14 33172.00 1.14 0.00 1.00 -{c_name} 33172.00 1.14 33172.00 1.14 0.00 1.00 -{c_phone} 33172.00 1.14 33172.00 1.15 0.00 1.00 -{n_name} 33172.00 1.14 33172.00 1326.88 <== 0.00 1.00 -{sum} 33172.00 1.14 33172.00 1.14 0.00 1.00 +{c_acctbal} 43896.00 1.16 43896.00 1.17 0.00 1.00 +{c_address} 43896.00 1.16 43896.00 1.15 0.00 1.00 +{c_comment} 43896.00 1.16 43896.00 1.15 0.00 1.00 +{c_custkey} 43896.00 1.16 43896.00 1.16 0.00 1.00 +{c_name} 43896.00 1.16 43896.00 1.16 0.00 1.00 +{c_phone} 43896.00 1.16 43896.00 1.15 0.00 1.00 +{n_name} 43896.00 1.16 43896.00 1755.84 <== 0.00 1.00 +{sum} 43896.00 1.16 43896.00 1.16 0.00 1.00 ----Stats for q10_project_4---- column_names row_count distinct_count null_count @@ -253,13 +253,13 @@ column_names row_count distinct_count null_count {n_name} 114705 25 0 ~~~~ column_names row_count_est row_count_err distinct_count_est distinct_count_err null_count_est null_count_err -{c_acctbal} 82076.00 1.40 46013.00 1.22 0.00 1.00 -{c_address} 82076.00 1.40 46410.00 1.22 0.00 1.00 -{c_comment} 82076.00 1.40 46385.00 1.22 0.00 1.00 -{c_custkey} 82076.00 1.40 33172.00 1.14 0.00 1.00 -{c_name} 82076.00 1.40 46412.00 1.23 0.00 1.00 -{c_phone} 82076.00 1.40 46412.00 1.22 0.00 1.00 -{column42} 82076.00 1.40 41180.00 2.78 <== 0.00 1.00 +{c_acctbal} 82076.00 1.40 82076.00 2.18 <== 0.00 1.00 +{c_address} 82076.00 1.40 82076.00 2.16 <== 0.00 1.00 +{c_comment} 82076.00 1.40 82076.00 2.16 <== 0.00 1.00 +{c_custkey} 82076.00 1.40 43896.00 1.16 0.00 1.00 +{c_name} 82076.00 1.40 82076.00 2.17 <== 0.00 1.00 +{c_phone} 82076.00 1.40 82076.00 2.16 <== 0.00 1.00 +{column42} 82076.00 1.40 81427.00 1.41 0.00 1.00 {n_name} 82076.00 1.40 25.00 1.00 0.00 1.00 ----Stats for q10_inner_join_5---- @@ -282,22 +282,22 @@ column_names row_count distinct_count null_count {o_orderkey} 114705 48516 0 ~~~~ column_names row_count_est row_count_err distinct_count_est distinct_count_err null_count_est null_count_err -{c_acctbal} 82076.00 1.40 46013.00 1.22 0.00 1.00 -{c_address} 82076.00 1.40 46410.00 1.22 0.00 1.00 -{c_comment} 82076.00 1.40 46385.00 1.22 0.00 1.00 -{c_custkey} 82076.00 1.40 33172.00 1.14 0.00 1.00 -{c_name} 82076.00 1.40 46412.00 1.23 0.00 1.00 +{c_acctbal} 82076.00 1.40 82076.00 2.18 <== 0.00 1.00 +{c_address} 82076.00 1.40 82076.00 2.16 <== 0.00 1.00 +{c_comment} 82076.00 1.40 82076.00 2.16 <== 0.00 1.00 +{c_custkey} 82076.00 1.40 43896.00 1.16 0.00 1.00 +{c_name} 82076.00 1.40 82076.00 2.17 <== 0.00 1.00 {c_nationkey} 82076.00 1.40 25.00 1.00 0.00 1.00 -{c_phone} 82076.00 1.40 46412.00 1.22 0.00 1.00 +{c_phone} 82076.00 1.40 82076.00 2.16 <== 0.00 1.00 {l_discount} 82076.00 1.40 11.00 1.00 0.00 1.00 -{l_extendedprice} 82076.00 1.40 40916.00 2.60 <== 0.00 1.00 -{l_orderkey} 82076.00 1.40 37088.00 1.31 0.00 1.00 +{l_extendedprice} 82076.00 1.40 81427.00 1.30 0.00 1.00 +{l_orderkey} 82076.00 1.40 56727.00 1.17 0.00 1.00 {l_returnflag} 82076.00 1.40 1.00 1.00 0.00 1.00 {n_name} 82076.00 1.40 25.00 1.00 0.00 1.00 {n_nationkey} 82076.00 1.40 25.00 1.00 0.00 1.00 -{o_custkey} 82076.00 1.40 33172.00 1.14 0.00 1.00 +{o_custkey} 82076.00 1.40 43896.00 1.16 0.00 1.00 {o_orderdate} 82076.00 1.40 92.00 1.00 0.00 1.00 -{o_orderkey} 82076.00 1.40 37088.00 1.31 0.00 1.00 +{o_orderkey} 82076.00 1.40 56727.00 1.17 0.00 1.00 ----Stats for q10_inner_join_6---- column_names row_count distinct_count null_count @@ -317,20 +317,20 @@ column_names row_count distinct_count null_count {o_orderkey} 114705 48516 0 ~~~~ column_names row_count_est row_count_err distinct_count_est distinct_count_err null_count_est null_count_err -{c_acctbal} 82076.00 1.40 62177.00 1.65 0.00 1.00 -{c_address} 82076.00 1.40 63206.00 1.66 0.00 1.00 -{c_comment} 82076.00 1.40 63142.00 1.66 0.00 1.00 -{c_custkey} 82076.00 1.40 37028.00 1.02 0.00 1.00 -{c_name} 82076.00 1.40 63213.00 1.67 0.00 1.00 +{c_acctbal} 82076.00 1.40 82076.00 2.18 <== 0.00 1.00 +{c_address} 82076.00 1.40 82076.00 2.16 <== 0.00 1.00 +{c_comment} 82076.00 1.40 82076.00 2.16 <== 0.00 1.00 +{c_custkey} 82076.00 1.40 43896.00 1.16 0.00 1.00 +{c_name} 82076.00 1.40 82076.00 2.17 <== 0.00 1.00 {c_nationkey} 82076.00 1.40 25.00 1.00 0.00 1.00 -{c_phone} 82076.00 1.40 63213.00 1.66 0.00 1.00 +{c_phone} 82076.00 1.40 82076.00 2.16 <== 0.00 1.00 {l_discount} 82076.00 1.40 11.00 1.00 0.00 1.00 -{l_extendedprice} 82076.00 1.40 50563.00 2.10 <== 0.00 1.00 -{l_orderkey} 82076.00 1.40 43379.00 1.12 0.00 1.00 +{l_extendedprice} 82076.00 1.40 81427.00 1.30 0.00 1.00 +{l_orderkey} 82076.00 1.40 56727.00 1.17 0.00 1.00 {l_returnflag} 82076.00 1.40 1.00 1.00 0.00 1.00 -{o_custkey} 82076.00 1.40 37028.00 1.02 0.00 1.00 +{o_custkey} 82076.00 1.40 43896.00 1.16 0.00 1.00 {o_orderdate} 82076.00 1.40 92.00 1.00 0.00 1.00 -{o_orderkey} 82076.00 1.40 43379.00 1.12 0.00 1.00 +{o_orderkey} 82076.00 1.40 56727.00 1.17 0.00 1.00 ----Stats for q10_scan_7---- column_names row_count distinct_count null_count @@ -363,10 +363,10 @@ column_names row_count distinct_count null_count ~~~~ column_names row_count_est row_count_err distinct_count_est distinct_count_err null_count_est null_count_err {l_discount} 81427.00 1.41 11.00 1.00 0.00 1.00 -{l_extendedprice} 81427.00 1.41 77287.00 1.37 0.00 1.00 +{l_extendedprice} 81427.00 1.41 81427.00 1.30 0.00 1.00 {l_orderkey} 81427.00 1.41 56727.00 1.17 0.00 1.00 {l_returnflag} 81427.00 1.41 1.00 1.00 0.00 1.00 -{o_custkey} 81427.00 1.41 37028.00 1.02 0.00 1.00 +{o_custkey} 81427.00 1.41 43896.00 1.16 0.00 1.00 {o_orderdate} 81427.00 1.41 92.00 1.00 0.00 1.00 {o_orderkey} 81427.00 1.41 56727.00 1.17 0.00 1.00 diff --git a/pkg/sql/opt/memo/testdata/stats_quality/tpch/q11 b/pkg/sql/opt/memo/testdata/stats_quality/tpch/q11 index b65679276ea8..5eaa9002268a 100644 --- a/pkg/sql/opt/memo/testdata/stats_quality/tpch/q11 +++ b/pkg/sql/opt/memo/testdata/stats_quality/tpch/q11 @@ -48,7 +48,7 @@ sort ├── save-table-name: q11_sort_1 ├── columns: ps_partkey:1(int!null) value:21(float!null) ├── immutable - ├── stats: [rows=9927.82897, distinct(1)=9927.82897, null(1)=0, distinct(21)=9927.82897, null(21)=0] + ├── stats: [rows=10752.6882, distinct(1)=10752.6882, null(1)=0, distinct(21)=10752.6882, null(21)=0] ├── key: (1) ├── fd: (1)-->(21) ├── ordering: -21 @@ -56,7 +56,7 @@ sort ├── save-table-name: q11_select_2 ├── columns: ps_partkey:1(int!null) sum:21(float!null) ├── immutable - ├── stats: [rows=9927.82897, distinct(1)=9927.82897, null(1)=0, distinct(21)=9927.82897, null(21)=0] + ├── stats: [rows=10752.6882, distinct(1)=10752.6882, null(1)=0, distinct(21)=10752.6882, null(21)=0] ├── key: (1) ├── fd: (1)-->(21) ├── group-by @@ -64,34 +64,34 @@ sort │ ├── columns: ps_partkey:1(int!null) sum:21(float!null) │ ├── grouping columns: ps_partkey:1(int!null) │ ├── immutable - │ ├── stats: [rows=29783.4869, distinct(1)=29783.4869, null(1)=0, distinct(21)=29783.4869, null(21)=0] + │ ├── stats: [rows=32258.0645, distinct(1)=32258.0645, null(1)=0, distinct(21)=32258.0645, null(21)=0] │ ├── key: (1) │ ├── fd: (1)-->(21) │ ├── project │ │ ├── save-table-name: q11_project_4 │ │ ├── columns: column20:20(float!null) ps_partkey:1(int!null) │ │ ├── immutable - │ │ ├── stats: [rows=32258.0645, distinct(1)=29783.4869, null(1)=0, distinct(20)=31617.9161, null(20)=0] + │ │ ├── stats: [rows=32258.0645, distinct(1)=32258.0645, null(1)=0, distinct(20)=32258.0645, null(20)=0] │ │ ├── inner-join (lookup partsupp) │ │ │ ├── save-table-name: q11_lookup_join_5 │ │ │ ├── columns: ps_partkey:1(int!null) ps_suppkey:2(int!null) ps_availqty:3(int!null) ps_supplycost:4(float!null) s_suppkey:7(int!null) s_nationkey:10(int!null) n_nationkey:15(int!null) n_name:16(char!null) │ │ │ ├── key columns: [1 2] = [1 2] │ │ │ ├── lookup columns are key - │ │ │ ├── stats: [rows=32258.0645, distinct(1)=29783.4869, null(1)=0, distinct(2)=399.934613, null(2)=0, distinct(3)=9536.12259, null(3)=0, distinct(4)=27589.3232, null(4)=0, distinct(7)=399.934613, null(7)=0, distinct(10)=1, null(10)=0, distinct(15)=1, null(15)=0, distinct(16)=1, null(16)=0, distinct(3,4)=31617.9161, null(3,4)=0] + │ │ │ ├── stats: [rows=32258.0645, distinct(1)=32258.0645, null(1)=0, distinct(2)=400, null(2)=0, distinct(3)=9920, null(3)=0, distinct(4)=32258.0645, null(4)=0, distinct(7)=400, null(7)=0, distinct(10)=1, null(10)=0, distinct(15)=1, null(15)=0, distinct(16)=1, null(16)=0, distinct(3,4)=32258.0645, null(3,4)=0] │ │ │ ├── key: (1,7) │ │ │ ├── fd: ()-->(16), (1,2)-->(3,4), (7)-->(10), (10)==(15), (15)==(10), (2)==(7), (7)==(2) │ │ │ ├── inner-join (lookup partsupp@ps_sk) │ │ │ │ ├── save-table-name: q11_lookup_join_6 │ │ │ │ ├── columns: ps_partkey:1(int!null) ps_suppkey:2(int!null) s_suppkey:7(int!null) s_nationkey:10(int!null) n_nationkey:15(int!null) n_name:16(char!null) │ │ │ │ ├── key columns: [7] = [2] - │ │ │ │ ├── stats: [rows=32258.0645, distinct(1)=29783.4869, null(1)=0, distinct(2)=399.934613, null(2)=0, distinct(7)=399.934613, null(7)=0, distinct(10)=1, null(10)=0, distinct(15)=1, null(15)=0, distinct(16)=1, null(16)=0] + │ │ │ │ ├── stats: [rows=32258.0645, distinct(1)=32258.0645, null(1)=0, distinct(2)=400, null(2)=0, distinct(7)=400, null(7)=0, distinct(10)=1, null(10)=0, distinct(15)=1, null(15)=0, distinct(16)=1, null(16)=0] │ │ │ │ ├── key: (1,7) │ │ │ │ ├── fd: ()-->(16), (7)-->(10), (10)==(15), (15)==(10), (2)==(7), (7)==(2) │ │ │ │ ├── inner-join (lookup supplier@s_nk) │ │ │ │ │ ├── save-table-name: q11_lookup_join_7 │ │ │ │ │ ├── columns: s_suppkey:7(int!null) s_nationkey:10(int!null) n_nationkey:15(int!null) n_name:16(char!null) │ │ │ │ │ ├── key columns: [15] = [10] - │ │ │ │ │ ├── stats: [rows=400, distinct(7)=399.934613, null(7)=0, distinct(10)=1, null(10)=0, distinct(15)=1, null(15)=0, distinct(16)=1, null(16)=0] + │ │ │ │ │ ├── stats: [rows=400, distinct(7)=400, null(7)=0, distinct(10)=1, null(10)=0, distinct(15)=1, null(15)=0, distinct(16)=1, null(16)=0] │ │ │ │ │ ├── key: (7) │ │ │ │ │ ├── fd: ()-->(16), (7)-->(10), (10)==(15), (15)==(10) │ │ │ │ │ ├── select @@ -146,26 +146,26 @@ sort │ │ ├── save-table-name: q11_project_12 │ │ ├── columns: column41:41(float!null) │ │ ├── immutable - │ │ ├── stats: [rows=32258.0645, distinct(41)=31617.9161, null(41)=0] + │ │ ├── stats: [rows=32258.0645, distinct(41)=32258.0645, null(41)=0] │ │ ├── inner-join (lookup partsupp) │ │ │ ├── save-table-name: q11_lookup_join_13 │ │ │ ├── columns: ps_suppkey:23(int!null) ps_availqty:24(int!null) ps_supplycost:25(float!null) s_suppkey:28(int!null) s_nationkey:31(int!null) n_nationkey:36(int!null) n_name:37(char!null) │ │ │ ├── key columns: [22 23] = [22 23] │ │ │ ├── lookup columns are key - │ │ │ ├── stats: [rows=32258.0645, distinct(23)=399.934613, null(23)=0, distinct(24)=9536.12259, null(24)=0, distinct(25)=27589.3232, null(25)=0, distinct(28)=399.934613, null(28)=0, distinct(31)=1, null(31)=0, distinct(36)=1, null(36)=0, distinct(37)=1, null(37)=0, distinct(24,25)=31617.9161, null(24,25)=0] + │ │ │ ├── stats: [rows=32258.0645, distinct(23)=400, null(23)=0, distinct(24)=9920, null(24)=0, distinct(25)=32258.0645, null(25)=0, distinct(28)=400, null(28)=0, distinct(31)=1, null(31)=0, distinct(36)=1, null(36)=0, distinct(37)=1, null(37)=0, distinct(24,25)=32258.0645, null(24,25)=0] │ │ │ ├── fd: ()-->(37), (28)-->(31), (31)==(36), (36)==(31), (23)==(28), (28)==(23) │ │ │ ├── inner-join (lookup partsupp@ps_sk) │ │ │ │ ├── save-table-name: q11_lookup_join_14 │ │ │ │ ├── columns: ps_partkey:22(int!null) ps_suppkey:23(int!null) s_suppkey:28(int!null) s_nationkey:31(int!null) n_nationkey:36(int!null) n_name:37(char!null) │ │ │ │ ├── key columns: [28] = [23] - │ │ │ │ ├── stats: [rows=32258.0645, distinct(22)=29783.4869, null(22)=0, distinct(23)=399.934613, null(23)=0, distinct(28)=399.934613, null(28)=0, distinct(31)=1, null(31)=0, distinct(36)=1, null(36)=0, distinct(37)=1, null(37)=0] + │ │ │ │ ├── stats: [rows=32258.0645, distinct(22)=32258.0645, null(22)=0, distinct(23)=400, null(23)=0, distinct(28)=400, null(28)=0, distinct(31)=1, null(31)=0, distinct(36)=1, null(36)=0, distinct(37)=1, null(37)=0] │ │ │ │ ├── key: (22,28) │ │ │ │ ├── fd: ()-->(37), (28)-->(31), (31)==(36), (36)==(31), (23)==(28), (28)==(23) │ │ │ │ ├── inner-join (lookup supplier@s_nk) │ │ │ │ │ ├── save-table-name: q11_lookup_join_15 │ │ │ │ │ ├── columns: s_suppkey:28(int!null) s_nationkey:31(int!null) n_nationkey:36(int!null) n_name:37(char!null) │ │ │ │ │ ├── key columns: [36] = [31] - │ │ │ │ │ ├── stats: [rows=400, distinct(28)=399.934613, null(28)=0, distinct(31)=1, null(31)=0, distinct(36)=1, null(36)=0, distinct(37)=1, null(37)=0] + │ │ │ │ │ ├── stats: [rows=400, distinct(28)=400, null(28)=0, distinct(31)=1, null(31)=0, distinct(36)=1, null(36)=0, distinct(37)=1, null(37)=0] │ │ │ │ │ ├── key: (28) │ │ │ │ │ ├── fd: ()-->(37), (28)-->(31), (31)==(36), (36)==(31) │ │ │ │ │ ├── select @@ -205,8 +205,8 @@ column_names row_count distinct_count null_count {value} 1048 1048 0 ~~~~ column_names row_count_est row_count_err distinct_count_est distinct_count_err null_count_est null_count_err -{ps_partkey} 9928.00 9.47 <== 9928.00 9.47 <== 0.00 1.00 -{value} 9928.00 9.47 <== 9928.00 9.47 <== 0.00 1.00 +{ps_partkey} 10753.00 10.26 <== 10753.00 10.26 <== 0.00 1.00 +{value} 10753.00 10.26 <== 10753.00 10.26 <== 0.00 1.00 ----Stats for q11_select_2---- column_names row_count distinct_count null_count @@ -214,8 +214,8 @@ column_names row_count distinct_count null_count {sum} 1048 1048 0 ~~~~ column_names row_count_est row_count_err distinct_count_est distinct_count_err null_count_est null_count_err -{ps_partkey} 9928.00 9.47 <== 9928.00 9.47 <== 0.00 1.00 -{sum} 9928.00 9.47 <== 9928.00 9.47 <== 0.00 1.00 +{ps_partkey} 10753.00 10.26 <== 10753.00 10.26 <== 0.00 1.00 +{sum} 10753.00 10.26 <== 10753.00 10.26 <== 0.00 1.00 ----Stats for q11_group_by_3---- column_names row_count distinct_count null_count @@ -223,8 +223,8 @@ column_names row_count distinct_count null_count {sum} 29818 29969 0 ~~~~ column_names row_count_est row_count_err distinct_count_est distinct_count_err null_count_est null_count_err -{ps_partkey} 29783.00 1.00 29783.00 1.00 0.00 1.00 -{sum} 29783.00 1.00 29783.00 1.01 0.00 1.00 +{ps_partkey} 32258.00 1.08 32258.00 1.09 0.00 1.00 +{sum} 32258.00 1.08 32258.00 1.08 0.00 1.00 ----Stats for q11_project_4---- column_names row_count distinct_count null_count @@ -232,8 +232,8 @@ column_names row_count distinct_count null_count {ps_partkey} 31680 29669 0 ~~~~ column_names row_count_est row_count_err distinct_count_est distinct_count_err null_count_est null_count_err -{column20} 32258.00 1.02 31618.00 1.01 0.00 1.00 -{ps_partkey} 32258.00 1.02 29783.00 1.00 0.00 1.00 +{column20} 32258.00 1.02 32258.00 1.01 0.00 1.00 +{ps_partkey} 32258.00 1.02 32258.00 1.09 0.00 1.00 ----Stats for q11_lookup_join_5---- column_names row_count distinct_count null_count @@ -249,10 +249,10 @@ column_names row_count distinct_count null_count column_names row_count_est row_count_err distinct_count_est distinct_count_err null_count_est null_count_err {n_name} 32258.00 1.02 1.00 1.00 0.00 1.00 {n_nationkey} 32258.00 1.02 1.00 1.00 0.00 1.00 -{ps_availqty} 32258.00 1.02 9536.00 1.00 0.00 1.00 -{ps_partkey} 32258.00 1.02 29783.00 1.00 0.00 1.00 +{ps_availqty} 32258.00 1.02 9920.00 1.04 0.00 1.00 +{ps_partkey} 32258.00 1.02 32258.00 1.09 0.00 1.00 {ps_suppkey} 32258.00 1.02 400.00 1.01 0.00 1.00 -{ps_supplycost} 32258.00 1.02 27589.00 1.01 0.00 1.00 +{ps_supplycost} 32258.00 1.02 32258.00 1.18 0.00 1.00 {s_nationkey} 32258.00 1.02 1.00 1.00 0.00 1.00 {s_suppkey} 32258.00 1.02 400.00 1.01 0.00 1.00 @@ -268,7 +268,7 @@ column_names row_count distinct_count null_count column_names row_count_est row_count_err distinct_count_est distinct_count_err null_count_est null_count_err {n_name} 32258.00 1.02 1.00 1.00 0.00 1.00 {n_nationkey} 32258.00 1.02 1.00 1.00 0.00 1.00 -{ps_partkey} 32258.00 1.02 29783.00 1.00 0.00 1.00 +{ps_partkey} 32258.00 1.02 32258.00 1.09 0.00 1.00 {ps_suppkey} 32258.00 1.02 400.00 1.01 0.00 1.00 {s_nationkey} 32258.00 1.02 1.00 1.00 0.00 1.00 {s_suppkey} 32258.00 1.02 400.00 1.01 0.00 1.00 @@ -323,7 +323,7 @@ column_names row_count distinct_count null_count {column41} 31680 31888 0 ~~~~ column_names row_count_est row_count_err distinct_count_est distinct_count_err null_count_est null_count_err -{column41} 32258.00 1.02 31618.00 1.01 0.00 1.00 +{column41} 32258.00 1.02 32258.00 1.01 0.00 1.00 ----Stats for q11_lookup_join_13---- column_names row_count distinct_count null_count @@ -338,9 +338,9 @@ column_names row_count distinct_count null_count column_names row_count_est row_count_err distinct_count_est distinct_count_err null_count_est null_count_err {n_name} 32258.00 1.02 1.00 1.00 0.00 1.00 {n_nationkey} 32258.00 1.02 1.00 1.00 0.00 1.00 -{ps_availqty} 32258.00 1.02 9536.00 1.00 0.00 1.00 +{ps_availqty} 32258.00 1.02 9920.00 1.04 0.00 1.00 {ps_suppkey} 32258.00 1.02 400.00 1.01 0.00 1.00 -{ps_supplycost} 32258.00 1.02 27589.00 1.01 0.00 1.00 +{ps_supplycost} 32258.00 1.02 32258.00 1.18 0.00 1.00 {s_nationkey} 32258.00 1.02 1.00 1.00 0.00 1.00 {s_suppkey} 32258.00 1.02 400.00 1.01 0.00 1.00 @@ -356,7 +356,7 @@ column_names row_count distinct_count null_count column_names row_count_est row_count_err distinct_count_est distinct_count_err null_count_est null_count_err {n_name} 32258.00 1.02 1.00 1.00 0.00 1.00 {n_nationkey} 32258.00 1.02 1.00 1.00 0.00 1.00 -{ps_partkey} 32258.00 1.02 29783.00 1.00 0.00 1.00 +{ps_partkey} 32258.00 1.02 32258.00 1.09 0.00 1.00 {ps_suppkey} 32258.00 1.02 400.00 1.01 0.00 1.00 {s_nationkey} 32258.00 1.02 1.00 1.00 0.00 1.00 {s_suppkey} 32258.00 1.02 400.00 1.01 0.00 1.00 diff --git a/pkg/sql/opt/memo/testdata/stats_quality/tpch/q12 b/pkg/sql/opt/memo/testdata/stats_quality/tpch/q12 index e54bd4e2ffa7..a39d53f84361 100644 --- a/pkg/sql/opt/memo/testdata/stats_quality/tpch/q12 +++ b/pkg/sql/opt/memo/testdata/stats_quality/tpch/q12 @@ -72,7 +72,7 @@ sort │ │ ├── columns: o_orderkey:1(int!null) o_orderpriority:6(char!null) l_orderkey:11(int!null) l_shipdate:21(date!null) l_commitdate:22(date!null) l_receiptdate:23(date!null) l_shipmode:25(char!null) │ │ ├── key columns: [11] = [1] │ │ ├── lookup columns are key - │ │ ├── stats: [rows=29194.0597, distinct(1)=28986.6948, null(1)=0, distinct(6)=5, null(6)=0, distinct(11)=28986.6948, null(11)=0, distinct(21)=2525.97584, null(21)=0, distinct(22)=2465.9822, null(22)=0, distinct(23)=365, null(23)=0, distinct(25)=2, null(25)=0] + │ │ ├── stats: [rows=29194.0597, distinct(1)=28986.6948, null(1)=0, distinct(6)=5, null(6)=0, distinct(11)=28986.6948, null(11)=0, distinct(21)=2526, null(21)=0, distinct(22)=2466, null(22)=0, distinct(23)=365, null(23)=0, distinct(25)=2, null(25)=0] │ │ ├── fd: (1)-->(6), (1)==(11), (11)==(1) │ │ ├── select │ │ │ ├── save-table-name: q12_select_5 @@ -85,15 +85,15 @@ sort │ │ │ ├── index-join lineitem │ │ │ │ ├── save-table-name: q12_index_join_6 │ │ │ │ ├── columns: l_orderkey:11(int!null) l_shipdate:21(date!null) l_commitdate:22(date!null) l_receiptdate:23(date!null) l_shipmode:25(char!null) - │ │ │ │ ├── stats: [rows=921271.08, distinct(11)=733843.542, null(11)=0, distinct(21)=2526, null(21)=0, distinct(22)=2466, null(22)=0, distinct(23)=365, null(23)=0, distinct(25)=7, null(25)=0] + │ │ │ │ ├── stats: [rows=921271.08, distinct(11)=921271.08, null(11)=0, distinct(21)=2526, null(21)=0, distinct(22)=2466, null(22)=0, distinct(23)=365, null(23)=0, distinct(25)=7, null(25)=0] │ │ │ │ └── scan lineitem@l_rd │ │ │ │ ├── save-table-name: q12_scan_7 │ │ │ │ ├── columns: l_orderkey:11(int!null) l_linenumber:14(int!null) l_receiptdate:23(date!null) │ │ │ │ ├── constraint: /23/11/14: [/'1994-01-01' - /'1994-12-31'] - │ │ │ │ ├── stats: [rows=921271.08, distinct(11)=733843.542, null(11)=0, distinct(14)=7, null(14)=0, distinct(23)=365, null(23)=0] - │ │ │ │ │ histogram(11)= 0 92.108 4514.1 92.108 4514.1 92.108 4514.1 92.108 4514.1 92.108 4514.1 92.108 4514.1 92.108 4514.1 92.108 4514.1 92.108 4514.1 92.108 4514.1 92.108 4514.1 92.108 4514.1 92.108 4514.1 92.108 4514.1 92.108 4514.1 92.108 4514.1 92.108 4514.1 92.108 4514.1 92.108 4514.1 92.108 4514.1 92.108 4514.1 92.108 4514.1 92.108 4514.1 92.108 4514.1 92.108 4514.1 92.108 4514.1 92.108 4514.1 92.108 4514.1 92.108 4514.1 92.108 4514.1 92.108 4514.1 92.108 4514.1 92.108 4514.1 92.108 4514.1 92.108 4514.1 92.108 4514.1 92.108 4514.1 92.108 4514.1 92.108 4514.1 92.108 4514.1 92.108 4514.1 92.108 4514.1 92.108 4514.1 92.108 4514.1 92.108 4514.1 92.108 4514.1 92.108 4514.1 92.108 4514.1 92.108 4514.1 92.108 4514.1 92.108 4514.1 92.108 4514.1 92.108 4514.1 92.108 4514.1 92.108 4514.1 92.108 4514.1 92.108 4514.1 92.108 4514.1 92.108 4514.1 92.108 4514.1 92.108 4514.1 92.108 4514.1 92.108 4514.1 92.108 4514.1 92.108 4514.1 92.108 4514.1 92.108 4514.1 92.108 4514.1 92.108 4514.1 92.108 4514.1 92.108 4514.1 92.108 4514.1 92.108 4514.1 92.108 4514.1 92.108 4514.1 92.108 4514.1 92.108 4514.1 92.108 4514.1 92.108 4514.1 92.108 4514.1 92.108 4514.1 92.108 4514.1 92.108 4514.1 92.108 4514.1 92.108 4514.1 92.108 4514.1 92.108 4514.1 92.108 4514.1 92.108 4514.1 92.108 4514.1 92.108 4514.1 92.108 4514.1 92.108 4514.1 92.108 4514.1 92.108 4514.1 92.108 4514.1 92.108 4514.1 92.108 4514.1 92.108 4514.1 92.108 4514.1 92.108 4514.1 92.108 4514.1 92.108 4514.1 92.108 4514.1 92.108 4514.1 92.108 4514.1 92.108 4514.1 92.108 4514.1 92.108 4422 184.22 4514.1 92.108 4514.1 92.108 4514.1 92.108 4514.1 92.108 4514.1 92.108 4514.1 92.108 4514.1 92.108 4514.1 92.108 4514.1 92.108 4514.1 92.108 4514.1 92.108 4514.1 92.108 4422 184.22 4514.1 92.108 4514.1 92.108 4514.1 92.108 4514.1 92.108 4514.1 92.108 4514.1 92.108 4514.1 92.108 4514.1 92.108 4514.1 92.108 4514.1 92.108 4514.1 92.108 4514.1 92.108 4514.1 92.108 4514.1 92.108 4514.1 92.108 4514.1 92.108 4514.1 92.108 4514.1 92.108 4514.1 92.108 4514.1 92.108 4514.1 92.108 4514.1 92.108 4514.1 92.108 4514.1 92.108 4514.1 92.108 4514.1 92.108 4514.1 92.108 4514.1 92.108 4606.3 92.108 4606.3 92.108 4606.3 92.108 4606.3 92.108 4606.3 92.108 4606.3 92.108 4606.3 92.108 4606.3 92.108 4606.3 92.108 4606.3 92.108 4606.3 92.108 4606.3 92.108 4606.3 92.108 4606.3 92.108 4606.3 92.108 4606.3 92.108 4606.3 92.108 4606.3 92.108 4606.3 92.108 4606.3 92.108 4606.3 92.108 4606.3 92.108 4606.3 92.108 4606.3 92.108 4606.3 92.108 4606.3 92.108 4606.3 92.108 4606.3 92.108 4606.3 92.108 4606.3 92.108 4606.3 92.108 4606.3 92.108 4606.3 92.108 4606.3 92.108 4606.3 92.108 4606.3 92.108 4606.3 92.108 4606.3 92.108 4606.3 92.108 4606.3 92.108 4606.3 92.108 4606.3 92.108 4606.3 92.108 4606.3 92.108 4606.3 92.108 4606.3 92.108 4606.3 92.108 4606.3 92.108 4606.3 92.108 - │ │ │ │ │ <---- 32 --------- 27780 -------- 60677 -------- 87430 -------- 111814 -------- 139648 -------- 166148 -------- 198051 -------- 232580 -------- 259104 -------- 283460 -------- 311460 -------- 344230 -------- 376102 -------- 408963 -------- 436743 -------- 470368 -------- 503942 -------- 531236 -------- 559395 -------- 589314 -------- 620839 -------- 649670 -------- 672483 -------- 698693 -------- 726629 -------- 756997 -------- 796164 -------- 824327 -------- 855873 -------- 882247 -------- 916418 -------- 951748 -------- 978498 -------- 1005765 -------- 1036864 -------- 1061351 -------- 1093638 -------- 1122308 -------- 1155844 -------- 1191239 -------- 1225540 -------- 1254915 -------- 1281670 -------- 1306721 -------- 1337410 -------- 1368419 -------- 1405382 -------- 1438210 -------- 1465477 -------- 1490627 -------- 1517251 -------- 1544289 -------- 1573729 -------- 1607168 -------- 1635648 -------- 1658848 -------- 1691623 -------- 1718631 -------- 1753345 -------- 1782470 -------- 1812742 -------- 1837702 -------- 1873349 -------- 1905733 -------- 1941024 -------- 1977287 -------- 2005826 -------- 2035300 -------- 2067878 -------- 2093927 -------- 2127906 -------- 2154055 -------- 2181095 -------- 2212035 -------- 2242374 -------- 2263458 -------- 2288481 -------- 2315300 -------- 2340997 -------- 2371200 -------- 2399616 -------- 2429154 -------- 2455393 -------- 2488384 -------- 2521088 -------- 2550885 -------- 2581058 -------- 2610496 -------- 2644197 -------- 2675648 -------- 2698821 -------- 2726246 -------- 2757444 -------- 2792612 -------- 2827174 -------- 2846849 -------- 2881250 -------- 2900739 -------- 2930660 -------- 2962240 -------- 2999235 -------- 3031974 -------- 3060197 -------- 3087586 -------- 3120390 -------- 3147524 -------- 3170721 -------- 3199173 ------ 3230049 -------- 3255008 -------- 3284965 -------- 3315744 -------- 3345376 -------- 3379776 -------- 3405445 -------- 3436711 -------- 3467557 -------- 3489541 -------- 3518179 -------- 3546276 -------- 3568964 ------ 3596039 -------- 3621926 -------- 3644805 -------- 3675361 -------- 3706592 -------- 3735589 -------- 3761220 -------- 3789607 -------- 3820866 -------- 3862274 -------- 3898051 -------- 3925188 -------- 3957157 -------- 3983873 -------- 4013092 -------- 4039202 -------- 4070918 -------- 4105696 -------- 4136867 -------- 4169475 -------- 4205249 -------- 4239013 -------- 4264423 -------- 4292135 -------- 4324453 -------- 4356356 -------- 4392386 -------- 4423074 -------- 4447335 -------- 4469345 -------- 4496513 -------- 4530848 -------- 4565159 -------- 4596965 -------- 4627011 -------- 4662598 -------- 4690818 -------- 4718691 -------- 4749349 -------- 4782722 -------- 4824485 -------- 4856323 -------- 4885795 -------- 4911142 -------- 4945794 -------- 4972801 -------- 5000583 -------- 5033735 -------- 5072421 -------- 5112929 -------- 5145956 -------- 5181923 -------- 5217478 -------- 5247620 -------- 5273605 -------- 5304100 -------- 5343362 -------- 5375842 -------- 5408391 -------- 5439046 -------- 5464610 -------- 5497857 -------- 5528295 -------- 5557956 -------- 5593474 -------- 5626209 -------- 5660931 -------- 5703463 -------- 5733440 -------- 5762565 -------- 5788034 -------- 5813505 -------- 5848227 -------- 5870727 -------- 5908998 -------- 5938311 -------- 5968930 -------- 5999751 - │ │ │ │ │ histogram(14)= 0 2.2903e+05 0 1.9595e+05 0 1.6039e+05 0 1.2971e+05 0 1.0217e+05 0 68727 0 35285 + │ │ │ │ ├── stats: [rows=921271.08, distinct(11)=921271.08, null(11)=0, distinct(14)=7, null(14)=0, distinct(23)=365, null(23)=0] + │ │ │ │ │ histogram(11)= 0 92.111 4514.2 92.111 4514.2 92.111 4514.2 92.111 4514.2 92.111 4514.2 92.111 4514.2 92.111 4514.2 92.111 4514.2 92.111 4514.2 92.111 4514.2 92.111 4514.2 92.111 4514.2 92.111 4514.2 92.111 4514.2 92.111 4514.2 92.111 4514.2 92.111 4514.2 92.111 4514.2 92.111 4514.2 92.111 4514.2 92.111 4514.2 92.111 4514.2 92.111 4514.2 92.111 4514.2 92.111 4514.2 92.111 4514.2 92.111 4514.2 92.111 4514.2 92.111 4514.2 92.111 4514.2 92.111 4514.2 92.111 4514.2 92.111 4514.2 92.111 4514.2 92.111 4514.2 92.111 4514.2 92.111 4514.2 92.111 4514.2 92.111 4514.2 92.111 4514.2 92.111 4514.2 92.111 4514.2 92.111 4514.2 92.111 4514.2 92.111 4514.2 92.111 4514.2 92.111 4514.2 92.111 4514.2 92.111 4514.2 92.111 4514.2 92.111 4514.2 92.111 4514.2 92.111 4514.2 92.111 4514.2 92.111 4514.2 92.111 4514.2 92.111 4514.2 92.111 4514.2 92.111 4514.2 92.111 4514.2 92.111 4514.2 92.111 4514.2 92.111 4514.2 92.111 4514.2 92.111 4514.2 92.111 4514.2 92.111 4514.2 92.111 4514.2 92.111 4514.2 92.111 4514.2 92.111 4514.2 92.111 4514.2 92.111 4514.2 92.111 4514.2 92.111 4514.2 92.111 4514.2 92.111 4514.2 92.111 4514.2 92.111 4514.2 92.111 4514.2 92.111 4514.2 92.111 4514.2 92.111 4514.2 92.111 4514.2 92.111 4514.2 92.111 4514.2 92.111 4514.2 92.111 4514.2 92.111 4514.2 92.111 4514.2 92.111 4514.2 92.111 4514.2 92.111 4514.2 92.111 4514.2 92.111 4514.2 92.111 4514.2 92.111 4514.2 92.111 4514.2 92.111 4514.2 92.111 4514.2 92.111 4514.2 92.111 4514.2 92.111 4514.2 92.111 4514.2 92.111 4514.2 92.111 4514.2 92.111 4514.2 92.111 4514.2 92.111 4422.1 184.22 4514.2 92.111 4514.2 92.111 4514.2 92.111 4514.2 92.111 4514.2 92.111 4514.2 92.111 4514.2 92.111 4514.2 92.111 4514.2 92.111 4514.2 92.111 4514.2 92.111 4514.2 92.111 4422.1 184.22 4514.2 92.111 4514.2 92.111 4514.2 92.111 4514.2 92.111 4514.2 92.111 4514.2 92.111 4514.2 92.111 4514.2 92.111 4514.2 92.111 4514.2 92.111 4514.2 92.111 4514.2 92.111 4514.2 92.111 4514.2 92.111 4514.2 92.111 4514.2 92.111 4514.2 92.111 4514.2 92.111 4514.2 92.111 4514.2 92.111 4514.2 92.111 4514.2 92.111 4514.2 92.111 4514.2 92.111 4514.2 92.111 4514.2 92.111 4514.2 92.111 4514.2 92.111 4606.5 92.111 4606.5 92.111 4606.5 92.111 4606.5 92.111 4606.5 92.111 4606.5 92.111 4606.5 92.111 4606.5 92.111 4606.5 92.111 4606.5 92.111 4606.5 92.111 4606.5 92.111 4606.5 92.111 4606.5 92.111 4606.5 92.111 4606.5 92.111 4606.5 92.111 4606.5 92.111 4606.5 92.111 4606.5 92.111 4606.5 92.111 4606.5 92.111 4606.5 92.111 4606.5 92.111 4606.5 92.111 4606.5 92.111 4606.5 92.111 4606.5 92.111 4606.5 92.111 4606.5 92.111 4606.5 92.111 4606.5 92.111 4606.5 92.111 4606.5 92.111 4606.5 92.111 4606.5 92.111 4606.5 92.111 4606.5 92.111 4606.5 92.111 4606.5 92.111 4606.5 92.111 4606.5 92.111 4606.5 92.111 4606.5 92.111 4606.5 92.111 4606.5 92.111 4606.5 92.111 4606.5 92.111 4606.5 92.111 + │ │ │ │ │ <---- 32 --------- 27780 -------- 60677 -------- 87430 -------- 111814 -------- 139648 -------- 166148 -------- 198051 -------- 232580 -------- 259104 -------- 283460 -------- 311460 -------- 344230 -------- 376102 -------- 408963 -------- 436743 -------- 470368 -------- 503942 -------- 531236 -------- 559395 -------- 589314 -------- 620839 -------- 649670 -------- 672483 -------- 698693 -------- 726629 -------- 756997 -------- 796164 -------- 824327 -------- 855873 -------- 882247 -------- 916418 -------- 951748 -------- 978498 -------- 1005765 -------- 1036864 -------- 1061351 -------- 1093638 -------- 1122308 -------- 1155844 -------- 1191239 -------- 1225540 -------- 1254915 -------- 1281670 -------- 1306721 -------- 1337410 -------- 1368419 -------- 1405382 -------- 1438210 -------- 1465477 -------- 1490627 -------- 1517251 -------- 1544289 -------- 1573729 -------- 1607168 -------- 1635648 -------- 1658848 -------- 1691623 -------- 1718631 -------- 1753345 -------- 1782470 -------- 1812742 -------- 1837702 -------- 1873349 -------- 1905733 -------- 1941024 -------- 1977287 -------- 2005826 -------- 2035300 -------- 2067878 -------- 2093927 -------- 2127906 -------- 2154055 -------- 2181095 -------- 2212035 -------- 2242374 -------- 2263458 -------- 2288481 -------- 2315300 -------- 2340997 -------- 2371200 -------- 2399616 -------- 2429154 -------- 2455393 -------- 2488384 -------- 2521088 -------- 2550885 -------- 2581058 -------- 2610496 -------- 2644197 -------- 2675648 -------- 2698821 -------- 2726246 -------- 2757444 -------- 2792612 -------- 2827174 -------- 2846849 -------- 2881250 -------- 2900739 -------- 2930660 -------- 2962240 -------- 2999235 -------- 3031974 -------- 3060197 -------- 3087586 -------- 3120390 -------- 3147524 -------- 3170721 -------- 3199173 -------- 3230049 -------- 3255008 -------- 3284965 -------- 3315744 -------- 3345376 -------- 3379776 -------- 3405445 -------- 3436711 -------- 3467557 -------- 3489541 -------- 3518179 -------- 3546276 -------- 3568964 -------- 3596039 -------- 3621926 -------- 3644805 -------- 3675361 -------- 3706592 -------- 3735589 -------- 3761220 -------- 3789607 -------- 3820866 -------- 3862274 -------- 3898051 -------- 3925188 -------- 3957157 -------- 3983873 -------- 4013092 -------- 4039202 -------- 4070918 -------- 4105696 -------- 4136867 -------- 4169475 -------- 4205249 -------- 4239013 -------- 4264423 -------- 4292135 -------- 4324453 -------- 4356356 -------- 4392386 -------- 4423074 -------- 4447335 -------- 4469345 -------- 4496513 -------- 4530848 -------- 4565159 -------- 4596965 -------- 4627011 -------- 4662598 -------- 4690818 -------- 4718691 -------- 4749349 -------- 4782722 -------- 4824485 -------- 4856323 -------- 4885795 -------- 4911142 -------- 4945794 -------- 4972801 -------- 5000583 -------- 5033735 -------- 5072421 -------- 5112929 -------- 5145956 -------- 5181923 -------- 5217478 -------- 5247620 -------- 5273605 -------- 5304100 -------- 5343362 -------- 5375842 -------- 5408391 -------- 5439046 -------- 5464610 -------- 5497857 -------- 5528295 -------- 5557956 -------- 5593474 -------- 5626209 -------- 5660931 -------- 5703463 -------- 5733440 -------- 5762565 -------- 5788034 -------- 5813505 -------- 5848227 -------- 5870727 -------- 5908998 -------- 5938311 -------- 5968930 -------- 5999751 + │ │ │ │ │ histogram(14)= 0 2.2903e+05 0 1.9595e+05 0 1.6039e+05 0 1.2972e+05 0 1.0217e+05 0 68727 0 35285 │ │ │ │ │ <------ 1 ---------- 2 ---------- 3 ---------- 4 ---------- 5 -------- 6 ----- 7 - │ │ │ │ │ histogram(23)= 0 0 24690 600 28805 3000 28205 3000 27605 2400 28805 2400 27605 3600 25805 6001 27605 3600 27605 2400 26405 5401 27605 4200 28205 2400 27605 3000 28805 1800 27605 4800 26405 3000 28805 3600 28805 1200 27605 2400 28205 4200 26405 3600 28205 1800 25205 4200 26405 3600 25805 4800 28805 3600 27605 3600 26405 3000 27605 3000 28205 3600 │ │ │ │ │ <--- '1993-12-31' ------- '1994-01-13' ------- '1994-01-27' ------- '1994-02-09' ------- '1994-02-19' ------- '1994-03-04' ------- '1994-03-17' ------- '1994-03-29' ------- '1994-04-14' ------- '1994-04-25' ------- '1994-05-06' ------- '1994-05-18' ------- '1994-05-30' ------- '1994-06-10' ------- '1994-06-23' ------- '1994-07-07' ------- '1994-07-19' ------- '1994-07-29' ------- '1994-08-11' ------- '1994-08-22' ------- '1994-09-04' ------- '1994-09-15' ------- '1994-09-29' ------- '1994-10-12' ------- '1994-10-23' ------- '1994-11-04' ------- '1994-11-14' ------- '1994-11-25' ------- '1994-12-07' ------- '1994-12-21' ------- '1994-12-31' @@ -190,7 +190,7 @@ column_names row_count distinct_count null_count ~~~~ column_names row_count_est row_count_err distinct_count_est distinct_count_err null_count_est null_count_err {l_commitdate} 921271.00 1.01 2466.00 4.40 <== 0.00 1.00 -{l_orderkey} 921271.00 1.01 733844.00 2.74 <== 0.00 1.00 +{l_orderkey} 921271.00 1.01 921271.00 3.44 <== 0.00 1.00 {l_receiptdate} 921271.00 1.01 365.00 1.00 0.00 1.00 {l_shipdate} 921271.00 1.01 2526.00 6.41 <== 0.00 1.00 {l_shipmode} 921271.00 1.01 7.00 1.00 0.00 1.00 @@ -203,7 +203,7 @@ column_names row_count distinct_count null_count ~~~~ column_names row_count_est row_count_err distinct_count_est distinct_count_err null_count_est null_count_err {l_linenumber} 921271.00 1.01 7.00 1.00 0.00 1.00 -{l_orderkey} 921271.00 1.01 733844.00 2.74 <== 0.00 1.00 +{l_orderkey} 921271.00 1.01 921271.00 3.44 <== 0.00 1.00 {l_receiptdate} 921271.00 1.01 365.00 1.00 0.00 1.00 ---- ---- diff --git a/pkg/sql/opt/memo/testdata/stats_quality/tpch/q13 b/pkg/sql/opt/memo/testdata/stats_quality/tpch/q13 index 92db8fd5e86f..686f6f18b5a2 100644 --- a/pkg/sql/opt/memo/testdata/stats_quality/tpch/q13 +++ b/pkg/sql/opt/memo/testdata/stats_quality/tpch/q13 @@ -60,7 +60,7 @@ sort │ ├── right-join (hash) │ │ ├── save-table-name: q13_right_join_4 │ │ ├── columns: c_custkey:1(int!null) o_orderkey:10(int) o_custkey:11(int) o_comment:18(varchar) - │ │ ├── stats: [rows=503988.227, distinct(1)=148813, null(1)=0, distinct(10)=317522.248, null(10)=0, distinct(11)=99620.1148, null(11)=0, distinct(18)=317522.248, null(18)=0] + │ │ ├── stats: [rows=503988.227, distinct(1)=148813, null(1)=0, distinct(10)=500000, null(10)=-7.4999496e+10, distinct(11)=99620.1148, null(11)=0, distinct(18)=500000, null(18)=-7.4999496e+10] │ │ ├── key: (1,10) │ │ ├── fd: (10)-->(11,18) │ │ ├── select @@ -132,11 +132,11 @@ column_names row_count distinct_count null_count {o_custkey} 1533923 99846 50005 {o_orderkey} 1533923 1511432 50005 ~~~~ -column_names row_count_est row_count_err distinct_count_est distinct_count_err null_count_est null_count_err -{c_custkey} 503988.00 3.04 <== 148813.00 1.00 0.00 1.00 -{o_comment} 503988.00 3.04 <== 317522.00 4.58 <== 0.00 +Inf <== -{o_custkey} 503988.00 3.04 <== 99620.00 1.00 0.00 +Inf <== -{o_orderkey} 503988.00 3.04 <== 317522.00 4.76 <== 0.00 +Inf <== +column_names row_count_est row_count_err distinct_count_est distinct_count_err null_count_est null_count_err +{c_custkey} 503988.00 3.04 <== 148813.00 1.00 0.00 1.00 +{o_comment} 503988.00 3.04 <== 500000.00 2.91 <== 18446743998710054912.00 368897990175183.56 <== +{o_custkey} 503988.00 3.04 <== 99620.00 1.00 0.00 +Inf <== +{o_orderkey} 503988.00 3.04 <== 500000.00 3.02 <== 18446743998710054912.00 368897990175183.56 <== ----Stats for q13_select_5---- column_names row_count distinct_count null_count diff --git a/pkg/sql/opt/memo/testdata/stats_quality/tpch/q14 b/pkg/sql/opt/memo/testdata/stats_quality/tpch/q14 index 830f7bed9aca..4a4548e10c11 100644 --- a/pkg/sql/opt/memo/testdata/stats_quality/tpch/q14 +++ b/pkg/sql/opt/memo/testdata/stats_quality/tpch/q14 @@ -51,12 +51,12 @@ project │ │ ├── save-table-name: q14_project_3 │ │ ├── columns: column28:28(float!null) column30:30(float!null) │ │ ├── immutable - │ │ ├── stats: [rows=81927.3929, distinct(28)=81927.3929, null(28)=0, distinct(30)=51705.6907, null(30)=0] + │ │ ├── stats: [rows=81927.3929, distinct(28)=81927.3929, null(28)=0, distinct(30)=81616.4784, null(30)=0] │ │ ├── inner-join (hash) │ │ │ ├── save-table-name: q14_inner_join_4 │ │ │ ├── columns: l_partkey:2(int!null) l_extendedprice:6(float!null) l_discount:7(float!null) l_shipdate:11(date!null) p_partkey:18(int!null) p_type:22(varchar!null) │ │ │ ├── multiplicity: left-rows(zero-or-more), right-rows(exactly-one) - │ │ │ ├── stats: [rows=81927.3929, distinct(2)=67337.956, null(2)=0, distinct(6)=50893.2319, null(6)=0, distinct(7)=11, null(7)=0, distinct(11)=30, null(11)=0, distinct(18)=67337.956, null(18)=0, distinct(22)=150, null(22)=0, distinct(6,7)=51705.6907, null(6,7)=0, distinct(6,7,22)=81927.3929, null(6,7,22)=0] + │ │ │ ├── stats: [rows=81927.3929, distinct(2)=67337.956, null(2)=0, distinct(6)=78635.5775, null(6)=0, distinct(7)=11, null(7)=0, distinct(11)=30, null(11)=0, distinct(18)=67337.956, null(18)=0, distinct(22)=150, null(22)=0, distinct(6,7)=81616.4784, null(6,7)=0, distinct(6,7,22)=81927.3929, null(6,7,22)=0] │ │ │ ├── fd: (18)-->(22), (2)==(18), (18)==(2) │ │ │ ├── scan part │ │ │ │ ├── save-table-name: q14_scan_5 @@ -78,9 +78,9 @@ project │ │ │ │ ├── save-table-name: q14_scan_7 │ │ │ │ ├── columns: l_orderkey:1(int!null) l_linenumber:4(int!null) l_shipdate:11(date!null) │ │ │ │ ├── constraint: /11/1/4: [/'1995-09-01' - /'1995-09-30'] - │ │ │ │ ├── stats: [rows=81616.4784, distinct(1)=80004.8749, null(1)=0, distinct(4)=7, null(4)=0, distinct(11)=30, null(11)=0] - │ │ │ │ │ histogram(1)= 0 8.16 399.91 8.16 399.91 8.16 399.91 8.16 399.91 8.16 399.91 8.16 399.91 8.16 399.91 8.16 399.91 8.16 399.91 8.16 399.91 8.16 399.91 8.16 399.91 8.16 399.91 8.16 399.91 8.16 399.91 8.16 399.91 8.16 399.91 8.16 399.91 8.16 399.91 8.16 399.91 8.16 399.91 8.16 399.91 8.16 399.91 8.16 399.91 8.16 399.91 8.16 399.91 8.16 399.91 8.16 399.91 8.16 399.91 8.16 399.91 8.16 399.91 8.16 399.91 8.16 399.91 8.16 399.91 8.16 399.91 8.16 399.91 8.16 399.91 8.16 399.91 8.16 399.91 8.16 399.91 8.16 399.91 8.16 399.91 8.16 399.91 8.16 399.91 8.16 399.91 8.16 399.91 8.16 399.91 8.16 399.91 8.16 399.91 8.16 399.91 8.16 399.91 8.16 399.91 8.16 399.91 8.16 399.91 8.16 399.91 8.16 399.91 8.16 399.91 8.16 399.91 8.16 399.91 8.16 399.91 8.16 399.91 8.16 399.91 8.16 399.91 8.16 399.91 8.16 399.91 8.16 399.91 8.16 399.91 8.16 399.91 8.16 399.91 8.16 399.91 8.16 399.91 8.16 399.91 8.16 399.91 8.16 399.91 8.16 399.91 8.16 399.91 8.16 399.91 8.16 399.91 8.16 399.91 8.16 399.91 8.16 399.91 8.16 399.91 8.16 399.91 8.16 399.91 8.16 399.91 8.16 399.91 8.16 399.91 8.16 399.91 8.16 399.91 8.16 399.91 8.16 399.91 8.16 399.91 8.16 399.91 8.16 399.91 8.16 399.91 8.16 399.91 8.16 399.91 8.16 399.91 8.16 399.91 8.16 399.91 8.16 399.91 8.16 399.91 8.16 399.91 8.16 399.91 8.16 399.91 8.16 399.91 8.16 399.91 8.16 399.91 8.16 391.75 16.32 399.91 8.16 399.91 8.16 399.91 8.16 399.91 8.16 399.91 8.16 399.91 8.16 399.91 8.16 399.91 8.16 399.91 8.16 399.91 8.16 399.91 8.16 399.91 8.16 391.75 16.32 399.91 8.16 399.91 8.16 399.91 8.16 399.91 8.16 399.91 8.16 399.91 8.16 399.91 8.16 399.91 8.16 399.91 8.16 399.91 8.16 399.91 8.16 399.91 8.16 399.91 8.16 399.91 8.16 399.91 8.16 399.91 8.16 399.91 8.16 399.91 8.16 399.91 8.16 399.91 8.16 399.91 8.16 399.91 8.16 399.91 8.16 399.91 8.16 399.91 8.16 399.91 8.16 399.91 8.16 399.91 8.16 408.08 8.16 408.08 8.16 408.08 8.16 408.08 8.16 408.08 8.16 408.08 8.16 408.08 8.16 408.08 8.16 408.08 8.16 408.08 8.16 408.08 8.16 408.08 8.16 408.08 8.16 408.08 8.16 408.08 8.16 408.08 8.16 408.08 8.16 408.08 8.16 408.08 8.16 408.08 8.16 408.08 8.16 408.08 8.16 408.08 8.16 408.08 8.16 408.08 8.16 408.08 8.16 408.08 8.16 408.08 8.16 408.08 8.16 408.08 8.16 408.08 8.16 408.08 8.16 408.08 8.16 408.08 8.16 408.08 8.16 408.08 8.16 408.08 8.16 408.08 8.16 408.08 8.16 408.08 8.16 408.08 8.16 408.08 8.16 408.08 8.16 408.08 8.16 408.08 8.16 408.08 8.16 408.08 8.16 408.08 8.16 408.08 8.16 - │ │ │ │ │ <--- 32 -------- 27780 -------- 60677 -------- 87430 -------- 111814 -------- 139648 -------- 166148 -------- 198051 -------- 232580 -------- 259104 -------- 283460 -------- 311460 -------- 344230 -------- 376102 -------- 408963 -------- 436743 -------- 470368 -------- 503942 -------- 531236 -------- 559395 -------- 589314 -------- 620839 -------- 649670 -------- 672483 -------- 698693 -------- 726629 -------- 756997 -------- 796164 -------- 824327 -------- 855873 -------- 882247 -------- 916418 -------- 951748 -------- 978498 -------- 1005765 -------- 1036864 -------- 1061351 -------- 1093638 -------- 1122308 -------- 1155844 -------- 1191239 -------- 1225540 -------- 1254915 -------- 1281670 -------- 1306721 -------- 1337410 -------- 1368419 -------- 1405382 -------- 1438210 -------- 1465477 -------- 1490627 -------- 1517251 -------- 1544289 -------- 1573729 -------- 1607168 -------- 1635648 -------- 1658848 -------- 1691623 -------- 1718631 -------- 1753345 -------- 1782470 -------- 1812742 -------- 1837702 -------- 1873349 -------- 1905733 -------- 1941024 -------- 1977287 -------- 2005826 -------- 2035300 -------- 2067878 -------- 2093927 -------- 2127906 -------- 2154055 -------- 2181095 -------- 2212035 -------- 2242374 -------- 2263458 -------- 2288481 -------- 2315300 -------- 2340997 -------- 2371200 -------- 2399616 -------- 2429154 -------- 2455393 -------- 2488384 -------- 2521088 -------- 2550885 -------- 2581058 -------- 2610496 -------- 2644197 -------- 2675648 -------- 2698821 -------- 2726246 -------- 2757444 -------- 2792612 -------- 2827174 -------- 2846849 -------- 2881250 -------- 2900739 -------- 2930660 -------- 2962240 -------- 2999235 -------- 3031974 -------- 3060197 -------- 3087586 -------- 3120390 -------- 3147524 -------- 3170721 -------- 3199173 -------- 3230049 -------- 3255008 -------- 3284965 -------- 3315744 -------- 3345376 -------- 3379776 -------- 3405445 -------- 3436711 -------- 3467557 -------- 3489541 -------- 3518179 -------- 3546276 -------- 3568964 -------- 3596039 -------- 3621926 -------- 3644805 -------- 3675361 -------- 3706592 -------- 3735589 -------- 3761220 -------- 3789607 -------- 3820866 -------- 3862274 -------- 3898051 -------- 3925188 -------- 3957157 -------- 3983873 -------- 4013092 -------- 4039202 -------- 4070918 -------- 4105696 -------- 4136867 -------- 4169475 -------- 4205249 -------- 4239013 -------- 4264423 -------- 4292135 -------- 4324453 -------- 4356356 -------- 4392386 -------- 4423074 -------- 4447335 -------- 4469345 -------- 4496513 -------- 4530848 -------- 4565159 -------- 4596965 -------- 4627011 -------- 4662598 -------- 4690818 -------- 4718691 -------- 4749349 -------- 4782722 -------- 4824485 -------- 4856323 -------- 4885795 -------- 4911142 -------- 4945794 -------- 4972801 -------- 5000583 -------- 5033735 -------- 5072421 -------- 5112929 -------- 5145956 -------- 5181923 -------- 5217478 -------- 5247620 -------- 5273605 -------- 5304100 -------- 5343362 -------- 5375842 -------- 5408391 -------- 5439046 -------- 5464610 -------- 5497857 -------- 5528295 -------- 5557956 -------- 5593474 -------- 5626209 -------- 5660931 -------- 5703463 -------- 5733440 -------- 5762565 -------- 5788034 -------- 5813505 -------- 5848227 -------- 5870727 -------- 5908998 -------- 5938311 -------- 5968930 -------- 5999751 + │ │ │ │ ├── stats: [rows=81616.4784, distinct(1)=81616.4784, null(1)=0, distinct(4)=7, null(4)=0, distinct(11)=30, null(11)=0] + │ │ │ │ │ histogram(1)= 0 8.1602 399.92 8.1602 399.92 8.1602 399.92 8.1602 399.92 8.1602 399.92 8.1602 399.92 8.1602 399.92 8.1602 399.92 8.1602 399.92 8.1602 399.92 8.1602 399.92 8.1602 399.92 8.1602 399.92 8.1602 399.92 8.1602 399.92 8.1602 399.92 8.1602 399.92 8.1602 399.92 8.1602 399.92 8.1602 399.92 8.1602 399.92 8.1602 399.92 8.1602 399.92 8.1602 399.92 8.1602 399.92 8.1602 399.92 8.1602 399.92 8.1602 399.92 8.1602 399.92 8.1602 399.92 8.1602 399.92 8.1602 399.92 8.1602 399.92 8.1602 399.92 8.1602 399.92 8.1602 399.92 8.1602 399.92 8.1602 399.92 8.1602 399.92 8.1602 399.92 8.1602 399.92 8.1602 399.92 8.1602 399.92 8.1602 399.92 8.1602 399.92 8.1602 399.92 8.1602 399.92 8.1602 399.92 8.1602 399.92 8.1602 399.92 8.1602 399.92 8.1602 399.92 8.1602 399.92 8.1602 399.92 8.1602 399.92 8.1602 399.92 8.1602 399.92 8.1602 399.92 8.1602 399.92 8.1602 399.92 8.1602 399.92 8.1602 399.92 8.1602 399.92 8.1602 399.92 8.1602 399.92 8.1602 399.92 8.1602 399.92 8.1602 399.92 8.1602 399.92 8.1602 399.92 8.1602 399.92 8.1602 399.92 8.1602 399.92 8.1602 399.92 8.1602 399.92 8.1602 399.92 8.1602 399.92 8.1602 399.92 8.1602 399.92 8.1602 399.92 8.1602 399.92 8.1602 399.92 8.1602 399.92 8.1602 399.92 8.1602 399.92 8.1602 399.92 8.1602 399.92 8.1602 399.92 8.1602 399.92 8.1602 399.92 8.1602 399.92 8.1602 399.92 8.1602 399.92 8.1602 399.92 8.1602 399.92 8.1602 399.92 8.1602 399.92 8.1602 399.92 8.1602 399.92 8.1602 399.92 8.1602 399.92 8.1602 399.92 8.1602 399.92 8.1602 399.92 8.1602 399.92 8.1602 399.92 8.1602 399.92 8.1602 399.92 8.1602 391.76 16.32 399.92 8.1602 399.92 8.1602 399.92 8.1602 399.92 8.1602 399.92 8.1602 399.92 8.1602 399.92 8.1602 399.92 8.1602 399.92 8.1602 399.92 8.1602 399.92 8.1602 399.92 8.1602 391.76 16.32 399.92 8.1602 399.92 8.1602 399.92 8.1602 399.92 8.1602 399.92 8.1602 399.92 8.1602 399.92 8.1602 399.92 8.1602 399.92 8.1602 399.92 8.1602 399.92 8.1602 399.92 8.1602 399.92 8.1602 399.92 8.1602 399.92 8.1602 399.92 8.1602 399.92 8.1602 399.92 8.1602 399.92 8.1602 399.92 8.1602 399.92 8.1602 399.92 8.1602 399.92 8.1602 399.92 8.1602 399.92 8.1602 399.92 8.1602 399.92 8.1602 399.92 8.1602 408.09 8.1602 408.09 8.1602 408.09 8.1602 408.09 8.1602 408.09 8.1602 408.09 8.1602 408.09 8.1602 408.09 8.1602 408.09 8.1602 408.09 8.1602 408.09 8.1602 408.09 8.1602 408.09 8.1602 408.09 8.1602 408.09 8.1602 408.09 8.1602 408.09 8.1602 408.09 8.1602 408.09 8.1602 408.09 8.1602 408.09 8.1602 408.09 8.1602 408.09 8.1602 408.09 8.1602 408.09 8.1602 408.09 8.1602 408.09 8.1602 408.09 8.1602 408.09 8.1602 408.09 8.1602 408.09 8.1602 408.09 8.1602 408.09 8.1602 408.09 8.1602 408.09 8.1602 408.09 8.1602 408.09 8.1602 408.09 8.1602 408.09 8.1602 408.09 8.1602 408.09 8.1602 408.09 8.1602 408.09 8.1602 408.09 8.1602 408.09 8.1602 408.09 8.1602 408.09 8.1602 408.09 8.1602 408.09 8.1602 + │ │ │ │ │ <---- 32 --------- 27780 -------- 60677 -------- 87430 -------- 111814 -------- 139648 -------- 166148 -------- 198051 -------- 232580 -------- 259104 -------- 283460 -------- 311460 -------- 344230 -------- 376102 -------- 408963 -------- 436743 -------- 470368 -------- 503942 -------- 531236 -------- 559395 -------- 589314 -------- 620839 -------- 649670 -------- 672483 -------- 698693 -------- 726629 -------- 756997 -------- 796164 -------- 824327 -------- 855873 -------- 882247 -------- 916418 -------- 951748 -------- 978498 -------- 1005765 -------- 1036864 -------- 1061351 -------- 1093638 -------- 1122308 -------- 1155844 -------- 1191239 -------- 1225540 -------- 1254915 -------- 1281670 -------- 1306721 -------- 1337410 -------- 1368419 -------- 1405382 -------- 1438210 -------- 1465477 -------- 1490627 -------- 1517251 -------- 1544289 -------- 1573729 -------- 1607168 -------- 1635648 -------- 1658848 -------- 1691623 -------- 1718631 -------- 1753345 -------- 1782470 -------- 1812742 -------- 1837702 -------- 1873349 -------- 1905733 -------- 1941024 -------- 1977287 -------- 2005826 -------- 2035300 -------- 2067878 -------- 2093927 -------- 2127906 -------- 2154055 -------- 2181095 -------- 2212035 -------- 2242374 -------- 2263458 -------- 2288481 -------- 2315300 -------- 2340997 -------- 2371200 -------- 2399616 -------- 2429154 -------- 2455393 -------- 2488384 -------- 2521088 -------- 2550885 -------- 2581058 -------- 2610496 -------- 2644197 -------- 2675648 -------- 2698821 -------- 2726246 -------- 2757444 -------- 2792612 -------- 2827174 -------- 2846849 -------- 2881250 -------- 2900739 -------- 2930660 -------- 2962240 -------- 2999235 -------- 3031974 -------- 3060197 -------- 3087586 -------- 3120390 -------- 3147524 -------- 3170721 -------- 3199173 -------- 3230049 -------- 3255008 -------- 3284965 -------- 3315744 -------- 3345376 -------- 3379776 -------- 3405445 -------- 3436711 -------- 3467557 -------- 3489541 -------- 3518179 -------- 3546276 -------- 3568964 -------- 3596039 -------- 3621926 -------- 3644805 -------- 3675361 -------- 3706592 -------- 3735589 -------- 3761220 -------- 3789607 -------- 3820866 -------- 3862274 -------- 3898051 -------- 3925188 -------- 3957157 -------- 3983873 -------- 4013092 -------- 4039202 -------- 4070918 -------- 4105696 -------- 4136867 -------- 4169475 -------- 4205249 -------- 4239013 -------- 4264423 -------- 4292135 -------- 4324453 -------- 4356356 -------- 4392386 -------- 4423074 -------- 4447335 -------- 4469345 -------- 4496513 -------- 4530848 -------- 4565159 -------- 4596965 -------- 4627011 -------- 4662598 -------- 4690818 -------- 4718691 -------- 4749349 -------- 4782722 -------- 4824485 -------- 4856323 -------- 4885795 -------- 4911142 -------- 4945794 -------- 4972801 -------- 5000583 -------- 5033735 -------- 5072421 -------- 5112929 -------- 5145956 -------- 5181923 -------- 5217478 -------- 5247620 -------- 5273605 -------- 5304100 -------- 5343362 -------- 5375842 -------- 5408391 -------- 5439046 -------- 5464610 -------- 5497857 -------- 5528295 -------- 5557956 -------- 5593474 -------- 5626209 -------- 5660931 -------- 5703463 -------- 5733440 -------- 5762565 -------- 5788034 -------- 5813505 -------- 5848227 -------- 5870727 -------- 5908998 -------- 5938311 -------- 5968930 -------- 5999751 │ │ │ │ │ histogram(4)= 0 20290 0 17360 0 14209 0 11492 0 9051.3 0 6088.6 0 3125.9 │ │ │ │ │ <---- 1 ----- 2 ----- 3 ----- 4 ----- 5 ------ 6 ------ 7 -- │ │ │ │ │ histogram(11)= 0 0 15002 5401 28805 1800 28805 1800 @@ -123,7 +123,7 @@ column_names row_count distinct_count null_count ~~~~ column_names row_count_est row_count_err distinct_count_est distinct_count_err null_count_est null_count_err {column28} 81927.00 1.08 81927.00 6.48 <== 0.00 1.00 -{column30} 81927.00 1.08 51706.00 1.47 0.00 1.00 +{column30} 81927.00 1.08 81616.00 1.07 0.00 1.00 ----Stats for q14_inner_join_4---- column_names row_count distinct_count null_count @@ -136,7 +136,7 @@ column_names row_count distinct_count null_count ~~~~ column_names row_count_est row_count_err distinct_count_est distinct_count_err null_count_est null_count_err {l_discount} 81927.00 1.08 11.00 1.00 0.00 1.00 -{l_extendedprice} 81927.00 1.08 50893.00 1.43 0.00 1.00 +{l_extendedprice} 81927.00 1.08 78636.00 1.08 0.00 1.00 {l_partkey} 81927.00 1.08 67338.00 1.07 0.00 1.00 {l_shipdate} 81927.00 1.08 30.00 1.00 0.00 1.00 {p_partkey} 81927.00 1.08 67338.00 1.07 0.00 1.00 @@ -172,7 +172,7 @@ column_names row_count distinct_count null_count ~~~~ column_names row_count_est row_count_err distinct_count_est distinct_count_err null_count_est null_count_err {l_linenumber} 81616.00 1.07 7.00 1.00 0.00 1.00 -{l_orderkey} 81616.00 1.07 80005.00 1.61 0.00 1.00 +{l_orderkey} 81616.00 1.07 81616.00 1.65 0.00 1.00 {l_shipdate} 81616.00 1.07 30.00 1.00 0.00 1.00 ---- ---- diff --git a/pkg/sql/opt/memo/testdata/stats_quality/tpch/q15 b/pkg/sql/opt/memo/testdata/stats_quality/tpch/q15 index b6ef10e3398e..2beed2b93b9e 100644 --- a/pkg/sql/opt/memo/testdata/stats_quality/tpch/q15 +++ b/pkg/sql/opt/memo/testdata/stats_quality/tpch/q15 @@ -55,7 +55,7 @@ project ├── save-table-name: q15_project_1 ├── columns: s_suppkey:1(int!null) s_name:2(char!null) s_address:3(varchar!null) s_phone:5(char!null) total_revenue:27(float!null) ├── immutable - ├── stats: [rows=3333.33333, distinct(1)=3306.66667, null(1)=0, distinct(2)=2834.3606, null(2)=0, distinct(3)=2834.80729, null(3)=0, distinct(5)=2834.80729, null(5)=0, distinct(27)=2100.04396, null(27)=0] + ├── stats: [rows=3333.33333, distinct(1)=3306.66667, null(1)=0, distinct(2)=3333.33333, null(2)=0, distinct(3)=3333.33333, null(3)=0, distinct(5)=3333.33333, null(5)=0, distinct(27)=3306.66667, null(27)=0] ├── key: (1) ├── fd: (1)-->(2,3,5,27) ├── ordering: +1 @@ -65,7 +65,7 @@ project ├── left ordering: +1 ├── right ordering: +11 ├── immutable - ├── stats: [rows=3333.33333, distinct(1)=3306.66667, null(1)=0, distinct(2)=2834.3606, null(2)=0, distinct(3)=2834.80729, null(3)=0, distinct(5)=2834.80729, null(5)=0, distinct(11)=3306.66667, null(11)=0, distinct(27)=2100.04396, null(27)=0] + ├── stats: [rows=3333.33333, distinct(1)=3306.66667, null(1)=0, distinct(2)=3333.33333, null(2)=0, distinct(3)=3333.33333, null(3)=0, distinct(5)=3333.33333, null(5)=0, distinct(11)=3306.66667, null(11)=0, distinct(27)=3306.66667, null(27)=0] ├── key: (11) ├── fd: (1)-->(2,3,5), (11)-->(27), (1)==(11), (11)==(1) ├── ordering: +(1|11) [actual: +1] @@ -122,8 +122,8 @@ project │ │ │ │ ├── save-table-name: q15_scan_9 │ │ │ │ ├── columns: l_orderkey:9(int!null) l_linenumber:12(int!null) l_shipdate:19(date!null) │ │ │ │ ├── constraint: /19/9/12: [/'1996-01-01' - /'1996-03-31'] - │ │ │ │ ├── stats: [rows=229569.241, distinct(9)=217020.149, null(9)=0, distinct(12)=7, null(12)=0, distinct(19)=91, null(19)=0] - │ │ │ │ │ histogram(9)= 0 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1101.9 45.905 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1101.9 45.905 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1147.8 22.952 1147.8 22.952 1147.8 22.952 1147.8 22.952 1147.8 22.952 1147.8 22.952 1147.8 22.952 1147.8 22.952 1147.8 22.952 1147.8 22.952 1147.8 22.952 1147.8 22.952 1147.8 22.952 1147.8 22.952 1147.8 22.952 1147.8 22.952 1147.8 22.952 1147.8 22.952 1147.8 22.952 1147.8 22.952 1147.8 22.952 1147.8 22.952 1147.8 22.952 1147.8 22.952 1147.8 22.952 1147.8 22.952 1147.8 22.952 1147.8 22.952 1147.8 22.952 1147.8 22.952 1147.8 22.952 1147.8 22.952 1147.8 22.952 1147.8 22.952 1147.8 22.952 1147.8 22.952 1147.8 22.952 1147.8 22.952 1147.8 22.952 1147.8 22.952 1147.8 22.952 1147.8 22.952 1147.8 22.952 1147.8 22.952 1147.8 22.952 1147.8 22.952 1147.8 22.952 1147.8 22.952 1147.8 22.952 + │ │ │ │ ├── stats: [rows=229569.241, distinct(9)=229569.241, null(9)=0, distinct(12)=7, null(12)=0, distinct(19)=91, null(19)=0] + │ │ │ │ │ histogram(9)= 0 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1101.9 45.906 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1101.9 45.906 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1147.9 22.953 1147.9 22.953 1147.9 22.953 1147.9 22.953 1147.9 22.953 1147.9 22.953 1147.9 22.953 1147.9 22.953 1147.9 22.953 1147.9 22.953 1147.9 22.953 1147.9 22.953 1147.9 22.953 1147.9 22.953 1147.9 22.953 1147.9 22.953 1147.9 22.953 1147.9 22.953 1147.9 22.953 1147.9 22.953 1147.9 22.953 1147.9 22.953 1147.9 22.953 1147.9 22.953 1147.9 22.953 1147.9 22.953 1147.9 22.953 1147.9 22.953 1147.9 22.953 1147.9 22.953 1147.9 22.953 1147.9 22.953 1147.9 22.953 1147.9 22.953 1147.9 22.953 1147.9 22.953 1147.9 22.953 1147.9 22.953 1147.9 22.953 1147.9 22.953 1147.9 22.953 1147.9 22.953 1147.9 22.953 1147.9 22.953 1147.9 22.953 1147.9 22.953 1147.9 22.953 1147.9 22.953 1147.9 22.953 │ │ │ │ │ <---- 32 --------- 27780 -------- 60677 -------- 87430 -------- 111814 -------- 139648 -------- 166148 -------- 198051 -------- 232580 -------- 259104 -------- 283460 -------- 311460 -------- 344230 -------- 376102 -------- 408963 -------- 436743 -------- 470368 -------- 503942 -------- 531236 -------- 559395 -------- 589314 -------- 620839 -------- 649670 -------- 672483 -------- 698693 -------- 726629 -------- 756997 -------- 796164 -------- 824327 -------- 855873 -------- 882247 -------- 916418 -------- 951748 -------- 978498 -------- 1005765 -------- 1036864 -------- 1061351 -------- 1093638 -------- 1122308 -------- 1155844 -------- 1191239 -------- 1225540 -------- 1254915 -------- 1281670 -------- 1306721 -------- 1337410 -------- 1368419 -------- 1405382 -------- 1438210 -------- 1465477 -------- 1490627 -------- 1517251 -------- 1544289 -------- 1573729 -------- 1607168 -------- 1635648 -------- 1658848 -------- 1691623 -------- 1718631 -------- 1753345 -------- 1782470 -------- 1812742 -------- 1837702 -------- 1873349 -------- 1905733 -------- 1941024 -------- 1977287 -------- 2005826 -------- 2035300 -------- 2067878 -------- 2093927 -------- 2127906 -------- 2154055 -------- 2181095 -------- 2212035 -------- 2242374 -------- 2263458 -------- 2288481 -------- 2315300 -------- 2340997 -------- 2371200 -------- 2399616 -------- 2429154 -------- 2455393 -------- 2488384 -------- 2521088 -------- 2550885 -------- 2581058 -------- 2610496 -------- 2644197 -------- 2675648 -------- 2698821 -------- 2726246 -------- 2757444 -------- 2792612 -------- 2827174 -------- 2846849 -------- 2881250 -------- 2900739 -------- 2930660 -------- 2962240 -------- 2999235 -------- 3031974 -------- 3060197 -------- 3087586 -------- 3120390 -------- 3147524 -------- 3170721 -------- 3199173 -------- 3230049 -------- 3255008 -------- 3284965 -------- 3315744 -------- 3345376 -------- 3379776 -------- 3405445 -------- 3436711 -------- 3467557 -------- 3489541 -------- 3518179 -------- 3546276 -------- 3568964 -------- 3596039 -------- 3621926 -------- 3644805 -------- 3675361 -------- 3706592 -------- 3735589 -------- 3761220 -------- 3789607 -------- 3820866 -------- 3862274 -------- 3898051 -------- 3925188 -------- 3957157 -------- 3983873 -------- 4013092 -------- 4039202 -------- 4070918 -------- 4105696 -------- 4136867 -------- 4169475 -------- 4205249 -------- 4239013 -------- 4264423 -------- 4292135 -------- 4324453 -------- 4356356 -------- 4392386 -------- 4423074 -------- 4447335 -------- 4469345 -------- 4496513 -------- 4530848 -------- 4565159 -------- 4596965 -------- 4627011 -------- 4662598 -------- 4690818 -------- 4718691 -------- 4749349 -------- 4782722 -------- 4824485 -------- 4856323 -------- 4885795 -------- 4911142 -------- 4945794 -------- 4972801 -------- 5000583 -------- 5033735 -------- 5072421 -------- 5112929 -------- 5145956 -------- 5181923 -------- 5217478 -------- 5247620 -------- 5273605 -------- 5304100 -------- 5343362 -------- 5375842 -------- 5408391 -------- 5439046 -------- 5464610 -------- 5497857 -------- 5528295 -------- 5557956 -------- 5593474 -------- 5626209 -------- 5660931 -------- 5703463 -------- 5733440 -------- 5762565 -------- 5788034 -------- 5813505 -------- 5848227 -------- 5870727 -------- 5908998 -------- 5938311 -------- 5968930 -------- 5999751 │ │ │ │ │ histogram(12)= 0 57071 0 48829 0 39968 0 32323 0 25459 0 17126 0 8792.5 │ │ │ │ │ <---- 1 ----- 2 ----- 3 ----- 4 ----- 5 ----- 6 ----- 7 -- @@ -171,8 +171,8 @@ project │ │ │ │ ├── save-table-name: q15_scan_14 │ │ │ │ ├── columns: l_orderkey:28(int!null) l_linenumber:31(int!null) l_shipdate:38(date!null) │ │ │ │ ├── constraint: /38/28/31: [/'1996-01-01' - /'1996-03-31'] - │ │ │ │ ├── stats: [rows=229569.241, distinct(28)=217020.149, null(28)=0, distinct(31)=7, null(31)=0, distinct(38)=91, null(38)=0] - │ │ │ │ │ histogram(28)= 0 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1101.9 45.905 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1101.9 45.905 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1124.9 22.952 1147.8 22.952 1147.8 22.952 1147.8 22.952 1147.8 22.952 1147.8 22.952 1147.8 22.952 1147.8 22.952 1147.8 22.952 1147.8 22.952 1147.8 22.952 1147.8 22.952 1147.8 22.952 1147.8 22.952 1147.8 22.952 1147.8 22.952 1147.8 22.952 1147.8 22.952 1147.8 22.952 1147.8 22.952 1147.8 22.952 1147.8 22.952 1147.8 22.952 1147.8 22.952 1147.8 22.952 1147.8 22.952 1147.8 22.952 1147.8 22.952 1147.8 22.952 1147.8 22.952 1147.8 22.952 1147.8 22.952 1147.8 22.952 1147.8 22.952 1147.8 22.952 1147.8 22.952 1147.8 22.952 1147.8 22.952 1147.8 22.952 1147.8 22.952 1147.8 22.952 1147.8 22.952 1147.8 22.952 1147.8 22.952 1147.8 22.952 1147.8 22.952 1147.8 22.952 1147.8 22.952 1147.8 22.952 1147.8 22.952 + │ │ │ │ ├── stats: [rows=229569.241, distinct(28)=229569.241, null(28)=0, distinct(31)=7, null(31)=0, distinct(38)=91, null(38)=0] + │ │ │ │ │ histogram(28)= 0 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1101.9 45.906 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1101.9 45.906 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1124.9 22.953 1147.9 22.953 1147.9 22.953 1147.9 22.953 1147.9 22.953 1147.9 22.953 1147.9 22.953 1147.9 22.953 1147.9 22.953 1147.9 22.953 1147.9 22.953 1147.9 22.953 1147.9 22.953 1147.9 22.953 1147.9 22.953 1147.9 22.953 1147.9 22.953 1147.9 22.953 1147.9 22.953 1147.9 22.953 1147.9 22.953 1147.9 22.953 1147.9 22.953 1147.9 22.953 1147.9 22.953 1147.9 22.953 1147.9 22.953 1147.9 22.953 1147.9 22.953 1147.9 22.953 1147.9 22.953 1147.9 22.953 1147.9 22.953 1147.9 22.953 1147.9 22.953 1147.9 22.953 1147.9 22.953 1147.9 22.953 1147.9 22.953 1147.9 22.953 1147.9 22.953 1147.9 22.953 1147.9 22.953 1147.9 22.953 1147.9 22.953 1147.9 22.953 1147.9 22.953 1147.9 22.953 1147.9 22.953 1147.9 22.953 │ │ │ │ │ <---- 32 --------- 27780 -------- 60677 -------- 87430 -------- 111814 -------- 139648 -------- 166148 -------- 198051 -------- 232580 -------- 259104 -------- 283460 -------- 311460 -------- 344230 -------- 376102 -------- 408963 -------- 436743 -------- 470368 -------- 503942 -------- 531236 -------- 559395 -------- 589314 -------- 620839 -------- 649670 -------- 672483 -------- 698693 -------- 726629 -------- 756997 -------- 796164 -------- 824327 -------- 855873 -------- 882247 -------- 916418 -------- 951748 -------- 978498 -------- 1005765 -------- 1036864 -------- 1061351 -------- 1093638 -------- 1122308 -------- 1155844 -------- 1191239 -------- 1225540 -------- 1254915 -------- 1281670 -------- 1306721 -------- 1337410 -------- 1368419 -------- 1405382 -------- 1438210 -------- 1465477 -------- 1490627 -------- 1517251 -------- 1544289 -------- 1573729 -------- 1607168 -------- 1635648 -------- 1658848 -------- 1691623 -------- 1718631 -------- 1753345 -------- 1782470 -------- 1812742 -------- 1837702 -------- 1873349 -------- 1905733 -------- 1941024 -------- 1977287 -------- 2005826 -------- 2035300 -------- 2067878 -------- 2093927 -------- 2127906 -------- 2154055 -------- 2181095 -------- 2212035 -------- 2242374 -------- 2263458 -------- 2288481 -------- 2315300 -------- 2340997 -------- 2371200 -------- 2399616 -------- 2429154 -------- 2455393 -------- 2488384 -------- 2521088 -------- 2550885 -------- 2581058 -------- 2610496 -------- 2644197 -------- 2675648 -------- 2698821 -------- 2726246 -------- 2757444 -------- 2792612 -------- 2827174 -------- 2846849 -------- 2881250 -------- 2900739 -------- 2930660 -------- 2962240 -------- 2999235 -------- 3031974 -------- 3060197 -------- 3087586 -------- 3120390 -------- 3147524 -------- 3170721 -------- 3199173 -------- 3230049 -------- 3255008 -------- 3284965 -------- 3315744 -------- 3345376 -------- 3379776 -------- 3405445 -------- 3436711 -------- 3467557 -------- 3489541 -------- 3518179 -------- 3546276 -------- 3568964 -------- 3596039 -------- 3621926 -------- 3644805 -------- 3675361 -------- 3706592 -------- 3735589 -------- 3761220 -------- 3789607 -------- 3820866 -------- 3862274 -------- 3898051 -------- 3925188 -------- 3957157 -------- 3983873 -------- 4013092 -------- 4039202 -------- 4070918 -------- 4105696 -------- 4136867 -------- 4169475 -------- 4205249 -------- 4239013 -------- 4264423 -------- 4292135 -------- 4324453 -------- 4356356 -------- 4392386 -------- 4423074 -------- 4447335 -------- 4469345 -------- 4496513 -------- 4530848 -------- 4565159 -------- 4596965 -------- 4627011 -------- 4662598 -------- 4690818 -------- 4718691 -------- 4749349 -------- 4782722 -------- 4824485 -------- 4856323 -------- 4885795 -------- 4911142 -------- 4945794 -------- 4972801 -------- 5000583 -------- 5033735 -------- 5072421 -------- 5112929 -------- 5145956 -------- 5181923 -------- 5217478 -------- 5247620 -------- 5273605 -------- 5304100 -------- 5343362 -------- 5375842 -------- 5408391 -------- 5439046 -------- 5464610 -------- 5497857 -------- 5528295 -------- 5557956 -------- 5593474 -------- 5626209 -------- 5660931 -------- 5703463 -------- 5733440 -------- 5762565 -------- 5788034 -------- 5813505 -------- 5848227 -------- 5870727 -------- 5908998 -------- 5938311 -------- 5968930 -------- 5999751 │ │ │ │ │ histogram(31)= 0 57071 0 48829 0 39968 0 32323 0 25459 0 17126 0 8792.5 │ │ │ │ │ <---- 1 ----- 2 ----- 3 ----- 4 ----- 5 ----- 6 ----- 7 -- @@ -199,11 +199,11 @@ column_names row_count distinct_count null_count {total_revenue} 1 1 0 ~~~~ column_names row_count_est row_count_err distinct_count_est distinct_count_err null_count_est null_count_err -{s_address} 3333.00 3333.00 <== 2835.00 2835.00 <== 0.00 1.00 -{s_name} 3333.00 3333.00 <== 2834.00 2834.00 <== 0.00 1.00 -{s_phone} 3333.00 3333.00 <== 2835.00 2835.00 <== 0.00 1.00 +{s_address} 3333.00 3333.00 <== 3333.00 3333.00 <== 0.00 1.00 +{s_name} 3333.00 3333.00 <== 3333.00 3333.00 <== 0.00 1.00 +{s_phone} 3333.00 3333.00 <== 3333.00 3333.00 <== 0.00 1.00 {s_suppkey} 3333.00 3333.00 <== 3307.00 3307.00 <== 0.00 1.00 -{total_revenue} 3333.00 3333.00 <== 2100.00 2100.00 <== 0.00 1.00 +{total_revenue} 3333.00 3333.00 <== 3307.00 3307.00 <== 0.00 1.00 ----Stats for q15_merge_join_2---- column_names row_count distinct_count null_count @@ -216,11 +216,11 @@ column_names row_count distinct_count null_count ~~~~ column_names row_count_est row_count_err distinct_count_est distinct_count_err null_count_est null_count_err {l_suppkey} 3333.00 3333.00 <== 3307.00 3307.00 <== 0.00 1.00 -{s_address} 3333.00 3333.00 <== 2835.00 2835.00 <== 0.00 1.00 -{s_name} 3333.00 3333.00 <== 2834.00 2834.00 <== 0.00 1.00 -{s_phone} 3333.00 3333.00 <== 2835.00 2835.00 <== 0.00 1.00 +{s_address} 3333.00 3333.00 <== 3333.00 3333.00 <== 0.00 1.00 +{s_name} 3333.00 3333.00 <== 3333.00 3333.00 <== 0.00 1.00 +{s_phone} 3333.00 3333.00 <== 3333.00 3333.00 <== 0.00 1.00 {s_suppkey} 3333.00 3333.00 <== 3307.00 3307.00 <== 0.00 1.00 -{sum} 3333.00 3333.00 <== 2100.00 2100.00 <== 0.00 1.00 +{sum} 3333.00 3333.00 <== 3307.00 3307.00 <== 0.00 1.00 ----Stats for q15_scan_3---- column_names row_count distinct_count null_count @@ -292,7 +292,7 @@ column_names row_count distinct_count null_count ~~~~ column_names row_count_est row_count_err distinct_count_est distinct_count_err null_count_est null_count_err {l_linenumber} 229569.00 1.02 7.00 1.00 0.00 1.00 -{l_orderkey} 229569.00 1.02 217020.00 2.28 <== 0.00 1.00 +{l_orderkey} 229569.00 1.02 229569.00 2.41 <== 0.00 1.00 {l_shipdate} 229569.00 1.02 91.00 1.00 0.00 1.00 ----Stats for q15_scalar_group_by_10---- @@ -341,7 +341,7 @@ column_names row_count distinct_count null_count ~~~~ column_names row_count_est row_count_err distinct_count_est distinct_count_err null_count_est null_count_err {l_linenumber} 229569.00 1.02 7.00 1.00 0.00 1.00 -{l_orderkey} 229569.00 1.02 217020.00 2.28 <== 0.00 1.00 +{l_orderkey} 229569.00 1.02 229569.00 2.41 <== 0.00 1.00 {l_shipdate} 229569.00 1.02 91.00 1.00 0.00 1.00 ---- ---- diff --git a/pkg/sql/opt/memo/testdata/stats_quality/tpch/q16 b/pkg/sql/opt/memo/testdata/stats_quality/tpch/q16 index 7325ade1737d..b07cee05269d 100644 --- a/pkg/sql/opt/memo/testdata/stats_quality/tpch/q16 +++ b/pkg/sql/opt/memo/testdata/stats_quality/tpch/q16 @@ -54,7 +54,7 @@ ORDER BY sort ├── save-table-name: q16_sort_1 ├── columns: p_brand:10(char!null) p_type:11(varchar!null) p_size:12(int!null) supplier_cnt:25(int!null) - ├── stats: [rows=9962.4036, distinct(10)=25, null(10)=0, distinct(11)=150, null(11)=0, distinct(12)=8, null(12)=0, distinct(25)=9962.4036, null(25)=0, distinct(10-12)=9962.4036, null(10-12)=0] + ├── stats: [rows=0.854004637, distinct(10)=0.854004637, null(10)=0, distinct(11)=0.854004637, null(11)=0, distinct(12)=0.854004637, null(12)=0, distinct(25)=0.854004637, null(25)=0, distinct(10-12)=0.854004637, null(10-12)=0] ├── key: (10-12) ├── fd: (10-12)-->(25) ├── ordering: -25,+10,+11,+12 @@ -62,26 +62,26 @@ sort ├── save-table-name: q16_group_by_2 ├── columns: p_brand:10(char!null) p_type:11(varchar!null) p_size:12(int!null) count:25(int!null) ├── grouping columns: p_brand:10(char!null) p_type:11(varchar!null) p_size:12(int!null) - ├── stats: [rows=9962.4036, distinct(10)=25, null(10)=0, distinct(11)=150, null(11)=0, distinct(12)=8, null(12)=0, distinct(25)=9962.4036, null(25)=0, distinct(10-12)=9962.4036, null(10-12)=0] + ├── stats: [rows=0.854004637, distinct(10)=0.854004637, null(10)=0, distinct(11)=0.854004637, null(11)=0, distinct(12)=0.854004637, null(12)=0, distinct(25)=0.854004637, null(25)=0, distinct(10-12)=0.854004637, null(10-12)=0] ├── key: (10-12) ├── fd: (10-12)-->(25) ├── distinct-on │ ├── save-table-name: q16_distinct_on_3 │ ├── columns: ps_suppkey:2(int!null) p_brand:10(char!null) p_type:11(varchar!null) p_size:12(int!null) │ ├── grouping columns: ps_suppkey:2(int!null) p_brand:10(char!null) p_type:11(varchar!null) p_size:12(int!null) - │ ├── stats: [rows=28893.7828, distinct(2)=9381.05093, null(2)=0, distinct(10)=25, null(10)=0, distinct(11)=150, null(11)=0, distinct(12)=8, null(12)=0, distinct(10-12)=9962.4036, null(10-12)=0, distinct(2,10-12)=28893.7828, null(2,10-12)=0] + │ ├── stats: [rows=0.854004637, distinct(2)=8.00000071e-05, null(2)=0, distinct(10)=0.854004637, null(10)=0, distinct(11)=0.854004637, null(11)=0, distinct(12)=0.854004637, null(12)=0, distinct(10-12)=0.854004637, null(10-12)=0, distinct(2,10-12)=0.854004637, null(2,10-12)=0] │ ├── key: (2,10-12) │ └── anti-join (hash) │ ├── save-table-name: q16_anti_join_4 │ ├── columns: ps_partkey:1(int!null) ps_suppkey:2(int!null) p_partkey:7(int!null) p_brand:10(char!null) p_type:11(varchar!null) p_size:12(int!null) - │ ├── stats: [rows=28893.7828, distinct(1)=10693.3353, null(1)=0, distinct(2)=9381.05093, null(2)=0, distinct(7)=10693.3353, null(7)=0, distinct(10)=25, null(10)=0, distinct(11)=150, null(11)=0, distinct(12)=8, null(12)=0, distinct(10-12)=9962.4036, null(10-12)=0, distinct(2,10-12)=28893.7828, null(2,10-12)=0] + │ ├── stats: [rows=531647.382, distinct(1)=7.9999998e-05, null(1)=0, distinct(2)=8.00000071e-05, null(2)=0, distinct(7)=7.9999998e-05, null(7)=0, distinct(10)=25, null(10)=0, distinct(11)=150, null(11)=0, distinct(12)=8, null(12)=0, distinct(10-12)=10675.057, null(10-12)=0, distinct(2,10-12)=0.854004637, null(2,10-12)=0] │ ├── key: (2,7) │ ├── fd: (7)-->(10-12), (1)==(7), (7)==(1) │ ├── inner-join (lookup partsupp) │ │ ├── save-table-name: q16_lookup_join_5 │ │ ├── columns: ps_partkey:1(int!null) ps_suppkey:2(int!null) p_partkey:7(int!null) p_brand:10(char!null) p_type:11(varchar!null) p_size:12(int!null) │ │ ├── key columns: [7] = [1] - │ │ ├── stats: [rows=42940.7379, distinct(1)=10693.3353, null(1)=0, distinct(2)=9789.20988, null(2)=0, distinct(7)=10693.3353, null(7)=0, distinct(10)=25, null(10)=0, distinct(11)=150, null(11)=0, distinct(12)=8, null(12)=0] + │ │ ├── stats: [rows=42940.7379, distinct(1)=10693.3353, null(1)=0, distinct(2)=9920, null(2)=0, distinct(7)=10693.3353, null(7)=0, distinct(10)=25, null(10)=0, distinct(11)=150, null(11)=0, distinct(12)=8, null(12)=0] │ │ ├── key: (2,7) │ │ ├── fd: (7)-->(10-12), (1)==(7), (7)==(1) │ │ ├── select @@ -144,10 +144,10 @@ column_names row_count distinct_count null_count {supplier_cnt} 18314 15 0 ~~~~ column_names row_count_est row_count_err distinct_count_est distinct_count_err null_count_est null_count_err -{p_brand} 9962.00 1.84 25.00 1.04 0.00 1.00 -{p_size} 9962.00 1.84 8.00 1.00 0.00 1.00 -{p_type} 9962.00 1.84 150.00 1.03 0.00 1.00 -{supplier_cnt} 9962.00 1.84 9962.00 664.13 <== 0.00 1.00 +{p_brand} 1.00 18314.00 <== 1.00 24.00 <== 0.00 1.00 +{p_size} 1.00 18314.00 <== 1.00 8.00 <== 0.00 1.00 +{p_type} 1.00 18314.00 <== 1.00 145.00 <== 0.00 1.00 +{supplier_cnt} 1.00 18314.00 <== 1.00 15.00 <== 0.00 1.00 ----Stats for q16_group_by_2---- column_names row_count distinct_count null_count @@ -157,10 +157,10 @@ column_names row_count distinct_count null_count {p_type} 18314 145 0 ~~~~ column_names row_count_est row_count_err distinct_count_est distinct_count_err null_count_est null_count_err -{count} 9962.00 1.84 9962.00 664.13 <== 0.00 1.00 -{p_brand} 9962.00 1.84 25.00 1.04 0.00 1.00 -{p_size} 9962.00 1.84 8.00 1.00 0.00 1.00 -{p_type} 9962.00 1.84 150.00 1.03 0.00 1.00 +{count} 1.00 18314.00 <== 1.00 15.00 <== 0.00 1.00 +{p_brand} 1.00 18314.00 <== 1.00 24.00 <== 0.00 1.00 +{p_size} 1.00 18314.00 <== 1.00 8.00 <== 0.00 1.00 +{p_type} 1.00 18314.00 <== 1.00 145.00 <== 0.00 1.00 ----Stats for q16_distinct_on_3---- column_names row_count distinct_count null_count @@ -170,10 +170,10 @@ column_names row_count distinct_count null_count {ps_suppkey} 118250 9916 0 ~~~~ column_names row_count_est row_count_err distinct_count_est distinct_count_err null_count_est null_count_err -{p_brand} 28894.00 4.09 <== 25.00 1.04 0.00 1.00 -{p_size} 28894.00 4.09 <== 8.00 1.00 0.00 1.00 -{p_type} 28894.00 4.09 <== 150.00 1.03 0.00 1.00 -{ps_suppkey} 28894.00 4.09 <== 9381.00 1.06 0.00 1.00 +{p_brand} 1.00 118250.00 <== 1.00 24.00 <== 0.00 1.00 +{p_size} 1.00 118250.00 <== 1.00 8.00 <== 0.00 1.00 +{p_type} 1.00 118250.00 <== 1.00 145.00 <== 0.00 1.00 +{ps_suppkey} 1.00 118250.00 <== 0.00 +Inf <== 0.00 1.00 ----Stats for q16_anti_join_4---- column_names row_count distinct_count null_count @@ -185,12 +185,12 @@ column_names row_count distinct_count null_count {ps_suppkey} 118274 9916 0 ~~~~ column_names row_count_est row_count_err distinct_count_est distinct_count_err null_count_est null_count_err -{p_brand} 28894.00 4.09 <== 25.00 1.04 0.00 1.00 -{p_partkey} 28894.00 4.09 <== 10693.00 2.75 <== 0.00 1.00 -{p_size} 28894.00 4.09 <== 8.00 1.00 0.00 1.00 -{p_type} 28894.00 4.09 <== 150.00 1.03 0.00 1.00 -{ps_partkey} 28894.00 4.09 <== 10693.00 2.75 <== 0.00 1.00 -{ps_suppkey} 28894.00 4.09 <== 9381.00 1.06 0.00 1.00 +{p_brand} 531647.00 4.50 <== 25.00 1.04 0.00 1.00 +{p_partkey} 531647.00 4.50 <== 0.00 +Inf <== 0.00 1.00 +{p_size} 531647.00 4.50 <== 8.00 1.00 0.00 1.00 +{p_type} 531647.00 4.50 <== 150.00 1.03 0.00 1.00 +{ps_partkey} 531647.00 4.50 <== 0.00 +Inf <== 0.00 1.00 +{ps_suppkey} 531647.00 4.50 <== 0.00 +Inf <== 0.00 1.00 ----Stats for q16_lookup_join_5---- column_names row_count distinct_count null_count @@ -207,7 +207,7 @@ column_names row_count_est row_count_err distinct_count_est distinct_count_e {p_size} 42941.00 2.76 <== 8.00 1.00 0.00 1.00 {p_type} 42941.00 2.76 <== 150.00 1.03 0.00 1.00 {ps_partkey} 42941.00 2.76 <== 10693.00 2.75 <== 0.00 1.00 -{ps_suppkey} 42941.00 2.76 <== 9789.00 1.01 0.00 1.00 +{ps_suppkey} 42941.00 2.76 <== 9920.00 1.00 0.00 1.00 ----Stats for q16_select_6---- column_names row_count distinct_count null_count diff --git a/pkg/sql/opt/memo/testdata/stats_quality/tpch/q17 b/pkg/sql/opt/memo/testdata/stats_quality/tpch/q17 index 9dbcb006903c..fe325eb0f1d5 100644 --- a/pkg/sql/opt/memo/testdata/stats_quality/tpch/q17 +++ b/pkg/sql/opt/memo/testdata/stats_quality/tpch/q17 @@ -62,14 +62,14 @@ project │ │ ├── key columns: [1 4] = [1 4] │ │ ├── lookup columns are key │ │ ├── immutable - │ │ ├── stats: [rows=2010.74031, distinct(2)=200.270401, null(2)=0, distinct(5)=50, null(5)=0, distinct(6)=2008.56038, null(6)=0, distinct(18)=200.270401, null(18)=0, distinct(46)=200.270401, null(46)=0] + │ │ ├── stats: [rows=2010.74031, distinct(2)=200.270401, null(2)=0, distinct(5)=50, null(5)=0, distinct(6)=2010.74031, null(6)=0, distinct(18)=200.270401, null(18)=0, distinct(46)=200.270401, null(46)=0] │ │ ├── fd: (18)-->(46), (2)==(18), (18)==(2) │ │ ├── inner-join (lookup lineitem@l_pk) │ │ │ ├── save-table-name: q17_lookup_join_4 │ │ │ ├── columns: l_orderkey:1(int!null) l_partkey:2(int!null) l_linenumber:4(int!null) p_partkey:18(int!null) "?column?":46(float!null) │ │ │ ├── key columns: [18] = [2] │ │ │ ├── immutable - │ │ │ ├── stats: [rows=6032.22094, distinct(1)=6020.33903, null(1)=0, distinct(2)=200.270401, null(2)=0, distinct(4)=7, null(4)=0, distinct(18)=200.270401, null(18)=0, distinct(46)=200.270401, null(46)=0] + │ │ │ ├── stats: [rows=6032.22094, distinct(1)=6032.22094, null(1)=0, distinct(2)=200.270401, null(2)=0, distinct(4)=7, null(4)=0, distinct(18)=200.270401, null(18)=0, distinct(46)=200.270401, null(46)=0] │ │ │ ├── key: (1,4) │ │ │ ├── fd: (18)-->(46), (1,4)-->(2), (2)==(18), (18)==(2) │ │ │ ├── project @@ -99,7 +99,7 @@ project │ │ │ │ │ │ │ ├── save-table-name: q17_lookup_join_8 │ │ │ │ │ │ │ ├── columns: p_partkey:18(int!null) p_brand:21(char!null) p_container:24(char!null) l_orderkey:28(int!null) l_partkey:29(int!null) l_linenumber:31(int!null) │ │ │ │ │ │ │ ├── key columns: [18] = [29] - │ │ │ │ │ │ │ ├── stats: [rows=6032.23245, distinct(18)=200.270401, null(18)=0, distinct(21)=1, null(21)=0, distinct(24)=1, null(24)=0, distinct(28)=6020.35049, null(28)=0, distinct(29)=200.270401, null(29)=0, distinct(31)=7, null(31)=0] + │ │ │ │ │ │ │ ├── stats: [rows=6032.23245, distinct(18)=200.270401, null(18)=0, distinct(21)=1, null(21)=0, distinct(24)=1, null(24)=0, distinct(28)=6032.23245, null(28)=0, distinct(29)=200.270401, null(29)=0, distinct(31)=7, null(31)=0] │ │ │ │ │ │ │ ├── key: (28,31) │ │ │ │ │ │ │ ├── fd: ()-->(21,24), (28,31)-->(29), (18)==(29), (29)==(18) │ │ │ │ │ │ │ ├── ordering: +(18|29) opt(21,24) [actual: +18] @@ -170,7 +170,7 @@ column_names row_count distinct_count null_count ~~~~ column_names row_count_est row_count_err distinct_count_est distinct_count_err null_count_est null_count_err {?column?} 2011.00 3.43 <== 200.00 1.08 0.00 1.00 -{l_extendedprice} 2011.00 3.43 <== 2009.00 4.67 <== 0.00 1.00 +{l_extendedprice} 2011.00 3.43 <== 2011.00 4.68 <== 0.00 1.00 {l_partkey} 2011.00 3.43 <== 200.00 1.03 0.00 1.00 {l_quantity} 2011.00 3.43 <== 50.00 8.33 <== 0.00 1.00 {p_partkey} 2011.00 3.43 <== 200.00 1.03 0.00 1.00 @@ -186,7 +186,7 @@ column_names row_count distinct_count null_count column_names row_count_est row_count_err distinct_count_est distinct_count_err null_count_est null_count_err {?column?} 6032.00 1.01 200.00 1.03 0.00 1.00 {l_linenumber} 6032.00 1.01 7.00 1.00 0.00 1.00 -{l_orderkey} 6032.00 1.01 6020.00 1.02 0.00 1.00 +{l_orderkey} 6032.00 1.01 6032.00 1.01 0.00 1.00 {l_partkey} 6032.00 1.01 200.00 1.02 0.00 1.00 {p_partkey} 6032.00 1.01 200.00 1.02 0.00 1.00 @@ -234,7 +234,7 @@ column_names row_count distinct_count null_count ~~~~ column_names row_count_est row_count_err distinct_count_est distinct_count_err null_count_est null_count_err {l_linenumber} 6032.00 1.01 7.00 1.00 0.00 1.00 -{l_orderkey} 6032.00 1.01 6020.00 1.02 0.00 1.00 +{l_orderkey} 6032.00 1.01 6032.00 1.01 0.00 1.00 {l_partkey} 6032.00 1.01 200.00 1.02 0.00 1.00 {p_brand} 6032.00 1.01 1.00 1.00 0.00 1.00 {p_container} 6032.00 1.01 1.00 1.00 0.00 1.00 diff --git a/pkg/sql/opt/memo/testdata/stats_quality/tpch/q18 b/pkg/sql/opt/memo/testdata/stats_quality/tpch/q18 index de775d0f3031..0c417999b000 100644 --- a/pkg/sql/opt/memo/testdata/stats_quality/tpch/q18 +++ b/pkg/sql/opt/memo/testdata/stats_quality/tpch/q18 @@ -63,7 +63,7 @@ limit ├── sort │ ├── save-table-name: q18_sort_2 │ ├── columns: c_custkey:1(int!null) c_name:2(varchar!null) o_orderkey:10(int!null) o_totalprice:13(float!null) o_orderdate:14(date!null) sum:55(float!null) - │ ├── stats: [rows=499392.239, distinct(1)=499392.239, null(1)=0, distinct(2)=499392.239, null(2)=0, distinct(10)=499392.239, null(10)=0, distinct(13)=499392.239, null(13)=0, distinct(14)=499392.239, null(14)=0, distinct(55)=499392.239, null(55)=0] + │ ├── stats: [rows=509090, distinct(1)=509090, null(1)=0, distinct(2)=509090, null(2)=0, distinct(10)=509090, null(10)=0, distinct(13)=509090, null(13)=0, distinct(14)=509090, null(14)=0, distinct(55)=509090, null(55)=0] │ ├── key: (10) │ ├── fd: (1)-->(2), (10)-->(1,2,13,14,55) │ ├── ordering: -13,+14 @@ -72,14 +72,14 @@ limit │ ├── save-table-name: q18_group_by_3 │ ├── columns: c_custkey:1(int!null) c_name:2(varchar!null) o_orderkey:10(int!null) o_totalprice:13(float!null) o_orderdate:14(date!null) sum:55(float!null) │ ├── grouping columns: o_orderkey:10(int!null) - │ ├── stats: [rows=499392.239, distinct(1)=499392.239, null(1)=0, distinct(2)=499392.239, null(2)=0, distinct(10)=499392.239, null(10)=0, distinct(13)=499392.239, null(13)=0, distinct(14)=499392.239, null(14)=0, distinct(55)=499392.239, null(55)=0] + │ ├── stats: [rows=509090, distinct(1)=509090, null(1)=0, distinct(2)=509090, null(2)=0, distinct(10)=509090, null(10)=0, distinct(13)=509090, null(13)=0, distinct(14)=509090, null(14)=0, distinct(55)=509090, null(55)=0] │ ├── key: (10) │ ├── fd: (1)-->(2), (10)-->(1,2,13,14,55) │ ├── inner-join (hash) │ │ ├── save-table-name: q18_inner_join_4 │ │ ├── columns: c_custkey:1(int!null) c_name:2(varchar!null) o_orderkey:10(int!null) o_custkey:11(int!null) o_totalprice:13(float!null) o_orderdate:14(date!null) l_orderkey:20(int!null) l_quantity:24(float!null) │ │ ├── multiplicity: left-rows(zero-or-one), right-rows(zero-or-more) - │ │ ├── stats: [rows=2016361.14, distinct(1)=99649.071, null(1)=0, distinct(2)=149999.782, null(2)=0, distinct(10)=499392.239, null(10)=0, distinct(11)=99649.071, null(11)=0, distinct(13)=488043.529, null(13)=0, distinct(14)=2406, null(14)=0, distinct(20)=499392.239, null(20)=0, distinct(24)=50, null(24)=0] + │ │ ├── stats: [rows=2016361.14, distinct(1)=99846, null(1)=0, distinct(2)=150000, null(2)=0, distinct(10)=509090, null(10)=0, distinct(11)=99846, null(11)=0, distinct(13)=509090, null(13)=0, distinct(14)=2406, null(14)=0, distinct(20)=509090, null(20)=0, distinct(24)=50, null(24)=0] │ │ ├── fd: (1)-->(2), (10)-->(11,13,14), (10)==(20), (20)==(10), (1)==(11), (11)==(1) │ │ ├── scan lineitem │ │ │ ├── save-table-name: q18_scan_5 @@ -93,7 +93,7 @@ limit │ │ │ ├── save-table-name: q18_inner_join_6 │ │ │ ├── columns: c_custkey:1(int!null) c_name:2(varchar!null) o_orderkey:10(int!null) o_custkey:11(int!null) o_totalprice:13(float!null) o_orderdate:14(date!null) │ │ │ ├── multiplicity: left-rows(exactly-one), right-rows(zero-or-more) - │ │ │ ├── stats: [rows=513150.733, distinct(1)=99649.0712, null(1)=0, distinct(2)=145098.119, null(2)=0, distinct(10)=323294.803, null(10)=0, distinct(11)=99649.0712, null(11)=0, distinct(13)=322560.125, null(13)=0, distinct(14)=2406, null(14)=0] + │ │ │ ├── stats: [rows=513150.733, distinct(1)=99846, null(1)=0, distinct(2)=150000, null(2)=0, distinct(10)=509090, null(10)=0, distinct(11)=99846, null(11)=0, distinct(13)=509090, null(13)=0, distinct(14)=2406, null(14)=0] │ │ │ ├── key: (10) │ │ │ ├── fd: (1)-->(2), (10)-->(11,13,14), (1)==(11), (11)==(1) │ │ │ ├── semi-join (merge) @@ -101,7 +101,7 @@ limit │ │ │ │ ├── columns: o_orderkey:10(int!null) o_custkey:11(int!null) o_totalprice:13(float!null) o_orderdate:14(date!null) │ │ │ │ ├── left ordering: +10 │ │ │ │ ├── right ordering: +37 - │ │ │ │ ├── stats: [rows=509090, distinct(10)=509090, null(10)=0, distinct(11)=99649.0712, null(11)=0, distinct(13)=506350.486, null(13)=0, distinct(14)=2406, null(14)=0] + │ │ │ │ ├── stats: [rows=509090, distinct(10)=509090, null(10)=0, distinct(11)=99846, null(11)=0, distinct(13)=509090, null(13)=0, distinct(14)=2406, null(14)=0] │ │ │ │ ├── key: (10) │ │ │ │ ├── fd: (10)-->(11,13,14) │ │ │ │ ├── scan orders @@ -203,12 +203,12 @@ column_names row_count distinct_count null_count {sum} 57 18 0 ~~~~ column_names row_count_est row_count_err distinct_count_est distinct_count_err null_count_est null_count_err -{c_custkey} 499392.00 8761.26 <== 499392.00 8761.26 <== 0.00 1.00 -{c_name} 499392.00 8761.26 <== 499392.00 8761.26 <== 0.00 1.00 -{o_orderdate} 499392.00 8761.26 <== 499392.00 8761.26 <== 0.00 1.00 -{o_orderkey} 499392.00 8761.26 <== 499392.00 8761.26 <== 0.00 1.00 -{o_totalprice} 499392.00 8761.26 <== 499392.00 8761.26 <== 0.00 1.00 -{sum} 499392.00 8761.26 <== 499392.00 27744.00 <== 0.00 1.00 +{c_custkey} 509090.00 8931.40 <== 509090.00 8931.40 <== 0.00 1.00 +{c_name} 509090.00 8931.40 <== 509090.00 8931.40 <== 0.00 1.00 +{o_orderdate} 509090.00 8931.40 <== 509090.00 8931.40 <== 0.00 1.00 +{o_orderkey} 509090.00 8931.40 <== 509090.00 8931.40 <== 0.00 1.00 +{o_totalprice} 509090.00 8931.40 <== 509090.00 8931.40 <== 0.00 1.00 +{sum} 509090.00 8931.40 <== 509090.00 28282.78 <== 0.00 1.00 ----Stats for q18_group_by_3---- column_names row_count distinct_count null_count @@ -220,12 +220,12 @@ column_names row_count distinct_count null_count {sum} 57 18 0 ~~~~ column_names row_count_est row_count_err distinct_count_est distinct_count_err null_count_est null_count_err -{c_custkey} 499392.00 8761.26 <== 499392.00 8761.26 <== 0.00 1.00 -{c_name} 499392.00 8761.26 <== 499392.00 8761.26 <== 0.00 1.00 -{o_orderdate} 499392.00 8761.26 <== 499392.00 8761.26 <== 0.00 1.00 -{o_orderkey} 499392.00 8761.26 <== 499392.00 8761.26 <== 0.00 1.00 -{o_totalprice} 499392.00 8761.26 <== 499392.00 8761.26 <== 0.00 1.00 -{sum} 499392.00 8761.26 <== 499392.00 27744.00 <== 0.00 1.00 +{c_custkey} 509090.00 8931.40 <== 509090.00 8931.40 <== 0.00 1.00 +{c_name} 509090.00 8931.40 <== 509090.00 8931.40 <== 0.00 1.00 +{o_orderdate} 509090.00 8931.40 <== 509090.00 8931.40 <== 0.00 1.00 +{o_orderkey} 509090.00 8931.40 <== 509090.00 8931.40 <== 0.00 1.00 +{o_totalprice} 509090.00 8931.40 <== 509090.00 8931.40 <== 0.00 1.00 +{sum} 509090.00 8931.40 <== 509090.00 28282.78 <== 0.00 1.00 ----Stats for q18_inner_join_4---- column_names row_count distinct_count null_count @@ -239,14 +239,14 @@ column_names row_count distinct_count null_count {o_totalprice} 399 57 0 ~~~~ column_names row_count_est row_count_err distinct_count_est distinct_count_err null_count_est null_count_err -{c_custkey} 2016361.00 5053.54 <== 99649.00 1748.23 <== 0.00 1.00 +{c_custkey} 2016361.00 5053.54 <== 99846.00 1751.68 <== 0.00 1.00 {c_name} 2016361.00 5053.54 <== 150000.00 2631.58 <== 0.00 1.00 -{l_orderkey} 2016361.00 5053.54 <== 499392.00 8761.26 <== 0.00 1.00 +{l_orderkey} 2016361.00 5053.54 <== 509090.00 8931.40 <== 0.00 1.00 {l_quantity} 2016361.00 5053.54 <== 50.00 1.85 0.00 1.00 -{o_custkey} 2016361.00 5053.54 <== 99649.00 1748.23 <== 0.00 1.00 +{o_custkey} 2016361.00 5053.54 <== 99846.00 1751.68 <== 0.00 1.00 {o_orderdate} 2016361.00 5053.54 <== 2406.00 42.21 <== 0.00 1.00 -{o_orderkey} 2016361.00 5053.54 <== 499392.00 8761.26 <== 0.00 1.00 -{o_totalprice} 2016361.00 5053.54 <== 488044.00 8562.18 <== 0.00 1.00 +{o_orderkey} 2016361.00 5053.54 <== 509090.00 8931.40 <== 0.00 1.00 +{o_totalprice} 2016361.00 5053.54 <== 509090.00 8931.40 <== 0.00 1.00 ----Stats for q18_scan_5---- column_names row_count distinct_count null_count @@ -267,12 +267,12 @@ column_names row_count distinct_count null_count {o_totalprice} 57 57 0 ~~~~ column_names row_count_est row_count_err distinct_count_est distinct_count_err null_count_est null_count_err -{c_custkey} 513151.00 9002.65 <== 99649.00 1748.23 <== 0.00 1.00 -{c_name} 513151.00 9002.65 <== 145098.00 2545.58 <== 0.00 1.00 -{o_custkey} 513151.00 9002.65 <== 99649.00 1748.23 <== 0.00 1.00 +{c_custkey} 513151.00 9002.65 <== 99846.00 1751.68 <== 0.00 1.00 +{c_name} 513151.00 9002.65 <== 150000.00 2631.58 <== 0.00 1.00 +{o_custkey} 513151.00 9002.65 <== 99846.00 1751.68 <== 0.00 1.00 {o_orderdate} 513151.00 9002.65 <== 2406.00 42.21 <== 0.00 1.00 -{o_orderkey} 513151.00 9002.65 <== 323295.00 5671.84 <== 0.00 1.00 -{o_totalprice} 513151.00 9002.65 <== 322560.00 5658.95 <== 0.00 1.00 +{o_orderkey} 513151.00 9002.65 <== 509090.00 8931.40 <== 0.00 1.00 +{o_totalprice} 513151.00 9002.65 <== 509090.00 8931.40 <== 0.00 1.00 ----Stats for q18_merge_join_7---- column_names row_count distinct_count null_count @@ -282,10 +282,10 @@ column_names row_count distinct_count null_count {o_totalprice} 57 57 0 ~~~~ column_names row_count_est row_count_err distinct_count_est distinct_count_err null_count_est null_count_err -{o_custkey} 509090.00 8931.40 <== 99649.00 1748.23 <== 0.00 1.00 +{o_custkey} 509090.00 8931.40 <== 99846.00 1751.68 <== 0.00 1.00 {o_orderdate} 509090.00 8931.40 <== 2406.00 42.21 <== 0.00 1.00 {o_orderkey} 509090.00 8931.40 <== 509090.00 8931.40 <== 0.00 1.00 -{o_totalprice} 509090.00 8931.40 <== 506350.00 8883.33 <== 0.00 1.00 +{o_totalprice} 509090.00 8931.40 <== 509090.00 8931.40 <== 0.00 1.00 ----Stats for q18_scan_8---- column_names row_count distinct_count null_count diff --git a/pkg/sql/opt/memo/testdata/stats_quality/tpch/q19 b/pkg/sql/opt/memo/testdata/stats_quality/tpch/q19 index b901642b8681..9d81854aa4c3 100644 --- a/pkg/sql/opt/memo/testdata/stats_quality/tpch/q19 +++ b/pkg/sql/opt/memo/testdata/stats_quality/tpch/q19 @@ -66,12 +66,12 @@ scalar-group-by │ ├── save-table-name: q19_project_2 │ ├── columns: column28:28(float!null) │ ├── immutable - │ ├── stats: [rows=190.292138, distinct(28)=190.249692, null(28)=0] + │ ├── stats: [rows=190.292138, distinct(28)=190.292138, null(28)=0] │ ├── inner-join (hash) │ │ ├── save-table-name: q19_inner_join_3 │ │ ├── columns: l_partkey:2(int!null) l_quantity:5(float!null) l_extendedprice:6(float!null) l_discount:7(float!null) l_shipinstruct:14(char!null) l_shipmode:15(char!null) p_partkey:18(int!null) p_brand:21(char!null) p_size:23(int!null) p_container:24(char!null) │ │ ├── multiplicity: left-rows(zero-or-one), right-rows(zero-or-more) - │ │ ├── stats: [rows=190.292138, distinct(2)=190.292138, null(2)=0, distinct(5)=5.55555556, null(5)=0, distinct(6)=190.24067, null(6)=0, distinct(7)=10.9999997, null(7)=0, distinct(14)=1, null(14)=0, distinct(15)=2, null(15)=0, distinct(18)=190.292138, null(18)=0, distinct(21)=3, null(21)=0, distinct(23)=16.6666667, null(23)=0, distinct(24)=12, null(24)=0, distinct(6,7)=190.249692, null(6,7)=0, distinct(21,23,24)=190.292138, null(21,23,24)=0] + │ │ ├── stats: [rows=190.292138, distinct(2)=190.292138, null(2)=0, distinct(5)=5.55555556, null(5)=0, distinct(6)=190.292138, null(6)=0, distinct(7)=11, null(7)=0, distinct(14)=1, null(14)=0, distinct(15)=2, null(15)=0, distinct(18)=190.292138, null(18)=0, distinct(21)=3, null(21)=0, distinct(23)=16.6666667, null(23)=0, distinct(24)=12, null(24)=0, distinct(6,7)=190.292138, null(6,7)=0, distinct(21,23,24)=190.292138, null(21,23,24)=0] │ │ ├── fd: ()-->(14), (18)-->(21,23,24), (2)==(18), (18)==(2) │ │ ├── select │ │ │ ├── save-table-name: q19_select_4 diff --git a/pkg/sql/opt/memo/testdata/stats_quality/tpch/q20 b/pkg/sql/opt/memo/testdata/stats_quality/tpch/q20 index 73a99692185b..5c2552cb6e34 100644 --- a/pkg/sql/opt/memo/testdata/stats_quality/tpch/q20 +++ b/pkg/sql/opt/memo/testdata/stats_quality/tpch/q20 @@ -62,26 +62,26 @@ sort ├── save-table-name: q20_sort_1 ├── columns: s_name:2(char!null) s_address:3(varchar!null) ├── immutable - ├── stats: [rows=5.06887952, distinct(2)=5.06887886, null(2)=0, distinct(3)=5.06887952, null(3)=0] + ├── stats: [rows=5.03700236, distinct(2)=5.03700236, null(2)=0, distinct(3)=5.03700236, null(3)=0] ├── ordering: +2 └── project ├── save-table-name: q20_project_2 ├── columns: s_name:2(char!null) s_address:3(varchar!null) ├── immutable - ├── stats: [rows=5.06887952, distinct(2)=5.06887886, null(2)=0, distinct(3)=5.06887952, null(3)=0] + ├── stats: [rows=5.03700236, distinct(2)=5.03700236, null(2)=0, distinct(3)=5.03700236, null(3)=0] └── inner-join (hash) ├── save-table-name: q20_inner_join_3 ├── columns: s_suppkey:1(int!null) s_name:2(char!null) s_address:3(varchar!null) s_nationkey:4(int!null) n_nationkey:9(int!null) n_name:10(char!null) ├── multiplicity: left-rows(zero-or-one), right-rows(zero-or-more) ├── immutable - ├── stats: [rows=5.06887952, distinct(1)=5.06804561, null(1)=0, distinct(2)=5.06887886, null(2)=0, distinct(3)=5.06887952, null(3)=0, distinct(4)=1, null(4)=0, distinct(9)=1, null(9)=0, distinct(10)=0.994336549, null(10)=0] + ├── stats: [rows=5.03700236, distinct(1)=5.03700236, null(1)=0, distinct(2)=5.03700236, null(2)=0, distinct(3)=5.03700236, null(3)=0, distinct(4)=1, null(4)=0, distinct(9)=1, null(9)=0, distinct(10)=1, null(10)=0] ├── key: (1) ├── fd: ()-->(10), (1)-->(2-4), (4)==(9), (9)==(4) ├── project │ ├── save-table-name: q20_project_4 │ ├── columns: s_suppkey:1(int!null) s_name:2(char!null) s_address:3(varchar!null) s_nationkey:4(int!null) │ ├── immutable - │ ├── stats: [rows=125.925059, distinct(1)=124.917659, null(1)=0, distinct(2)=125.924262, null(2)=0, distinct(3)=125.925059, null(3)=0, distinct(4)=24.8427801, null(4)=0] + │ ├── stats: [rows=125.925059, distinct(1)=124.917659, null(1)=0, distinct(2)=125.925059, null(2)=0, distinct(3)=125.925059, null(3)=0, distinct(4)=25, null(4)=0] │ ├── key: (1) │ ├── fd: (1)-->(2-4) │ └── inner-join (lookup supplier) @@ -90,7 +90,7 @@ sort │ ├── key columns: [15] = [1] │ ├── lookup columns are key │ ├── immutable - │ ├── stats: [rows=125.925059, distinct(1)=124.917659, null(1)=0, distinct(2)=125.141001, null(2)=0, distinct(3)=125.141789, null(3)=0, distinct(4)=24.8377116, null(4)=0, distinct(15)=124.917659, null(15)=0] + │ ├── stats: [rows=125.925059, distinct(1)=124.917659, null(1)=0, distinct(2)=125.925059, null(2)=0, distinct(3)=125.925059, null(3)=0, distinct(4)=25, null(4)=0, distinct(15)=124.917659, null(15)=0] │ ├── key: (15) │ ├── fd: (1)-->(2-4), (1)==(15), (15)==(1) │ ├── distinct-on @@ -132,7 +132,7 @@ sort │ │ │ │ │ ├── save-table-name: q20_inner_join_11 │ │ │ │ │ ├── columns: ps_partkey:14(int!null) ps_suppkey:15(int!null) ps_availqty:16(int!null) l_partkey:31(int!null) l_suppkey:32(int!null) l_quantity:34(float!null) l_shipdate:40(date!null) │ │ │ │ │ ├── multiplicity: left-rows(exactly-one), right-rows(zero-or-more) - │ │ │ │ │ ├── stats: [rows=374.752976, distinct(14)=374.752976, null(14)=0, distinct(15)=374.752976, null(15)=0, distinct(16)=367.762691, null(16)=0, distinct(31)=374.752976, null(31)=0, distinct(32)=374.752976, null(32)=0, distinct(34)=49.9722088, null(34)=0, distinct(40)=234.264424, null(40)=0, distinct(14,15)=374.752976, null(14,15)=0] + │ │ │ │ │ ├── stats: [rows=374.752976, distinct(14)=374.752976, null(14)=0, distinct(15)=374.752976, null(15)=0, distinct(16)=374.752976, null(16)=0, distinct(31)=374.752976, null(31)=0, distinct(32)=374.752976, null(32)=0, distinct(34)=50, null(34)=0, distinct(40)=365, null(40)=0, distinct(14,15)=374.752976, null(14,15)=0] │ │ │ │ │ ├── fd: (14,15)-->(16), (14)==(31), (31)==(14), (15)==(32), (32)==(15) │ │ │ │ │ ├── index-join lineitem │ │ │ │ │ │ ├── save-table-name: q20_index_join_12 @@ -144,9 +144,9 @@ sort │ │ │ │ │ │ ├── save-table-name: q20_scan_13 │ │ │ │ │ │ ├── columns: l_orderkey:30(int!null) l_linenumber:33(int!null) l_shipdate:40(date!null) │ │ │ │ │ │ ├── constraint: /40/30/33: [/'1994-01-01' - /'1994-12-31'] - │ │ │ │ │ │ ├── stats: [rows=925860.354, distinct(30)=736656.352, null(30)=0, distinct(33)=7, null(33)=0, distinct(40)=365, null(40)=0] - │ │ │ │ │ │ │ histogram(30)= 0 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4444 185.13 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4444 185.13 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4536.6 92.567 4629.3 92.567 4629.3 92.567 4629.3 92.567 4629.3 92.567 4629.3 92.567 4629.3 92.567 4629.3 92.567 4629.3 92.567 4629.3 92.567 4629.3 92.567 4629.3 92.567 4629.3 92.567 4629.3 92.567 4629.3 92.567 4629.3 92.567 4629.3 92.567 4629.3 92.567 4629.3 92.567 4629.3 92.567 4629.3 92.567 4629.3 92.567 4629.3 92.567 4629.3 92.567 4629.3 92.567 4629.3 92.567 4629.3 92.567 4629.3 92.567 4629.3 92.567 4629.3 92.567 4629.3 92.567 4629.3 92.567 4629.3 92.567 4629.3 92.567 4629.3 92.567 4629.3 92.567 4629.3 92.567 4629.3 92.567 4629.3 92.567 4629.3 92.567 4629.3 92.567 4629.3 92.567 4629.3 92.567 4629.3 92.567 4629.3 92.567 4629.3 92.567 4629.3 92.567 4629.3 92.567 4629.3 92.567 4629.3 92.567 - │ │ │ │ │ │ │ <---- 32 --------- 27780 -------- 60677 -------- 87430 -------- 111814 -------- 139648 -------- 166148 -------- 198051 -------- 232580 -------- 259104 -------- 283460 -------- 311460 -------- 344230 -------- 376102 -------- 408963 -------- 436743 -------- 470368 -------- 503942 -------- 531236 -------- 559395 -------- 589314 -------- 620839 -------- 649670 -------- 672483 -------- 698693 -------- 726629 -------- 756997 -------- 796164 -------- 824327 -------- 855873 -------- 882247 -------- 916418 -------- 951748 -------- 978498 -------- 1005765 -------- 1036864 -------- 1061351 -------- 1093638 -------- 1122308 -------- 1155844 -------- 1191239 -------- 1225540 -------- 1254915 -------- 1281670 -------- 1306721 -------- 1337410 -------- 1368419 -------- 1405382 -------- 1438210 -------- 1465477 -------- 1490627 -------- 1517251 -------- 1544289 -------- 1573729 -------- 1607168 -------- 1635648 -------- 1658848 -------- 1691623 -------- 1718631 -------- 1753345 -------- 1782470 -------- 1812742 -------- 1837702 -------- 1873349 -------- 1905733 -------- 1941024 -------- 1977287 -------- 2005826 -------- 2035300 -------- 2067878 -------- 2093927 -------- 2127906 -------- 2154055 -------- 2181095 -------- 2212035 -------- 2242374 -------- 2263458 -------- 2288481 -------- 2315300 -------- 2340997 -------- 2371200 -------- 2399616 -------- 2429154 -------- 2455393 -------- 2488384 -------- 2521088 -------- 2550885 -------- 2581058 -------- 2610496 -------- 2644197 -------- 2675648 -------- 2698821 -------- 2726246 -------- 2757444 -------- 2792612 -------- 2827174 -------- 2846849 -------- 2881250 -------- 2900739 -------- 2930660 -------- 2962240 -------- 2999235 -------- 3031974 -------- 3060197 -------- 3087586 -------- 3120390 -------- 3147524 -------- 3170721 -------- 3199173 ------ 3230049 -------- 3255008 -------- 3284965 -------- 3315744 -------- 3345376 -------- 3379776 -------- 3405445 -------- 3436711 -------- 3467557 -------- 3489541 -------- 3518179 -------- 3546276 -------- 3568964 ------ 3596039 -------- 3621926 -------- 3644805 -------- 3675361 -------- 3706592 -------- 3735589 -------- 3761220 -------- 3789607 -------- 3820866 -------- 3862274 -------- 3898051 -------- 3925188 -------- 3957157 -------- 3983873 -------- 4013092 -------- 4039202 -------- 4070918 -------- 4105696 -------- 4136867 -------- 4169475 -------- 4205249 -------- 4239013 -------- 4264423 -------- 4292135 -------- 4324453 -------- 4356356 -------- 4392386 -------- 4423074 -------- 4447335 -------- 4469345 -------- 4496513 -------- 4530848 -------- 4565159 -------- 4596965 -------- 4627011 -------- 4662598 -------- 4690818 -------- 4718691 -------- 4749349 -------- 4782722 -------- 4824485 -------- 4856323 -------- 4885795 -------- 4911142 -------- 4945794 -------- 4972801 -------- 5000583 -------- 5033735 -------- 5072421 -------- 5112929 -------- 5145956 -------- 5181923 -------- 5217478 -------- 5247620 -------- 5273605 -------- 5304100 -------- 5343362 -------- 5375842 -------- 5408391 -------- 5439046 -------- 5464610 -------- 5497857 -------- 5528295 -------- 5557956 -------- 5593474 -------- 5626209 -------- 5660931 -------- 5703463 -------- 5733440 -------- 5762565 -------- 5788034 -------- 5813505 -------- 5848227 -------- 5870727 -------- 5908998 -------- 5938311 -------- 5968930 -------- 5999751 + │ │ │ │ │ │ ├── stats: [rows=925860.354, distinct(30)=925860.354, null(30)=0, distinct(33)=7, null(33)=0, distinct(40)=365, null(40)=0] + │ │ │ │ │ │ │ histogram(30)= 0 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4444.1 185.14 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4444.1 185.14 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4536.7 92.57 4629.4 92.57 4629.4 92.57 4629.4 92.57 4629.4 92.57 4629.4 92.57 4629.4 92.57 4629.4 92.57 4629.4 92.57 4629.4 92.57 4629.4 92.57 4629.4 92.57 4629.4 92.57 4629.4 92.57 4629.4 92.57 4629.4 92.57 4629.4 92.57 4629.4 92.57 4629.4 92.57 4629.4 92.57 4629.4 92.57 4629.4 92.57 4629.4 92.57 4629.4 92.57 4629.4 92.57 4629.4 92.57 4629.4 92.57 4629.4 92.57 4629.4 92.57 4629.4 92.57 4629.4 92.57 4629.4 92.57 4629.4 92.57 4629.4 92.57 4629.4 92.57 4629.4 92.57 4629.4 92.57 4629.4 92.57 4629.4 92.57 4629.4 92.57 4629.4 92.57 4629.4 92.57 4629.4 92.57 4629.4 92.57 4629.4 92.57 4629.4 92.57 4629.4 92.57 4629.4 92.57 4629.4 92.57 4629.4 92.57 + │ │ │ │ │ │ │ <--- 32 --------- 27780 -------- 60677 -------- 87430 -------- 111814 -------- 139648 -------- 166148 -------- 198051 -------- 232580 -------- 259104 -------- 283460 -------- 311460 -------- 344230 -------- 376102 -------- 408963 -------- 436743 -------- 470368 -------- 503942 -------- 531236 -------- 559395 -------- 589314 -------- 620839 -------- 649670 -------- 672483 -------- 698693 -------- 726629 -------- 756997 -------- 796164 -------- 824327 -------- 855873 -------- 882247 -------- 916418 -------- 951748 -------- 978498 -------- 1005765 -------- 1036864 -------- 1061351 -------- 1093638 -------- 1122308 -------- 1155844 -------- 1191239 -------- 1225540 -------- 1254915 -------- 1281670 -------- 1306721 -------- 1337410 -------- 1368419 -------- 1405382 -------- 1438210 -------- 1465477 -------- 1490627 -------- 1517251 -------- 1544289 -------- 1573729 -------- 1607168 -------- 1635648 -------- 1658848 -------- 1691623 -------- 1718631 -------- 1753345 -------- 1782470 -------- 1812742 -------- 1837702 -------- 1873349 -------- 1905733 -------- 1941024 -------- 1977287 -------- 2005826 -------- 2035300 -------- 2067878 -------- 2093927 -------- 2127906 -------- 2154055 -------- 2181095 -------- 2212035 -------- 2242374 -------- 2263458 -------- 2288481 -------- 2315300 -------- 2340997 -------- 2371200 -------- 2399616 -------- 2429154 -------- 2455393 -------- 2488384 -------- 2521088 -------- 2550885 -------- 2581058 -------- 2610496 -------- 2644197 -------- 2675648 -------- 2698821 -------- 2726246 -------- 2757444 -------- 2792612 -------- 2827174 -------- 2846849 -------- 2881250 -------- 2900739 -------- 2930660 -------- 2962240 -------- 2999235 -------- 3031974 -------- 3060197 -------- 3087586 -------- 3120390 -------- 3147524 -------- 3170721 -------- 3199173 -------- 3230049 -------- 3255008 -------- 3284965 -------- 3315744 -------- 3345376 -------- 3379776 -------- 3405445 -------- 3436711 -------- 3467557 -------- 3489541 -------- 3518179 -------- 3546276 -------- 3568964 -------- 3596039 -------- 3621926 -------- 3644805 -------- 3675361 -------- 3706592 -------- 3735589 -------- 3761220 -------- 3789607 -------- 3820866 -------- 3862274 -------- 3898051 -------- 3925188 -------- 3957157 -------- 3983873 -------- 4013092 -------- 4039202 -------- 4070918 -------- 4105696 -------- 4136867 -------- 4169475 -------- 4205249 -------- 4239013 -------- 4264423 -------- 4292135 -------- 4324453 -------- 4356356 -------- 4392386 -------- 4423074 -------- 4447335 -------- 4469345 -------- 4496513 -------- 4530848 -------- 4565159 -------- 4596965 -------- 4627011 -------- 4662598 -------- 4690818 -------- 4718691 -------- 4749349 -------- 4782722 -------- 4824485 -------- 4856323 -------- 4885795 -------- 4911142 -------- 4945794 -------- 4972801 -------- 5000583 -------- 5033735 -------- 5072421 -------- 5112929 -------- 5145956 -------- 5181923 -------- 5217478 -------- 5247620 -------- 5273605 -------- 5304100 -------- 5343362 -------- 5375842 -------- 5408391 -------- 5439046 -------- 5464610 -------- 5497857 -------- 5528295 -------- 5557956 -------- 5593474 -------- 5626209 -------- 5660931 -------- 5703463 -------- 5733440 -------- 5762565 -------- 5788034 -------- 5813505 -------- 5848227 -------- 5870727 -------- 5908998 -------- 5938311 -------- 5968930 -------- 5999751 │ │ │ │ │ │ │ histogram(33)= 0 2.3017e+05 0 1.9693e+05 0 1.6119e+05 0 1.3036e+05 0 1.0268e+05 0 69069 0 35460 │ │ │ │ │ │ │ <------ 1 ---------- 2 ---------- 3 ---------- 4 ---------- 5 -------- 6 ----- 7 - │ │ │ │ │ │ │ histogram(40)= 0 0 24928 2400 27605 1800 27605 2400 28205 4800 28205 3000 28205 1800 25205 4200 28805 1800 28205 4200 27005 3600 28205 1800 26405 3600 27605 2400 28805 1200 24004 5401 27005 5401 28205 3600 28205 1200 28805 1800 27005 3600 27605 1800 27005 2400 27605 4200 26405 5401 28205 4200 27605 2400 28205 1800 26405 3000 27005 4200 28805 3000 6901.2 3450.6 @@ -259,8 +259,8 @@ column_names row_count distinct_count null_count ~~~~ column_names row_count_est row_count_err distinct_count_est distinct_count_err null_count_est null_count_err {ps_suppkey} 126.00 34.90 <== 125.00 35.47 <== 0.00 1.00 -{s_address} 126.00 34.90 <== 125.00 34.95 <== 0.00 1.00 -{s_name} 126.00 34.90 <== 125.00 34.98 <== 0.00 1.00 +{s_address} 126.00 34.90 <== 126.00 34.67 <== 0.00 1.00 +{s_name} 126.00 34.90 <== 126.00 34.71 <== 0.00 1.00 {s_nationkey} 126.00 34.90 <== 25.00 1.00 0.00 1.00 {s_suppkey} 126.00 34.90 <== 125.00 35.47 <== 0.00 1.00 @@ -328,9 +328,9 @@ column_names row_count distinct_count null_count column_names row_count_est row_count_err distinct_count_est distinct_count_err null_count_est null_count_err {l_partkey} 375.00 2425.21 <== 375.00 526.01 <== 0.00 1.00 {l_quantity} 375.00 2425.21 <== 50.00 1.00 0.00 1.00 -{l_shipdate} 375.00 2425.21 <== 234.00 1.56 0.00 1.00 +{l_shipdate} 375.00 2425.21 <== 365.00 1.00 0.00 1.00 {l_suppkey} 375.00 2425.21 <== 375.00 26.45 <== 0.00 1.00 -{ps_availqty} 375.00 2425.21 <== 368.00 26.96 <== 0.00 1.00 +{ps_availqty} 375.00 2425.21 <== 375.00 26.45 <== 0.00 1.00 {ps_partkey} 375.00 2425.21 <== 375.00 526.01 <== 0.00 1.00 {ps_suppkey} 375.00 2425.21 <== 375.00 26.45 <== 0.00 1.00 @@ -355,7 +355,7 @@ column_names row_count distinct_count null_count ~~~~ column_names row_count_est row_count_err distinct_count_est distinct_count_err null_count_est null_count_err {l_linenumber} 925860.00 1.02 7.00 1.00 0.00 1.00 -{l_orderkey} 925860.00 1.02 736656.00 2.77 <== 0.00 1.00 +{l_orderkey} 925860.00 1.02 925860.00 3.48 <== 0.00 1.00 {l_shipdate} 925860.00 1.02 365.00 1.00 0.00 1.00 ----Stats for q20_scan_14---- diff --git a/pkg/sql/opt/memo/testdata/stats_quality/tpch/q21 b/pkg/sql/opt/memo/testdata/stats_quality/tpch/q21 index f1ccc37ae3f6..677b27948447 100644 --- a/pkg/sql/opt/memo/testdata/stats_quality/tpch/q21 +++ b/pkg/sql/opt/memo/testdata/stats_quality/tpch/q21 @@ -69,7 +69,7 @@ limit ├── sort │ ├── save-table-name: q21_sort_2 │ ├── columns: s_name:2(char!null) count_rows:75(int!null) - │ ├── stats: [rows=8389.30056, distinct(2)=8389.30056, null(2)=0, distinct(75)=8389.30056, null(75)=0] + │ ├── stats: [rows=9990, distinct(2)=9990, null(2)=0, distinct(75)=9990, null(75)=0] │ ├── key: (2) │ ├── fd: (2)-->(75) │ ├── ordering: -75,+2 @@ -78,7 +78,7 @@ limit │ ├── save-table-name: q21_group_by_3 │ ├── columns: s_name:2(char!null) count_rows:75(int!null) │ ├── grouping columns: s_name:2(char!null) - │ ├── stats: [rows=8389.30056, distinct(2)=8389.30056, null(2)=0, distinct(75)=8389.30056, null(75)=0] + │ ├── stats: [rows=9990, distinct(2)=9990, null(2)=0, distinct(75)=9990, null(75)=0] │ ├── key: (2) │ ├── fd: (2)-->(75) │ ├── inner-join (lookup orders) @@ -86,32 +86,32 @@ limit │ │ ├── columns: s_suppkey:1(int!null) s_name:2(char!null) s_nationkey:4(int!null) l1.l_orderkey:9(int!null) l1.l_suppkey:11(int!null) l1.l_commitdate:20(date!null) l1.l_receiptdate:21(date!null) o_orderkey:26(int!null) o_orderstatus:28(char!null) n_nationkey:36(int!null) n_name:37(char!null) │ │ ├── key columns: [9] = [26] │ │ ├── lookup columns are key - │ │ ├── stats: [rows=17924.776, distinct(1)=8350.92287, null(1)=0, distinct(2)=8389.30056, null(2)=0, distinct(4)=1, null(4)=0, distinct(9)=17713.0676, null(9)=0, distinct(11)=8350.92287, null(11)=0, distinct(20)=2464.51974, null(20)=0, distinct(21)=2552.02044, null(21)=0, distinct(26)=17713.0676, null(26)=0, distinct(28)=1, null(28)=0, distinct(36)=1, null(36)=0, distinct(37)=1, null(37)=0] + │ │ ├── stats: [rows=17924.776, distinct(1)=0.000200040517, null(1)=0, distinct(2)=9990, null(2)=0, distinct(4)=1, null(4)=0, distinct(9)=0.000200040638, null(9)=0, distinct(11)=0.000200040517, null(11)=0, distinct(20)=0.00020004051, null(20)=0, distinct(21)=0.00020004051, null(21)=0, distinct(26)=0.000200040638, null(26)=0, distinct(28)=1, null(28)=0, distinct(36)=1, null(36)=0, distinct(37)=1, null(37)=0] │ │ ├── fd: ()-->(28,37), (1)-->(2,4), (9)==(26), (26)==(9), (1)==(11), (11)==(1), (4)==(36), (36)==(4) │ │ ├── anti-join (lookup lineitem [as=l3]) │ │ │ ├── save-table-name: q21_lookup_join_5 │ │ │ ├── columns: s_suppkey:1(int!null) s_name:2(char!null) s_nationkey:4(int!null) l1.l_orderkey:9(int!null) l1.l_suppkey:11(int!null) l1.l_commitdate:20(date!null) l1.l_receiptdate:21(date!null) n_nationkey:36(int!null) n_name:37(char!null) │ │ │ ├── key columns: [9] = [58] - │ │ │ ├── stats: [rows=17924.776, distinct(1)=399.934613, null(1)=0, distinct(2)=399.991883, null(2)=0, distinct(4)=1, null(4)=0, distinct(9)=17924.776, null(9)=0, distinct(11)=399.934613, null(11)=0, distinct(20)=2465.98023, null(20)=0, distinct(21)=2553.96876, null(21)=0, distinct(36)=1, null(36)=0, distinct(37)=1, null(37)=0] + │ │ │ ├── stats: [rows=17924.776, distinct(1)=2.68871662e-06, null(1)=0, distinct(2)=2.68871662e-06, null(2)=0, distinct(4)=2.68871303e-06, null(4)=0, distinct(9)=2.68871736e-06, null(9)=0, distinct(11)=2.68871662e-06, null(11)=0, distinct(20)=2.68871645e-06, null(20)=0, distinct(21)=2.68871645e-06, null(21)=0, distinct(36)=2.68871303e-06, null(36)=0, distinct(37)=2.68871303e-06, null(37)=0] │ │ │ ├── fd: ()-->(37), (1)-->(2,4), (4)==(36), (36)==(4), (1)==(11), (11)==(1) │ │ │ ├── semi-join (lookup lineitem [as=l2]) │ │ │ │ ├── save-table-name: q21_lookup_join_6 │ │ │ │ ├── columns: s_suppkey:1(int!null) s_name:2(char!null) s_nationkey:4(int!null) l1.l_orderkey:9(int!null) l1.l_suppkey:11(int!null) l1.l_commitdate:20(date!null) l1.l_receiptdate:21(date!null) n_nationkey:36(int!null) n_name:37(char!null) │ │ │ │ ├── key columns: [9] = [41] - │ │ │ │ ├── stats: [rows=26887.164, distinct(1)=399.934613, null(1)=0, distinct(2)=399.991883, null(2)=0, distinct(4)=1, null(4)=0, distinct(9)=26887.164, null(9)=0, distinct(11)=399.934613, null(11)=0, distinct(20)=2465.99571, null(20)=0, distinct(21)=2553.99299, null(21)=0, distinct(36)=1, null(36)=0, distinct(37)=1, null(37)=0] + │ │ │ │ ├── stats: [rows=26887.164, distinct(1)=400, null(1)=0, distinct(2)=400, null(2)=0, distinct(4)=1, null(4)=0, distinct(9)=26887.164, null(9)=0, distinct(11)=400, null(11)=0, distinct(20)=2466, null(20)=0, distinct(21)=2554, null(21)=0, distinct(36)=1, null(36)=0, distinct(37)=1, null(37)=0] │ │ │ │ ├── fd: ()-->(37), (1)-->(2,4), (4)==(36), (36)==(4), (1)==(11), (11)==(1) │ │ │ │ ├── inner-join (lookup lineitem [as=l1]) │ │ │ │ │ ├── save-table-name: q21_lookup_join_7 │ │ │ │ │ ├── columns: s_suppkey:1(int!null) s_name:2(char!null) s_nationkey:4(int!null) l1.l_orderkey:9(int!null) l1.l_suppkey:11(int!null) l1.l_commitdate:20(date!null) l1.l_receiptdate:21(date!null) n_nationkey:36(int!null) n_name:37(char!null) │ │ │ │ │ ├── key columns: [9 12] = [9 12] │ │ │ │ │ ├── lookup columns are key - │ │ │ │ │ ├── stats: [rows=80661.4919, distinct(1)=399.934613, null(1)=0, distinct(2)=399.991883, null(2)=0, distinct(4)=1, null(4)=0, distinct(9)=78049.9358, null(9)=0, distinct(11)=399.934613, null(11)=0, distinct(20)=2466, null(20)=0, distinct(21)=2554, null(21)=0, distinct(36)=1, null(36)=0, distinct(37)=1, null(37)=0] + │ │ │ │ │ ├── stats: [rows=80661.4919, distinct(1)=400, null(1)=0, distinct(2)=400, null(2)=0, distinct(4)=1, null(4)=0, distinct(9)=80661.4919, null(9)=0, distinct(11)=400, null(11)=0, distinct(20)=2466, null(20)=0, distinct(21)=2554, null(21)=0, distinct(36)=1, null(36)=0, distinct(37)=1, null(37)=0] │ │ │ │ │ ├── fd: ()-->(37), (1)-->(2,4), (4)==(36), (36)==(4), (1)==(11), (11)==(1) │ │ │ │ │ ├── inner-join (lookup lineitem@l_sk [as=l1]) │ │ │ │ │ │ ├── save-table-name: q21_lookup_join_8 │ │ │ │ │ │ ├── columns: s_suppkey:1(int!null) s_name:2(char!null) s_nationkey:4(int!null) l1.l_orderkey:9(int!null) l1.l_suppkey:11(int!null) l1.l_linenumber:12(int!null) n_nationkey:36(int!null) n_name:37(char!null) │ │ │ │ │ │ ├── key columns: [1] = [11] - │ │ │ │ │ │ ├── stats: [rows=241984.476, distinct(1)=399.934613, null(1)=0, distinct(2)=399.991883, null(2)=0, distinct(4)=1, null(4)=0, distinct(9)=223798.171, null(9)=0, distinct(11)=399.934613, null(11)=0, distinct(12)=7, null(12)=0, distinct(36)=1, null(36)=0, distinct(37)=1, null(37)=0] + │ │ │ │ │ │ ├── stats: [rows=241984.476, distinct(1)=400, null(1)=0, distinct(2)=400, null(2)=0, distinct(4)=1, null(4)=0, distinct(9)=241984.476, null(9)=0, distinct(11)=400, null(11)=0, distinct(12)=7, null(12)=0, distinct(36)=1, null(36)=0, distinct(37)=1, null(37)=0] │ │ │ │ │ │ ├── key: (9,12) │ │ │ │ │ │ ├── fd: ()-->(37), (1)-->(2,4), (4)==(36), (36)==(4), (9,12)-->(11), (1)==(11), (11)==(1) │ │ │ │ │ │ ├── inner-join (lookup supplier) @@ -119,14 +119,14 @@ limit │ │ │ │ │ │ │ ├── columns: s_suppkey:1(int!null) s_name:2(char!null) s_nationkey:4(int!null) n_nationkey:36(int!null) n_name:37(char!null) │ │ │ │ │ │ │ ├── key columns: [1] = [1] │ │ │ │ │ │ │ ├── lookup columns are key - │ │ │ │ │ │ │ ├── stats: [rows=400, distinct(1)=399.934613, null(1)=0, distinct(2)=399.991883, null(2)=0, distinct(4)=1, null(4)=0, distinct(36)=1, null(36)=0, distinct(37)=1, null(37)=0] + │ │ │ │ │ │ │ ├── stats: [rows=400, distinct(1)=400, null(1)=0, distinct(2)=400, null(2)=0, distinct(4)=1, null(4)=0, distinct(36)=1, null(36)=0, distinct(37)=1, null(37)=0] │ │ │ │ │ │ │ ├── key: (1) │ │ │ │ │ │ │ ├── fd: ()-->(37), (1)-->(2,4), (4)==(36), (36)==(4) │ │ │ │ │ │ │ ├── inner-join (lookup supplier@s_nk) │ │ │ │ │ │ │ │ ├── save-table-name: q21_lookup_join_10 │ │ │ │ │ │ │ │ ├── columns: s_suppkey:1(int!null) s_nationkey:4(int!null) n_nationkey:36(int!null) n_name:37(char!null) │ │ │ │ │ │ │ │ ├── key columns: [36] = [4] - │ │ │ │ │ │ │ │ ├── stats: [rows=400, distinct(1)=399.934613, null(1)=0, distinct(4)=1, null(4)=0, distinct(36)=1, null(36)=0, distinct(37)=1, null(37)=0] + │ │ │ │ │ │ │ │ ├── stats: [rows=400, distinct(1)=400, null(1)=0, distinct(4)=1, null(4)=0, distinct(36)=1, null(36)=0, distinct(37)=1, null(37)=0] │ │ │ │ │ │ │ │ ├── key: (1) │ │ │ │ │ │ │ │ ├── fd: ()-->(37), (1)-->(4), (4)==(36), (36)==(4) │ │ │ │ │ │ │ │ ├── select @@ -180,8 +180,8 @@ column_names row_count distinct_count null_count {s_name} 100 100 0 ~~~~ column_names row_count_est row_count_err distinct_count_est distinct_count_err null_count_est null_count_err -{count_rows} 8389.00 83.89 <== 8389.00 1048.62 <== 0.00 1.00 -{s_name} 8389.00 83.89 <== 8389.00 83.89 <== 0.00 1.00 +{count_rows} 9990.00 99.90 <== 9990.00 1248.75 <== 0.00 1.00 +{s_name} 9990.00 99.90 <== 9990.00 99.90 <== 0.00 1.00 ----Stats for q21_group_by_3---- column_names row_count distinct_count null_count @@ -189,8 +189,8 @@ column_names row_count distinct_count null_count {s_name} 411 411 0 ~~~~ column_names row_count_est row_count_err distinct_count_est distinct_count_err null_count_est null_count_err -{count_rows} 8389.00 20.41 <== 8389.00 493.47 <== 0.00 1.00 -{s_name} 8389.00 20.41 <== 8389.00 20.41 <== 0.00 1.00 +{count_rows} 9990.00 24.31 <== 9990.00 587.65 <== 0.00 1.00 +{s_name} 9990.00 24.31 <== 9990.00 24.31 <== 0.00 1.00 ----Stats for q21_lookup_join_4---- column_names row_count distinct_count null_count @@ -207,17 +207,17 @@ column_names row_count distinct_count null_count {s_suppkey} 4141 411 0 ~~~~ column_names row_count_est row_count_err distinct_count_est distinct_count_err null_count_est null_count_err -{l_commitdate} 17925.00 4.33 <== 2465.00 2.07 <== 0.00 1.00 -{l_orderkey} 17925.00 4.33 <== 17713.00 4.29 <== 0.00 1.00 -{l_receiptdate} 17925.00 4.33 <== 2552.00 2.17 <== 0.00 1.00 -{l_suppkey} 17925.00 4.33 <== 8351.00 20.32 <== 0.00 1.00 +{l_commitdate} 17925.00 4.33 <== 0.00 +Inf <== 0.00 1.00 +{l_orderkey} 17925.00 4.33 <== 0.00 +Inf <== 0.00 1.00 +{l_receiptdate} 17925.00 4.33 <== 0.00 +Inf <== 0.00 1.00 +{l_suppkey} 17925.00 4.33 <== 0.00 +Inf <== 0.00 1.00 {n_name} 17925.00 4.33 <== 1.00 1.00 0.00 1.00 {n_nationkey} 17925.00 4.33 <== 1.00 1.00 0.00 1.00 -{o_orderkey} 17925.00 4.33 <== 17713.00 4.29 <== 0.00 1.00 +{o_orderkey} 17925.00 4.33 <== 0.00 +Inf <== 0.00 1.00 {o_orderstatus} 17925.00 4.33 <== 1.00 1.00 0.00 1.00 -{s_name} 17925.00 4.33 <== 8389.00 20.41 <== 0.00 1.00 +{s_name} 17925.00 4.33 <== 9990.00 24.31 <== 0.00 1.00 {s_nationkey} 17925.00 4.33 <== 1.00 1.00 0.00 1.00 -{s_suppkey} 17925.00 4.33 <== 8351.00 20.32 <== 0.00 1.00 +{s_suppkey} 17925.00 4.33 <== 0.00 +Inf <== 0.00 1.00 ----Stats for q21_lookup_join_5---- column_names row_count distinct_count null_count @@ -232,15 +232,15 @@ column_names row_count distinct_count null_count {s_suppkey} 8357 411 0 ~~~~ column_names row_count_est row_count_err distinct_count_est distinct_count_err null_count_est null_count_err -{l_commitdate} 17925.00 2.14 <== 2466.00 1.05 0.00 1.00 -{l_orderkey} 17925.00 2.14 <== 17925.00 2.15 <== 0.00 1.00 -{l_receiptdate} 17925.00 2.14 <== 2554.00 1.07 0.00 1.00 -{l_suppkey} 17925.00 2.14 <== 400.00 1.03 0.00 1.00 -{n_name} 17925.00 2.14 <== 1.00 1.00 0.00 1.00 -{n_nationkey} 17925.00 2.14 <== 1.00 1.00 0.00 1.00 -{s_name} 17925.00 2.14 <== 400.00 1.03 0.00 1.00 -{s_nationkey} 17925.00 2.14 <== 1.00 1.00 0.00 1.00 -{s_suppkey} 17925.00 2.14 <== 400.00 1.03 0.00 1.00 +{l_commitdate} 17925.00 2.14 <== 0.00 +Inf <== 0.00 1.00 +{l_orderkey} 17925.00 2.14 <== 0.00 +Inf <== 0.00 1.00 +{l_receiptdate} 17925.00 2.14 <== 0.00 +Inf <== 0.00 1.00 +{l_suppkey} 17925.00 2.14 <== 0.00 +Inf <== 0.00 1.00 +{n_name} 17925.00 2.14 <== 0.00 +Inf <== 0.00 1.00 +{n_nationkey} 17925.00 2.14 <== 0.00 +Inf <== 0.00 1.00 +{s_name} 17925.00 2.14 <== 0.00 +Inf <== 0.00 1.00 +{s_nationkey} 17925.00 2.14 <== 0.00 +Inf <== 0.00 1.00 +{s_suppkey} 17925.00 2.14 <== 0.00 +Inf <== 0.00 1.00 ----Stats for q21_lookup_join_6---- column_names row_count distinct_count null_count @@ -279,7 +279,7 @@ column_names row_count distinct_count null_count ~~~~ column_names row_count_est row_count_err distinct_count_est distinct_count_err null_count_est null_count_err {l_commitdate} 80661.00 1.94 <== 2466.00 1.00 0.00 1.00 -{l_orderkey} 80661.00 1.94 <== 78050.00 1.92 <== 0.00 1.00 +{l_orderkey} 80661.00 1.94 <== 80661.00 1.86 0.00 1.00 {l_receiptdate} 80661.00 1.94 <== 2554.00 1.02 0.00 1.00 {l_suppkey} 80661.00 1.94 <== 400.00 1.03 0.00 1.00 {n_name} 80661.00 1.94 <== 1.00 1.00 0.00 1.00 @@ -301,7 +301,7 @@ column_names row_count distinct_count null_count ~~~~ column_names row_count_est row_count_err distinct_count_est distinct_count_err null_count_est null_count_err {l_linenumber} 241984.00 1.02 7.00 1.00 0.00 1.00 -{l_orderkey} 241984.00 1.02 223798.00 1.02 0.00 1.00 +{l_orderkey} 241984.00 1.02 241984.00 1.06 0.00 1.00 {l_suppkey} 241984.00 1.02 400.00 1.03 0.00 1.00 {n_name} 241984.00 1.02 1.00 1.00 0.00 1.00 {n_nationkey} 241984.00 1.02 1.00 1.00 0.00 1.00 diff --git a/pkg/sql/opt/props/histogram.go b/pkg/sql/opt/props/histogram.go index fcf6e8b2af0d..97cdc1b737a7 100644 --- a/pkg/sql/opt/props/histogram.go +++ b/pkg/sql/opt/props/histogram.go @@ -427,7 +427,7 @@ func (h *Histogram) addBucket(bucket *cat.HistogramBucket, desc bool) { // ApplySelectivity reduces the size of each histogram bucket according to // the given selectivity, and returns a new histogram with the results. -func (h *Histogram) ApplySelectivity(selectivity float64) *Histogram { +func (h *Histogram) ApplySelectivity(selectivity Selectivity) *Histogram { res := h.copy() for i := range res.buckets { b := &res.buckets[i] @@ -436,8 +436,8 @@ func (h *Histogram) ApplySelectivity(selectivity float64) *Histogram { n := b.NumRange d := b.DistinctRange - b.NumEq *= selectivity - b.NumRange *= selectivity + b.NumEq *= float64(selectivity) + b.NumRange *= float64(selectivity) if d == 0 { continue @@ -449,7 +449,7 @@ func (h *Histogram) ApplySelectivity(selectivity float64) *Histogram { // // This formula returns d * selectivity when d=n but is closer to d // when d << n. - b.DistinctRange = d - d*math.Pow(1-selectivity, n/d) + b.DistinctRange = d - d*math.Pow(float64(1-selectivity), n/d) } return res } diff --git a/pkg/sql/opt/props/selectivity.go b/pkg/sql/opt/props/selectivity.go new file mode 100644 index 000000000000..fed53ef570bf --- /dev/null +++ b/pkg/sql/opt/props/selectivity.go @@ -0,0 +1,43 @@ +package props + +// epsilon is the minimum value Selectivity can hold, since it cannot be 0. +const epsilon = 1e-10 + +// Selectivity stores selectivity as a float64, while having custom methods for +// performing operations and checking that the value is within the range of +// [epsilon, 1.0]. +type Selectivity float64 + +// MakeSelectivity initializes and validates a float64 to ensure it is in a +// valid range. This method is used for selectivity calculations involving +// other non-selectivity values. +func MakeSelectivity(sel float64) Selectivity { + return Selectivity(sel).SelectivityInRange() +} + +// Multiply is a custom method for multiplying two selectivities and returns +// the product in the valid range. +func (s Selectivity) Multiply(other Selectivity) Selectivity { + s *= other + return s.SelectivityInRange() +} + +// Add is a custom method for adding two selectivities and returns the sum in +// the valid range. +func (s Selectivity) Add(other Selectivity) Selectivity { + s += other + return s.SelectivityInRange() +} + +// SelectivityInRange performs the range check, if the selectivity falls +// outside of the range, this method will return the appropriate min/max value. +func (s Selectivity) SelectivityInRange() Selectivity { + switch { + case s < epsilon: + return epsilon + case s > 1.0: + return 1.0 + default: + return s + } +} diff --git a/pkg/sql/opt/props/statistics.go b/pkg/sql/opt/props/statistics.go index 5fe4129d7d8c..ab4ecd144d7b 100644 --- a/pkg/sql/opt/props/statistics.go +++ b/pkg/sql/opt/props/statistics.go @@ -63,7 +63,7 @@ type Statistics struct { // Selectivity is a value between 0 and 1 representing the estimated // reduction in number of rows for the top-level operator in this // expression. - Selectivity float64 + Selectivity Selectivity } // Init initializes the data members of Statistics. @@ -94,9 +94,9 @@ func (s *Statistics) CopyFrom(other *Statistics) { // Histograms are not updated. // See ColumnStatistic.ApplySelectivity for updating distinct counts, null // counts, and histograms. -func (s *Statistics) ApplySelectivity(selectivity float64) { - s.RowCount *= selectivity - s.Selectivity *= selectivity +func (s *Statistics) ApplySelectivity(selectivity Selectivity) { + s.RowCount *= float64(selectivity) + s.Selectivity.Multiply(selectivity) } // UnionWith unions this Statistics object with another Statistics object. It @@ -106,7 +106,7 @@ func (s *Statistics) ApplySelectivity(selectivity float64) { func (s *Statistics) UnionWith(other *Statistics) { s.Available = s.Available && other.Available s.RowCount += other.RowCount - s.Selectivity += other.Selectivity + s.Selectivity = s.Selectivity.Add(other.Selectivity) } func (s *Statistics) String() string { @@ -170,10 +170,10 @@ type ColumnStatistic struct { // ApplySelectivity updates the distinct count, null count, and histogram // according to a given selectivity. -func (c *ColumnStatistic) ApplySelectivity(selectivity, inputRows float64) { +func (c *ColumnStatistic) ApplySelectivity(selectivity Selectivity, inputRows float64) { // Since the null count is a simple count of all null rows, we can // just multiply the selectivity with it. - c.NullCount *= selectivity + c.NullCount *= float64(selectivity) if c.Histogram != nil { c.Histogram = c.Histogram.ApplySelectivity(selectivity) @@ -197,7 +197,7 @@ func (c *ColumnStatistic) ApplySelectivity(selectivity, inputRows float64) { // // This formula returns d * selectivity when d=n but is closer to d // when d << n. - c.DistinctCount = d - d*math.Pow(1-selectivity, n/d) + c.DistinctCount = d - d*math.Pow(float64(1-selectivity), n/d) const epsilon = 1e-10 if c.DistinctCount < epsilon { // Avoid setting the distinct count to 0 (since the row count is diff --git a/pkg/sql/opt/xform/testdata/coster/join b/pkg/sql/opt/xform/testdata/coster/join index 36e2626c45ea..c88d1463822a 100644 --- a/pkg/sql/opt/xform/testdata/coster/join +++ b/pkg/sql/opt/xform/testdata/coster/join @@ -139,7 +139,7 @@ inner-join (lookup g [as=g2]) │ ├── flags: force inverted join (into right side) │ ├── inverted-expr │ │ └── st_contains(g1.geom:2, g2.geom:6) - │ ├── stats: [rows=10000, distinct(1)=999.956829, null(1)=0, distinct(5)=999.956829, null(5)=0] + │ ├── stats: [rows=10000, distinct(1)=1000, null(1)=0, distinct(5)=1000, null(5)=0] │ ├── cost: 41444.03 │ ├── key: (1,5) │ ├── fd: (1)-->(2) @@ -354,7 +354,7 @@ limit │ ├── columns: t.id:1!null sender_id:2!null receiver_id:3!null amount:4!null t.creation_date:5!null last_update:6 schedule_date:7 status:8 comment:9 linked_trans_id:10 c1:11 c2:12 c3:13 s.id:15!null s.name:16!null s.gender:17 s.email:18 s.first_name:19 s.last_name:20 s.creation_date:21!null s.situation:22 s.balance:23!null s.is_blocked:24 r.id:26!null r.name:27!null r.gender:28 r.email:29 r.first_name:30 r.last_name:31 r.creation_date:32!null r.situation:33 r.balance:34!null r.is_blocked:35 │ ├── key columns: [3] = [26] │ ├── lookup columns are key - │ ├── stats: [rows=980.1, distinct(3)=98.9950071, null(3)=0, distinct(26)=98.9950071, null(26)=0] + │ ├── stats: [rows=980.1, distinct(3)=99, null(3)=0, distinct(26)=99, null(26)=0] │ ├── cost: 2364.41 │ ├── key: (1) │ ├── fd: (1)-->(2-13), (15)-->(16-24), (2)==(15), (15)==(2), (26)-->(27-35), (3)==(26), (26)==(3) @@ -363,7 +363,7 @@ limit │ │ ├── columns: t.id:1!null sender_id:2!null receiver_id:3 amount:4!null t.creation_date:5!null last_update:6 schedule_date:7 status:8 comment:9 linked_trans_id:10 c1:11 c2:12 c3:13 s.id:15!null s.name:16!null s.gender:17 s.email:18 s.first_name:19 s.last_name:20 s.creation_date:21!null s.situation:22 s.balance:23!null s.is_blocked:24 │ │ ├── key columns: [2] = [15] │ │ ├── lookup columns are key - │ │ ├── stats: [rows=990, distinct(1)=628.605476, null(1)=0, distinct(2)=99, null(2)=0, distinct(3)=99.9950071, null(3)=9.9, distinct(4)=99.9950071, null(4)=0, distinct(5)=99.9950071, null(5)=0, distinct(15)=99, null(15)=0, distinct(16)=99.9950071, null(16)=0, distinct(21)=99.9950071, null(21)=0, distinct(23)=99.9950071, null(23)=0] + │ │ ├── stats: [rows=990, distinct(1)=990, null(1)=0, distinct(2)=99, null(2)=0, distinct(3)=100, null(3)=9.9, distinct(4)=100, null(4)=0, distinct(5)=100, null(5)=0, distinct(15)=99, null(15)=0, distinct(16)=100, null(16)=0, distinct(21)=100, null(21)=0, distinct(23)=100, null(23)=0] │ │ ├── cost: 1745.61 │ │ ├── key: (1) │ │ ├── fd: (1)-->(2-13), (15)-->(16-24), (2)==(15), (15)==(2) @@ -601,18 +601,18 @@ WHERE w = 'foo' AND x = '2AB23800-06B1-4E19-A3BB-DF3768B808D2' AND (i,j,k,l,m,n) ---- project ├── columns: w:1!null x:2!null y:3!null z:4!null - ├── stats: [rows=4.50439883] + ├── stats: [rows=4.50439933] ├── cost: 12231.6 ├── fd: ()-->(1,2) └── inner-join (lookup abcde@idx_abcd) ├── columns: w:1!null x:2!null y:3!null z:4!null i:5!null j:6!null k:7!null l:8!null m:9!null n:10!null a:13!null b:14!null c:15!null ├── key columns: [1 2 3] = [13 14 15] - ├── stats: [rows=4.50439883, distinct(1)=0.9, null(1)=0, distinct(2)=0.9, null(2)=0, distinct(3)=0.884031733, null(3)=0, distinct(13)=0.9, null(13)=0, distinct(14)=0.9, null(14)=0, distinct(15)=0.884031733, null(15)=0] + ├── stats: [rows=4.50439933, distinct(1)=0.9000001, null(1)=0, distinct(2)=0.9000001, null(2)=0, distinct(3)=0.88403183, null(3)=0, distinct(13)=0.9000001, null(13)=0, distinct(14)=0.9000001, null(14)=0, distinct(15)=0.88403183, null(15)=0] ├── cost: 12231.545 ├── fd: ()-->(1,2,5-10,13,14), (1)==(13), (13)==(1), (2)==(14), (14)==(2), (3)==(15), (15)==(3) ├── select │ ├── columns: w:1!null x:2!null y:3!null z:4!null i:5!null j:6!null k:7!null l:8!null m:9!null n:10!null - │ ├── stats: [rows=0.9, distinct(1)=0.9, null(1)=0, distinct(2)=0.9, null(2)=0, distinct(3)=0.884031733, null(3)=0, distinct(4)=0.899635587, null(4)=0, distinct(5)=0.9, null(5)=0, distinct(6)=0.9, null(6)=0, distinct(7)=0.9, null(7)=0, distinct(8)=0.9, null(8)=0, distinct(9)=0.9, null(9)=0, distinct(10)=0.9, null(10)=0, distinct(5-10)=0.9, null(5-10)=0] + │ ├── stats: [rows=0.9000001, distinct(1)=0.9000001, null(1)=0, distinct(2)=0.9000001, null(2)=0, distinct(3)=0.88403183, null(3)=0, distinct(4)=0.899635687, null(4)=0, distinct(5)=0.9000001, null(5)=0, distinct(6)=0.9000001, null(6)=0, distinct(7)=0.9000001, null(7)=0, distinct(8)=0.9000001, null(8)=0, distinct(9)=0.9000001, null(9)=0, distinct(10)=0.9000001, null(10)=0, distinct(5-10)=0.9000001, null(5-10)=0] │ ├── cost: 12204.11 │ ├── fd: ()-->(1,2,5-10) │ ├── scan wxyzijklmn diff --git a/pkg/sql/opt/xform/testdata/external/customer b/pkg/sql/opt/xform/testdata/external/customer index eed5c86b9a4a..14114571ef15 100644 --- a/pkg/sql/opt/xform/testdata/external/customer +++ b/pkg/sql/opt/xform/testdata/external/customer @@ -111,7 +111,7 @@ project │ │ ├── key: (1) │ │ ├── fd: (1)-->(2,3,9) │ │ ├── ordering: +1 opt(9) [actual: +1] - │ │ └── limit hint: 101.01 + │ │ └── limit hint: 103.09 │ └── filters │ └── NOT read:9 [outer=(9), constraints=(/9: [/false - /false]; tight), fd=()-->(9)] └── 50 @@ -154,7 +154,7 @@ project │ │ ├── key: (1) │ │ ├── fd: (1)-->(2,3,9) │ │ ├── ordering: +1 opt(9) [actual: +1] - │ │ └── limit hint: 101.01 + │ │ └── limit hint: 103.09 │ └── filters │ └── NOT read:9 [outer=(9), constraints=(/9: [/false - /false]; tight), fd=()-->(9)] └── 50 diff --git a/pkg/sql/opt/xform/testdata/external/hibernate b/pkg/sql/opt/xform/testdata/external/hibernate index 07bfb0f8253c..0e1f67816fb3 100644 --- a/pkg/sql/opt/xform/testdata/external/hibernate +++ b/pkg/sql/opt/xform/testdata/external/hibernate @@ -665,41 +665,40 @@ distinct-on ├── grouping columns: person2_.id:12!null ├── key: (12) ├── fd: (12)-->(13-17) - ├── inner-join (hash) + ├── anti-join (hash) │ ├── columns: phone0_.id:1!null person_id:4!null calls1_.phone_id:10!null person2_.id:12!null address:13 createdon:14 name:15 nickname:16 version:17!null - │ ├── multiplicity: left-rows(zero-or-one), right-rows(zero-or-more) │ ├── fd: (1)-->(4), (1)==(10), (10)==(1), (12)-->(13-17), (4)==(12), (12)==(4) - │ ├── scan phone_call [as=calls1_] - │ │ └── columns: calls1_.phone_id:10 │ ├── inner-join (hash) - │ │ ├── columns: phone0_.id:1!null person_id:4!null person2_.id:12!null address:13 createdon:14 name:15 nickname:16 version:17!null - │ │ ├── multiplicity: left-rows(zero-or-more), right-rows(zero-or-one) - │ │ ├── key: (1) - │ │ ├── fd: (1)-->(4), (12)-->(13-17), (4)==(12), (12)==(4) - │ │ ├── scan person [as=person2_] - │ │ │ ├── columns: person2_.id:12!null address:13 createdon:14 name:15 nickname:16 version:17!null - │ │ │ ├── key: (12) - │ │ │ └── fd: (12)-->(13-17) - │ │ ├── anti-join (hash) - │ │ │ ├── columns: phone0_.id:1!null person_id:4 + │ │ ├── columns: phone0_.id:1!null person_id:4!null calls1_.phone_id:10!null person2_.id:12!null address:13 createdon:14 name:15 nickname:16 version:17!null + │ │ ├── multiplicity: left-rows(zero-or-one), right-rows(zero-or-more) + │ │ ├── fd: (1)-->(4), (12)-->(13-17), (4)==(12), (12)==(4), (1)==(10), (10)==(1) + │ │ ├── scan phone_call [as=calls1_] + │ │ │ └── columns: calls1_.phone_id:10 + │ │ ├── inner-join (hash) + │ │ │ ├── columns: phone0_.id:1!null person_id:4!null person2_.id:12!null address:13 createdon:14 name:15 nickname:16 version:17!null + │ │ │ ├── multiplicity: left-rows(zero-or-one), right-rows(zero-or-more) │ │ │ ├── key: (1) - │ │ │ ├── fd: (1)-->(4) + │ │ │ ├── fd: (1)-->(4), (12)-->(13-17), (4)==(12), (12)==(4) │ │ │ ├── scan phone [as=phone0_] │ │ │ │ ├── columns: phone0_.id:1!null person_id:4 │ │ │ │ ├── key: (1) │ │ │ │ └── fd: (1)-->(4) - │ │ │ ├── select - │ │ │ │ ├── columns: call3_.duration:20!null call3_.phone_id:22 - │ │ │ │ ├── scan phone_call [as=call3_] - │ │ │ │ │ └── columns: call3_.duration:20!null call3_.phone_id:22 - │ │ │ │ └── filters - │ │ │ │ └── (call3_.duration:20 >= 50) IS NOT false [outer=(20)] + │ │ │ ├── scan person [as=person2_] + │ │ │ │ ├── columns: person2_.id:12!null address:13 createdon:14 name:15 nickname:16 version:17!null + │ │ │ │ ├── key: (12) + │ │ │ │ └── fd: (12)-->(13-17) │ │ │ └── filters - │ │ │ └── call3_.phone_id:22 = phone0_.id:1 [outer=(1,22), constraints=(/1: (/NULL - ]; /22: (/NULL - ]), fd=(1)==(22), (22)==(1)] + │ │ │ └── person_id:4 = person2_.id:12 [outer=(4,12), constraints=(/4: (/NULL - ]; /12: (/NULL - ]), fd=(4)==(12), (12)==(4)] + │ │ └── filters + │ │ └── phone0_.id:1 = calls1_.phone_id:10 [outer=(1,10), constraints=(/1: (/NULL - ]; /10: (/NULL - ]), fd=(1)==(10), (10)==(1)] + │ ├── select + │ │ ├── columns: call3_.duration:20!null call3_.phone_id:22 + │ │ ├── scan phone_call [as=call3_] + │ │ │ └── columns: call3_.duration:20!null call3_.phone_id:22 │ │ └── filters - │ │ └── person_id:4 = person2_.id:12 [outer=(4,12), constraints=(/4: (/NULL - ]; /12: (/NULL - ]), fd=(4)==(12), (12)==(4)] + │ │ └── (call3_.duration:20 >= 50) IS NOT false [outer=(20)] │ └── filters - │ └── phone0_.id:1 = calls1_.phone_id:10 [outer=(1,10), constraints=(/1: (/NULL - ]; /10: (/NULL - ]), fd=(1)==(10), (10)==(1)] + │ └── call3_.phone_id:22 = phone0_.id:1 [outer=(1,22), constraints=(/1: (/NULL - ]; /22: (/NULL - ]), fd=(1)==(22), (22)==(1)] └── aggregations ├── const-agg [as=address:13, outer=(13)] │ └── address:13 diff --git a/pkg/sql/opt/xform/testdata/external/tpce-no-stats b/pkg/sql/opt/xform/testdata/external/tpce-no-stats index ec6d64ebde33..f1468e583de6 100644 --- a/pkg/sql/opt/xform/testdata/external/tpce-no-stats +++ b/pkg/sql/opt/xform/testdata/external/tpce-no-stats @@ -287,33 +287,31 @@ project ├── key: (17,21) ├── fd: ()-->(9), (1)-->(2,6,7), (17,19)-->(18), (21)-->(22), (19)==(21), (21)==(19), (1)==(17), (17)==(1) ├── ordering: -18 opt(9) [actual: -18] - ├── inner-join (lookup status_type) + ├── sort │ ├── columns: t_id:1!null t_dts:2!null t_s_symb:6!null t_qty:7!null t_ca_id:9!null th_t_id:17!null th_dts:18!null th_st_id:19!null st_id:21!null st_name:22!null - │ ├── key columns: [19] = [21] - │ ├── lookup columns are key │ ├── key: (17,21) │ ├── fd: ()-->(9), (1)-->(2,6,7), (17,19)-->(18), (21)-->(22), (19)==(21), (21)==(19), (1)==(17), (17)==(1) │ ├── ordering: -18 opt(9) [actual: -18] │ ├── limit hint: 30.00 - │ ├── sort - │ │ ├── columns: t_id:1!null t_dts:2!null t_s_symb:6!null t_qty:7!null t_ca_id:9!null th_t_id:17!null th_dts:18!null th_st_id:19!null - │ │ ├── key: (17,19) - │ │ ├── fd: ()-->(9), (1)-->(2,6,7), (17,19)-->(18), (1)==(17), (17)==(1) - │ │ ├── ordering: -18 opt(9) [actual: -18] - │ │ ├── limit hint: 100.00 - │ │ └── inner-join (lookup trade_history) - │ │ ├── columns: t_id:1!null t_dts:2!null t_s_symb:6!null t_qty:7!null t_ca_id:9!null th_t_id:17!null th_dts:18!null th_st_id:19!null - │ │ ├── key columns: [1] = [17] - │ │ ├── key: (17,19) - │ │ ├── fd: ()-->(9), (1)-->(2,6,7), (17,19)-->(18), (1)==(17), (17)==(1) - │ │ ├── scan trade@secondary - │ │ │ ├── columns: t_id:1!null t_dts:2!null t_s_symb:6!null t_qty:7!null t_ca_id:9!null - │ │ │ ├── constraint: /9/-2/1: [/0 - /0] - │ │ │ ├── limit: 10 - │ │ │ ├── key: (1) - │ │ │ └── fd: ()-->(9), (1)-->(2,6,7) - │ │ └── filters (true) - │ └── filters (true) + │ └── inner-join (lookup status_type) + │ ├── columns: t_id:1!null t_dts:2!null t_s_symb:6!null t_qty:7!null t_ca_id:9!null th_t_id:17!null th_dts:18!null th_st_id:19!null st_id:21!null st_name:22!null + │ ├── key columns: [19] = [21] + │ ├── lookup columns are key + │ ├── key: (17,21) + │ ├── fd: ()-->(9), (1)-->(2,6,7), (17,19)-->(18), (21)-->(22), (19)==(21), (21)==(19), (1)==(17), (17)==(1) + │ ├── inner-join (lookup trade_history) + │ │ ├── columns: t_id:1!null t_dts:2!null t_s_symb:6!null t_qty:7!null t_ca_id:9!null th_t_id:17!null th_dts:18!null th_st_id:19!null + │ │ ├── key columns: [1] = [17] + │ │ ├── key: (17,19) + │ │ ├── fd: ()-->(9), (1)-->(2,6,7), (17,19)-->(18), (1)==(17), (17)==(1) + │ │ ├── scan trade@secondary + │ │ │ ├── columns: t_id:1!null t_dts:2!null t_s_symb:6!null t_qty:7!null t_ca_id:9!null + │ │ │ ├── constraint: /9/-2/1: [/0 - /0] + │ │ │ ├── limit: 10 + │ │ │ ├── key: (1) + │ │ │ └── fd: ()-->(9), (1)-->(2,6,7) + │ │ └── filters (true) + │ └── filters (true) └── 30 # -------------------------------------------------- @@ -2982,29 +2980,29 @@ project ├── key: (1) ├── fd: (1)-->(2,6,7,10,18,21,28,43,50), (6)-->(28,43) ├── ordering: -2 - ├── inner-join (lookup exchange) + ├── inner-join (lookup status_type) │ ├── columns: t_id:1!null t_dts:2!null t_st_id:3!null t_tt_id:4!null t_s_symb:6!null t_qty:7!null t_ca_id:9!null t_exec_name:10!null trade.t_chrg:12!null st_id:17!null st_name:18!null tt_id:20!null tt_name:21!null s_symb:25!null s_name:28!null s_ex_id:29!null ex_id:42!null ex_name:43!null - │ ├── key columns: [29] = [42] + │ ├── key columns: [3] = [17] │ ├── lookup columns are key │ ├── cardinality: [0 - 50] │ ├── key: (1) │ ├── fd: ()-->(9), (1)-->(2-4,6,7,10,12), (17)-->(18), (3)==(17), (17)==(3), (20)-->(21), (4)==(20), (20)==(4), (25)-->(28,29), (42)-->(43), (29)==(42), (42)==(29), (6)==(25), (25)==(6) │ ├── ordering: -2 opt(9) [actual: -2] - │ ├── inner-join (lookup status_type) - │ │ ├── columns: t_id:1!null t_dts:2!null t_st_id:3!null t_tt_id:4!null t_s_symb:6!null t_qty:7!null t_ca_id:9!null t_exec_name:10!null trade.t_chrg:12!null st_id:17!null st_name:18!null tt_id:20!null tt_name:21!null s_symb:25!null s_name:28!null s_ex_id:29!null - │ │ ├── key columns: [3] = [17] + │ ├── inner-join (lookup trade_type) + │ │ ├── columns: t_id:1!null t_dts:2!null t_st_id:3!null t_tt_id:4!null t_s_symb:6!null t_qty:7!null t_ca_id:9!null t_exec_name:10!null trade.t_chrg:12!null tt_id:20!null tt_name:21!null s_symb:25!null s_name:28!null s_ex_id:29!null ex_id:42!null ex_name:43!null + │ │ ├── key columns: [4] = [20] │ │ ├── lookup columns are key │ │ ├── cardinality: [0 - 50] │ │ ├── key: (1) - │ │ ├── fd: ()-->(9), (17)-->(18), (20)-->(21), (1)-->(2-4,6,7,10,12), (25)-->(28,29), (6)==(25), (25)==(6), (4)==(20), (20)==(4), (3)==(17), (17)==(3) + │ │ ├── fd: ()-->(9), (20)-->(21), (1)-->(2-4,6,7,10,12), (25)-->(28,29), (42)-->(43), (29)==(42), (42)==(29), (6)==(25), (25)==(6), (4)==(20), (20)==(4) │ │ ├── ordering: -2 opt(9) [actual: -2] - │ │ ├── inner-join (lookup trade_type) - │ │ │ ├── columns: t_id:1!null t_dts:2!null t_st_id:3!null t_tt_id:4!null t_s_symb:6!null t_qty:7!null t_ca_id:9!null t_exec_name:10!null trade.t_chrg:12!null tt_id:20!null tt_name:21!null s_symb:25!null s_name:28!null s_ex_id:29!null - │ │ │ ├── key columns: [4] = [20] + │ │ ├── inner-join (lookup exchange) + │ │ │ ├── columns: t_id:1!null t_dts:2!null t_st_id:3!null t_tt_id:4!null t_s_symb:6!null t_qty:7!null t_ca_id:9!null t_exec_name:10!null trade.t_chrg:12!null s_symb:25!null s_name:28!null s_ex_id:29!null ex_id:42!null ex_name:43!null + │ │ │ ├── key columns: [29] = [42] │ │ │ ├── lookup columns are key │ │ │ ├── cardinality: [0 - 50] │ │ │ ├── key: (1) - │ │ │ ├── fd: ()-->(9), (20)-->(21), (1)-->(2-4,6,7,10,12), (25)-->(28,29), (6)==(25), (25)==(6), (4)==(20), (20)==(4) + │ │ │ ├── fd: ()-->(9), (1)-->(2-4,6,7,10,12), (25)-->(28,29), (42)-->(43), (29)==(42), (42)==(29), (6)==(25), (25)==(6) │ │ │ ├── ordering: -2 opt(9) [actual: -2] │ │ │ ├── inner-join (lookup security) │ │ │ │ ├── columns: t_id:1!null t_dts:2!null t_st_id:3!null t_tt_id:4!null t_s_symb:6!null t_qty:7!null t_ca_id:9!null t_exec_name:10!null trade.t_chrg:12!null s_symb:25!null s_name:28!null s_ex_id:29!null diff --git a/pkg/sql/opt/xform/testdata/external/tpch b/pkg/sql/opt/xform/testdata/external/tpch index 307e6fd0194c..c7e62ba42b34 100644 --- a/pkg/sql/opt/xform/testdata/external/tpch +++ b/pkg/sql/opt/xform/testdata/external/tpch @@ -695,32 +695,32 @@ sort │ ├── immutable │ ├── inner-join (hash) │ │ ├── columns: s_suppkey:1!null s_nationkey:4!null l_orderkey:9!null l_suppkey:11!null l_extendedprice:14!null l_discount:15!null l_shipdate:19!null o_orderkey:26!null o_custkey:27!null c_custkey:36!null c_nationkey:39!null n1.n_nationkey:45!null n1.n_name:46!null n2.n_nationkey:50!null n2.n_name:51!null - │ │ ├── multiplicity: left-rows(zero-or-more), right-rows(zero-or-one) + │ │ ├── multiplicity: left-rows(zero-or-one), right-rows(zero-or-more) │ │ ├── fd: (1)-->(4), (26)-->(27), (36)-->(39), (45)-->(46), (50)-->(51), (39)==(50), (50)==(39), (27)==(36), (36)==(27), (9)==(26), (26)==(9), (1)==(11), (11)==(1), (4)==(45), (45)==(4) - │ │ ├── scan customer@c_nk - │ │ │ ├── columns: c_custkey:36!null c_nationkey:39!null - │ │ │ ├── key: (36) - │ │ │ └── fd: (36)-->(39) - │ │ ├── inner-join (lookup orders) - │ │ │ ├── columns: s_suppkey:1!null s_nationkey:4!null l_orderkey:9!null l_suppkey:11!null l_extendedprice:14!null l_discount:15!null l_shipdate:19!null o_orderkey:26!null o_custkey:27!null n1.n_nationkey:45!null n1.n_name:46!null n2.n_nationkey:50!null n2.n_name:51!null - │ │ │ ├── key columns: [9] = [26] + │ │ ├── inner-join (lookup lineitem) + │ │ │ ├── columns: l_orderkey:9!null l_suppkey:11!null l_extendedprice:14!null l_discount:15!null l_shipdate:19!null o_orderkey:26!null o_custkey:27!null c_custkey:36!null c_nationkey:39!null n1.n_nationkey:45!null n1.n_name:46!null n2.n_nationkey:50!null n2.n_name:51!null + │ │ │ ├── key columns: [9 12] = [9 12] │ │ │ ├── lookup columns are key - │ │ │ ├── fd: (26)-->(27), (1)-->(4), (45)-->(46), (50)-->(51), (4)==(45), (45)==(4), (1)==(11), (11)==(1), (9)==(26), (26)==(9) - │ │ │ ├── inner-join (lookup lineitem) - │ │ │ │ ├── columns: s_suppkey:1!null s_nationkey:4!null l_orderkey:9!null l_suppkey:11!null l_extendedprice:14!null l_discount:15!null l_shipdate:19!null n1.n_nationkey:45!null n1.n_name:46!null n2.n_nationkey:50!null n2.n_name:51!null - │ │ │ │ ├── key columns: [9 12] = [9 12] - │ │ │ │ ├── lookup columns are key - │ │ │ │ ├── fd: (1)-->(4), (45)-->(46), (50)-->(51), (4)==(45), (45)==(4), (1)==(11), (11)==(1) - │ │ │ │ ├── inner-join (lookup lineitem@l_sk) - │ │ │ │ │ ├── columns: s_suppkey:1!null s_nationkey:4!null l_orderkey:9!null l_suppkey:11!null l_linenumber:12!null n1.n_nationkey:45!null n1.n_name:46!null n2.n_nationkey:50!null n2.n_name:51!null - │ │ │ │ │ ├── key columns: [1] = [11] - │ │ │ │ │ ├── key: (9,12,50) - │ │ │ │ │ ├── fd: (1)-->(4), (45)-->(46), (50)-->(51), (4)==(45), (45)==(4), (9,12)-->(11), (1)==(11), (11)==(1) - │ │ │ │ │ ├── inner-join (lookup supplier@s_nk) - │ │ │ │ │ │ ├── columns: s_suppkey:1!null s_nationkey:4!null n1.n_nationkey:45!null n1.n_name:46!null n2.n_nationkey:50!null n2.n_name:51!null - │ │ │ │ │ │ ├── key columns: [45] = [4] - │ │ │ │ │ │ ├── key: (1,50) - │ │ │ │ │ │ ├── fd: (1)-->(4), (45)-->(46), (50)-->(51), (4)==(45), (45)==(4) + │ │ │ ├── fd: (26)-->(27), (36)-->(39), (45)-->(46), (50)-->(51), (39)==(50), (50)==(39), (27)==(36), (36)==(27), (9)==(26), (26)==(9) + │ │ │ ├── inner-join (hash) + │ │ │ │ ├── columns: l_orderkey:9!null l_linenumber:12!null l_shipdate:19!null o_orderkey:26!null o_custkey:27!null c_custkey:36!null c_nationkey:39!null n1.n_nationkey:45!null n1.n_name:46!null n2.n_nationkey:50!null n2.n_name:51!null + │ │ │ │ ├── key: (12,26,45) + │ │ │ │ ├── fd: (9,12)-->(19), (26)-->(27), (36)-->(39), (45)-->(46), (50)-->(51), (39)==(50), (50)==(39), (27)==(36), (36)==(27), (9)==(26), (26)==(9) + │ │ │ │ ├── scan lineitem@l_sd + │ │ │ │ │ ├── columns: l_orderkey:9!null l_linenumber:12!null l_shipdate:19!null + │ │ │ │ │ ├── constraint: /19/9/12: [/'1995-01-01' - /'1996-12-31'] + │ │ │ │ │ ├── key: (9,12) + │ │ │ │ │ └── fd: (9,12)-->(19) + │ │ │ │ ├── inner-join (lookup orders@o_ck) + │ │ │ │ │ ├── columns: o_orderkey:26!null o_custkey:27!null c_custkey:36!null c_nationkey:39!null n1.n_nationkey:45!null n1.n_name:46!null n2.n_nationkey:50!null n2.n_name:51!null + │ │ │ │ │ ├── key columns: [36] = [27] + │ │ │ │ │ ├── key: (26,45) + │ │ │ │ │ ├── fd: (26)-->(27), (36)-->(39), (45)-->(46), (50)-->(51), (39)==(50), (50)==(39), (27)==(36), (36)==(27) + │ │ │ │ │ ├── inner-join (lookup customer@c_nk) + │ │ │ │ │ │ ├── columns: c_custkey:36!null c_nationkey:39!null n1.n_nationkey:45!null n1.n_name:46!null n2.n_nationkey:50!null n2.n_name:51!null + │ │ │ │ │ │ ├── key columns: [50] = [39] + │ │ │ │ │ │ ├── key: (36,45) + │ │ │ │ │ │ ├── fd: (36)-->(39), (45)-->(46), (50)-->(51), (39)==(50), (50)==(39) │ │ │ │ │ │ ├── inner-join (cross) │ │ │ │ │ │ │ ├── columns: n1.n_nationkey:45!null n1.n_name:46!null n2.n_nationkey:50!null n2.n_name:51!null │ │ │ │ │ │ │ ├── key: (45,50) @@ -738,11 +738,15 @@ sort │ │ │ │ │ │ └── filters (true) │ │ │ │ │ └── filters (true) │ │ │ │ └── filters - │ │ │ │ └── (l_shipdate:19 >= '1995-01-01') AND (l_shipdate:19 <= '1996-12-31') [outer=(19), constraints=(/19: [/'1995-01-01' - /'1996-12-31']; tight)] + │ │ │ │ └── o_orderkey:26 = l_orderkey:9 [outer=(9,26), constraints=(/9: (/NULL - ]; /26: (/NULL - ]), fd=(9)==(26), (26)==(9)] │ │ │ └── filters (true) + │ │ ├── scan supplier@s_nk + │ │ │ ├── columns: s_suppkey:1!null s_nationkey:4!null + │ │ │ ├── key: (1) + │ │ │ └── fd: (1)-->(4) │ │ └── filters - │ │ ├── c_nationkey:39 = n2.n_nationkey:50 [outer=(39,50), constraints=(/39: (/NULL - ]; /50: (/NULL - ]), fd=(39)==(50), (50)==(39)] - │ │ └── c_custkey:36 = o_custkey:27 [outer=(27,36), constraints=(/27: (/NULL - ]; /36: (/NULL - ]), fd=(27)==(36), (36)==(27)] + │ │ ├── s_suppkey:1 = l_suppkey:11 [outer=(1,11), constraints=(/1: (/NULL - ]; /11: (/NULL - ]), fd=(1)==(11), (11)==(1)] + │ │ └── s_nationkey:4 = n1.n_nationkey:45 [outer=(4,45), constraints=(/4: (/NULL - ]; /45: (/NULL - ]), fd=(4)==(45), (45)==(4)] │ └── projections │ ├── extract('year', l_shipdate:19) [as=l_year:55, outer=(19), immutable] │ └── l_extendedprice:14 * (1.0 - l_discount:15) [as=volume:56, outer=(14,15), immutable] @@ -963,89 +967,88 @@ ORDER BY nation, o_year DESC; ---- -sort +group-by ├── columns: nation:53!null o_year:57 sum_profit:59!null + ├── grouping columns: n_name:53!null o_year:57 ├── immutable ├── key: (53,57) ├── fd: (53,57)-->(59) ├── ordering: +53,-57 - └── group-by - ├── columns: n_name:53!null o_year:57 sum:59!null - ├── grouping columns: n_name:53!null o_year:57 - ├── immutable - ├── key: (53,57) - ├── fd: (53,57)-->(59) - ├── project - │ ├── columns: o_year:57 amount:58!null n_name:53!null - │ ├── immutable - │ ├── inner-join (hash) - │ │ ├── columns: p_partkey:1!null p_name:2!null s_suppkey:11!null s_nationkey:14!null l_orderkey:19!null l_partkey:20!null l_suppkey:21!null l_quantity:23!null l_extendedprice:24!null l_discount:25!null ps_partkey:36!null ps_suppkey:37!null ps_supplycost:39!null o_orderkey:42!null o_orderdate:46!null n_nationkey:52!null n_name:53!null - │ │ ├── multiplicity: left-rows(exactly-one), right-rows(zero-or-more) - │ │ ├── fd: (1)-->(2), (11)-->(14), (36,37)-->(39), (21)==(11,37), (37)==(11,21), (20)==(1,36), (36)==(1,20), (42)-->(46), (19)==(42), (42)==(19), (11)==(21,37), (52)-->(53), (14)==(52), (52)==(14), (1)==(20,36) - │ │ ├── inner-join (hash) - │ │ │ ├── columns: p_partkey:1!null p_name:2!null s_suppkey:11!null s_nationkey:14!null l_orderkey:19!null l_partkey:20!null l_suppkey:21!null l_quantity:23!null l_extendedprice:24!null l_discount:25!null ps_partkey:36!null ps_suppkey:37!null ps_supplycost:39!null o_orderkey:42!null o_orderdate:46!null - │ │ │ ├── multiplicity: left-rows(zero-or-more), right-rows(exactly-one) - │ │ │ ├── fd: (1)-->(2), (11)-->(14), (36,37)-->(39), (21)==(11,37), (37)==(11,21), (20)==(1,36), (36)==(1,20), (42)-->(46), (19)==(42), (42)==(19), (11)==(21,37), (1)==(20,36) - │ │ │ ├── scan supplier@s_nk - │ │ │ │ ├── columns: s_suppkey:11!null s_nationkey:14!null - │ │ │ │ ├── key: (11) - │ │ │ │ └── fd: (11)-->(14) - │ │ │ ├── inner-join (lookup orders) - │ │ │ │ ├── columns: p_partkey:1!null p_name:2!null l_orderkey:19!null l_partkey:20!null l_suppkey:21!null l_quantity:23!null l_extendedprice:24!null l_discount:25!null ps_partkey:36!null ps_suppkey:37!null ps_supplycost:39!null o_orderkey:42!null o_orderdate:46!null - │ │ │ │ ├── key columns: [19] = [42] - │ │ │ │ ├── lookup columns are key - │ │ │ │ ├── fd: (1)-->(2), (36,37)-->(39), (21)==(37), (37)==(21), (20)==(1,36), (36)==(1,20), (42)-->(46), (19)==(42), (42)==(19), (1)==(20,36) - │ │ │ │ ├── inner-join (lookup lineitem) - │ │ │ │ │ ├── columns: p_partkey:1!null p_name:2!null l_orderkey:19!null l_partkey:20!null l_suppkey:21!null l_quantity:23!null l_extendedprice:24!null l_discount:25!null ps_partkey:36!null ps_suppkey:37!null ps_supplycost:39!null - │ │ │ │ │ ├── key columns: [19 22] = [19 22] - │ │ │ │ │ ├── lookup columns are key - │ │ │ │ │ ├── fd: (1)-->(2), (36,37)-->(39), (21)==(37), (37)==(21), (20)==(1,36), (36)==(1,20), (1)==(20,36) - │ │ │ │ │ ├── inner-join (lookup lineitem@l_pk_sk) - │ │ │ │ │ │ ├── columns: p_partkey:1!null p_name:2!null l_orderkey:19!null l_partkey:20!null l_suppkey:21!null l_linenumber:22!null ps_partkey:36!null ps_suppkey:37!null ps_supplycost:39!null - │ │ │ │ │ │ ├── key columns: [36 37] = [20 21] - │ │ │ │ │ │ ├── key: (19,22) - │ │ │ │ │ │ ├── fd: (1)-->(2), (36,37)-->(39), (1)==(20,36), (36)==(1,20), (19,22)-->(20,21), (20)==(1,36), (21)==(37), (37)==(21) - │ │ │ │ │ │ ├── inner-join (merge) - │ │ │ │ │ │ │ ├── columns: p_partkey:1!null p_name:2!null ps_partkey:36!null ps_suppkey:37!null ps_supplycost:39!null - │ │ │ │ │ │ │ ├── left ordering: +1 - │ │ │ │ │ │ │ ├── right ordering: +36 - │ │ │ │ │ │ │ ├── key: (36,37) - │ │ │ │ │ │ │ ├── fd: (1)-->(2), (36,37)-->(39), (1)==(36), (36)==(1) - │ │ │ │ │ │ │ ├── select - │ │ │ │ │ │ │ │ ├── columns: p_partkey:1!null p_name:2!null - │ │ │ │ │ │ │ │ ├── key: (1) - │ │ │ │ │ │ │ │ ├── fd: (1)-->(2) - │ │ │ │ │ │ │ │ ├── ordering: +1 - │ │ │ │ │ │ │ │ ├── scan part - │ │ │ │ │ │ │ │ │ ├── columns: p_partkey:1!null p_name:2!null - │ │ │ │ │ │ │ │ │ ├── key: (1) - │ │ │ │ │ │ │ │ │ ├── fd: (1)-->(2) - │ │ │ │ │ │ │ │ │ └── ordering: +1 - │ │ │ │ │ │ │ │ └── filters - │ │ │ │ │ │ │ │ └── p_name:2 LIKE '%green%' [outer=(2), constraints=(/2: (/NULL - ])] - │ │ │ │ │ │ │ ├── scan partsupp - │ │ │ │ │ │ │ │ ├── columns: ps_partkey:36!null ps_suppkey:37!null ps_supplycost:39!null - │ │ │ │ │ │ │ │ ├── key: (36,37) - │ │ │ │ │ │ │ │ ├── fd: (36,37)-->(39) - │ │ │ │ │ │ │ │ └── ordering: +36 - │ │ │ │ │ │ │ └── filters (true) - │ │ │ │ │ │ └── filters (true) - │ │ │ │ │ └── filters (true) - │ │ │ │ └── filters (true) - │ │ │ └── filters - │ │ │ └── s_suppkey:11 = l_suppkey:21 [outer=(11,21), constraints=(/11: (/NULL - ]; /21: (/NULL - ]), fd=(11)==(21), (21)==(11)] - │ │ ├── scan nation - │ │ │ ├── columns: n_nationkey:52!null n_name:53!null - │ │ │ ├── key: (52) - │ │ │ └── fd: (52)-->(53) - │ │ └── filters - │ │ └── s_nationkey:14 = n_nationkey:52 [outer=(14,52), constraints=(/14: (/NULL - ]; /52: (/NULL - ]), fd=(14)==(52), (52)==(14)] - │ └── projections - │ ├── extract('year', o_orderdate:46) [as=o_year:57, outer=(46), immutable] - │ └── (l_extendedprice:24 * (1.0 - l_discount:25)) - (ps_supplycost:39 * l_quantity:23) [as=amount:58, outer=(23-25,39), immutable] - └── aggregations - └── sum [as=sum:59, outer=(58)] - └── amount:58 + ├── sort + │ ├── columns: n_name:53!null o_year:57 amount:58!null + │ ├── immutable + │ ├── ordering: +53,-57 + │ └── project + │ ├── columns: o_year:57 amount:58!null n_name:53!null + │ ├── immutable + │ ├── inner-join (hash) + │ │ ├── columns: p_partkey:1!null p_name:2!null s_suppkey:11!null s_nationkey:14!null l_orderkey:19!null l_partkey:20!null l_suppkey:21!null l_quantity:23!null l_extendedprice:24!null l_discount:25!null ps_partkey:36!null ps_suppkey:37!null ps_supplycost:39!null o_orderkey:42!null o_orderdate:46!null n_nationkey:52!null n_name:53!null + │ │ ├── multiplicity: left-rows(exactly-one), right-rows(zero-or-more) + │ │ ├── fd: (1)-->(2), (11)-->(14), (36,37)-->(39), (21)==(11,37), (37)==(11,21), (20)==(1,36), (36)==(1,20), (42)-->(46), (19)==(42), (42)==(19), (11)==(21,37), (52)-->(53), (14)==(52), (52)==(14), (1)==(20,36) + │ │ ├── inner-join (hash) + │ │ │ ├── columns: p_partkey:1!null p_name:2!null s_suppkey:11!null s_nationkey:14!null l_orderkey:19!null l_partkey:20!null l_suppkey:21!null l_quantity:23!null l_extendedprice:24!null l_discount:25!null ps_partkey:36!null ps_suppkey:37!null ps_supplycost:39!null o_orderkey:42!null o_orderdate:46!null + │ │ │ ├── multiplicity: left-rows(zero-or-more), right-rows(exactly-one) + │ │ │ ├── fd: (1)-->(2), (11)-->(14), (36,37)-->(39), (21)==(11,37), (37)==(11,21), (20)==(1,36), (36)==(1,20), (42)-->(46), (19)==(42), (42)==(19), (11)==(21,37), (1)==(20,36) + │ │ │ ├── scan supplier@s_nk + │ │ │ │ ├── columns: s_suppkey:11!null s_nationkey:14!null + │ │ │ │ ├── key: (11) + │ │ │ │ └── fd: (11)-->(14) + │ │ │ ├── inner-join (lookup orders) + │ │ │ │ ├── columns: p_partkey:1!null p_name:2!null l_orderkey:19!null l_partkey:20!null l_suppkey:21!null l_quantity:23!null l_extendedprice:24!null l_discount:25!null ps_partkey:36!null ps_suppkey:37!null ps_supplycost:39!null o_orderkey:42!null o_orderdate:46!null + │ │ │ │ ├── key columns: [19] = [42] + │ │ │ │ ├── lookup columns are key + │ │ │ │ ├── fd: (1)-->(2), (36,37)-->(39), (21)==(37), (37)==(21), (20)==(1,36), (36)==(1,20), (42)-->(46), (19)==(42), (42)==(19), (1)==(20,36) + │ │ │ │ ├── inner-join (lookup lineitem) + │ │ │ │ │ ├── columns: p_partkey:1!null p_name:2!null l_orderkey:19!null l_partkey:20!null l_suppkey:21!null l_quantity:23!null l_extendedprice:24!null l_discount:25!null ps_partkey:36!null ps_suppkey:37!null ps_supplycost:39!null + │ │ │ │ │ ├── key columns: [19 22] = [19 22] + │ │ │ │ │ ├── lookup columns are key + │ │ │ │ │ ├── fd: (1)-->(2), (36,37)-->(39), (21)==(37), (37)==(21), (20)==(1,36), (36)==(1,20), (1)==(20,36) + │ │ │ │ │ ├── inner-join (lookup lineitem@l_pk_sk) + │ │ │ │ │ │ ├── columns: p_partkey:1!null p_name:2!null l_orderkey:19!null l_partkey:20!null l_suppkey:21!null l_linenumber:22!null ps_partkey:36!null ps_suppkey:37!null ps_supplycost:39!null + │ │ │ │ │ │ ├── key columns: [36 37] = [20 21] + │ │ │ │ │ │ ├── key: (19,22) + │ │ │ │ │ │ ├── fd: (1)-->(2), (36,37)-->(39), (1)==(20,36), (36)==(1,20), (19,22)-->(20,21), (20)==(1,36), (21)==(37), (37)==(21) + │ │ │ │ │ │ ├── inner-join (merge) + │ │ │ │ │ │ │ ├── columns: p_partkey:1!null p_name:2!null ps_partkey:36!null ps_suppkey:37!null ps_supplycost:39!null + │ │ │ │ │ │ │ ├── left ordering: +1 + │ │ │ │ │ │ │ ├── right ordering: +36 + │ │ │ │ │ │ │ ├── key: (36,37) + │ │ │ │ │ │ │ ├── fd: (1)-->(2), (36,37)-->(39), (1)==(36), (36)==(1) + │ │ │ │ │ │ │ ├── select + │ │ │ │ │ │ │ │ ├── columns: p_partkey:1!null p_name:2!null + │ │ │ │ │ │ │ │ ├── key: (1) + │ │ │ │ │ │ │ │ ├── fd: (1)-->(2) + │ │ │ │ │ │ │ │ ├── ordering: +1 + │ │ │ │ │ │ │ │ ├── scan part + │ │ │ │ │ │ │ │ │ ├── columns: p_partkey:1!null p_name:2!null + │ │ │ │ │ │ │ │ │ ├── key: (1) + │ │ │ │ │ │ │ │ │ ├── fd: (1)-->(2) + │ │ │ │ │ │ │ │ │ └── ordering: +1 + │ │ │ │ │ │ │ │ └── filters + │ │ │ │ │ │ │ │ └── p_name:2 LIKE '%green%' [outer=(2), constraints=(/2: (/NULL - ])] + │ │ │ │ │ │ │ ├── scan partsupp + │ │ │ │ │ │ │ │ ├── columns: ps_partkey:36!null ps_suppkey:37!null ps_supplycost:39!null + │ │ │ │ │ │ │ │ ├── key: (36,37) + │ │ │ │ │ │ │ │ ├── fd: (36,37)-->(39) + │ │ │ │ │ │ │ │ └── ordering: +36 + │ │ │ │ │ │ │ └── filters (true) + │ │ │ │ │ │ └── filters (true) + │ │ │ │ │ └── filters (true) + │ │ │ │ └── filters (true) + │ │ │ └── filters + │ │ │ └── s_suppkey:11 = l_suppkey:21 [outer=(11,21), constraints=(/11: (/NULL - ]; /21: (/NULL - ]), fd=(11)==(21), (21)==(11)] + │ │ ├── scan nation + │ │ │ ├── columns: n_nationkey:52!null n_name:53!null + │ │ │ ├── key: (52) + │ │ │ └── fd: (52)-->(53) + │ │ └── filters + │ │ └── s_nationkey:14 = n_nationkey:52 [outer=(14,52), constraints=(/14: (/NULL - ]; /52: (/NULL - ]), fd=(14)==(52), (52)==(14)] + │ └── projections + │ ├── extract('year', o_orderdate:46) [as=o_year:57, outer=(46), immutable] + │ └── (l_extendedprice:24 * (1.0 - l_discount:25)) - (ps_supplycost:39 * l_quantity:23) [as=amount:58, outer=(23-25,39), immutable] + └── aggregations + └── sum [as=sum:59, outer=(58)] + └── amount:58 # -------------------------------------------------- # Q10 diff --git a/pkg/sql/opt/xform/testdata/external/tpch-no-stats b/pkg/sql/opt/xform/testdata/external/tpch-no-stats index 51053f693e95..1db07ba36ff0 100644 --- a/pkg/sql/opt/xform/testdata/external/tpch-no-stats +++ b/pkg/sql/opt/xform/testdata/external/tpch-no-stats @@ -168,7 +168,6 @@ project │ ├── group-by │ │ ├── columns: p_partkey:1!null p_mfgr:3!null s_name:12!null s_address:13!null s_phone:15!null s_acctbal:16!null s_comment:17!null ps_partkey:19!null ps_suppkey:20!null ps_supplycost:22!null n_name:26!null min:57!null │ │ ├── grouping columns: ps_partkey:19!null ps_suppkey:20!null - │ │ ├── internal-ordering: +(1|19|34),+(11|20) opt(6,31,54) │ │ ├── key: (19,20) │ │ ├── fd: (1)-->(3), (19,20)-->(1,3,12,13,15-17,22,26,57), (1)==(19), (19)==(1), (20)-->(12,13,15-17,26) │ │ ├── inner-join (lookup region) @@ -177,70 +176,58 @@ project │ │ │ ├── lookup columns are key │ │ │ ├── key: (20,34,40) │ │ │ ├── fd: ()-->(6,31,54), (1)-->(3,5), (11)-->(12-17), (19,20)-->(22), (11)==(20), (20)==(11), (25)-->(26,27), (27)==(30), (30)==(27), (14)==(25), (25)==(14), (1)==(19,34), (19)==(1,34), (34,35)-->(37), (40)-->(43), (48)-->(50), (50)==(53), (53)==(50), (43)==(48), (48)==(43), (35)==(40), (40)==(35), (34)==(1,19) - │ │ │ ├── ordering: +(1|19|34),+(11|20) opt(6,31,54) [actual: +1,+20] │ │ │ ├── inner-join (lookup nation) │ │ │ │ ├── columns: p_partkey:1!null p_mfgr:3!null p_type:5!null p_size:6!null s_suppkey:11!null s_name:12!null s_address:13!null s_nationkey:14!null s_phone:15!null s_acctbal:16!null s_comment:17!null ps_partkey:19!null ps_suppkey:20!null ps_supplycost:22!null n_nationkey:25!null n_name:26!null n_regionkey:27!null r_regionkey:30!null r_name:31!null ps_partkey:34!null ps_suppkey:35!null ps_supplycost:37!null s_suppkey:40!null s_nationkey:43!null n_nationkey:48!null n_regionkey:50!null │ │ │ │ ├── key columns: [43] = [48] │ │ │ │ ├── lookup columns are key │ │ │ │ ├── key: (20,34,40) │ │ │ │ ├── fd: ()-->(6,31), (1)-->(3,5), (25)-->(26,27), (11)-->(12-17), (19,20)-->(22), (34,35)-->(37), (40)-->(43), (48)-->(50), (43)==(48), (48)==(43), (35)==(40), (40)==(35), (19)==(1,34), (34)==(1,19), (11)==(20), (20)==(11), (14)==(25), (25)==(14), (27)==(30), (30)==(27), (1)==(19,34) - │ │ │ │ ├── ordering: +(1|19|34),+(11|20) opt(6,31) [actual: +1,+20] │ │ │ │ ├── inner-join (lookup supplier) │ │ │ │ │ ├── columns: p_partkey:1!null p_mfgr:3!null p_type:5!null p_size:6!null s_suppkey:11!null s_name:12!null s_address:13!null s_nationkey:14!null s_phone:15!null s_acctbal:16!null s_comment:17!null ps_partkey:19!null ps_suppkey:20!null ps_supplycost:22!null n_nationkey:25!null n_name:26!null n_regionkey:27!null r_regionkey:30!null r_name:31!null ps_partkey:34!null ps_suppkey:35!null ps_supplycost:37!null s_suppkey:40!null s_nationkey:43!null │ │ │ │ │ ├── key columns: [35] = [40] │ │ │ │ │ ├── lookup columns are key │ │ │ │ │ ├── key: (20,34,40) │ │ │ │ │ ├── fd: ()-->(6,31), (1)-->(3,5), (25)-->(26,27), (11)-->(12-17), (19,20)-->(22), (34,35)-->(37), (40)-->(43), (35)==(40), (40)==(35), (19)==(1,34), (34)==(1,19), (11)==(20), (20)==(11), (14)==(25), (25)==(14), (27)==(30), (30)==(27), (1)==(19,34) - │ │ │ │ │ ├── ordering: +(1|19|34),+(11|20) opt(6,31) [actual: +1,+20] │ │ │ │ │ ├── inner-join (lookup partsupp) │ │ │ │ │ │ ├── columns: p_partkey:1!null p_mfgr:3!null p_type:5!null p_size:6!null s_suppkey:11!null s_name:12!null s_address:13!null s_nationkey:14!null s_phone:15!null s_acctbal:16!null s_comment:17!null ps_partkey:19!null ps_suppkey:20!null ps_supplycost:22!null n_nationkey:25!null n_name:26!null n_regionkey:27!null r_regionkey:30!null r_name:31!null ps_partkey:34!null ps_suppkey:35!null ps_supplycost:37!null │ │ │ │ │ │ ├── key columns: [1] = [34] │ │ │ │ │ │ ├── key: (20,34,35) │ │ │ │ │ │ ├── fd: ()-->(6,31), (1)-->(3,5), (25)-->(26,27), (11)-->(12-17), (19,20)-->(22), (34,35)-->(37), (19)==(1,34), (34)==(1,19), (11)==(20), (20)==(11), (14)==(25), (25)==(14), (27)==(30), (30)==(27), (1)==(19,34) - │ │ │ │ │ │ ├── ordering: +(1|19|34),+(11|20) opt(6,31) [actual: +1,+20] │ │ │ │ │ │ ├── inner-join (lookup region) │ │ │ │ │ │ │ ├── columns: p_partkey:1!null p_mfgr:3!null p_type:5!null p_size:6!null s_suppkey:11!null s_name:12!null s_address:13!null s_nationkey:14!null s_phone:15!null s_acctbal:16!null s_comment:17!null ps_partkey:19!null ps_suppkey:20!null ps_supplycost:22!null n_nationkey:25!null n_name:26!null n_regionkey:27!null r_regionkey:30!null r_name:31!null │ │ │ │ │ │ │ ├── key columns: [27] = [30] │ │ │ │ │ │ │ ├── lookup columns are key │ │ │ │ │ │ │ ├── key: (19,20) │ │ │ │ │ │ │ ├── fd: ()-->(6,31), (1)-->(3,5), (11)-->(12-17), (19,20)-->(22), (11)==(20), (20)==(11), (25)-->(26,27), (27)==(30), (30)==(27), (14)==(25), (25)==(14), (1)==(19), (19)==(1) - │ │ │ │ │ │ │ ├── ordering: +(1|19),+(11|20) opt(6,31) [actual: +1,+20] │ │ │ │ │ │ │ ├── inner-join (lookup nation) │ │ │ │ │ │ │ │ ├── columns: p_partkey:1!null p_mfgr:3!null p_type:5!null p_size:6!null s_suppkey:11!null s_name:12!null s_address:13!null s_nationkey:14!null s_phone:15!null s_acctbal:16!null s_comment:17!null ps_partkey:19!null ps_suppkey:20!null ps_supplycost:22!null n_nationkey:25!null n_name:26!null n_regionkey:27!null │ │ │ │ │ │ │ │ ├── key columns: [14] = [25] │ │ │ │ │ │ │ │ ├── lookup columns are key │ │ │ │ │ │ │ │ ├── key: (19,20) │ │ │ │ │ │ │ │ ├── fd: ()-->(6), (1)-->(3,5), (19,20)-->(22), (11)-->(12-17), (25)-->(26,27), (14)==(25), (25)==(14), (11)==(20), (20)==(11), (1)==(19), (19)==(1) - │ │ │ │ │ │ │ │ ├── ordering: +(1|19),+(11|20) opt(6) [actual: +1,+20] │ │ │ │ │ │ │ │ ├── inner-join (lookup supplier) │ │ │ │ │ │ │ │ │ ├── columns: p_partkey:1!null p_mfgr:3!null p_type:5!null p_size:6!null s_suppkey:11!null s_name:12!null s_address:13!null s_nationkey:14!null s_phone:15!null s_acctbal:16!null s_comment:17!null ps_partkey:19!null ps_suppkey:20!null ps_supplycost:22!null │ │ │ │ │ │ │ │ │ ├── key columns: [20] = [11] │ │ │ │ │ │ │ │ │ ├── lookup columns are key │ │ │ │ │ │ │ │ │ ├── key: (19,20) │ │ │ │ │ │ │ │ │ ├── fd: ()-->(6), (1)-->(3,5), (11)-->(12-17), (19,20)-->(22), (11)==(20), (20)==(11), (1)==(19), (19)==(1) - │ │ │ │ │ │ │ │ │ ├── ordering: +(1|19),+(11|20) opt(6) [actual: +1,+20] - │ │ │ │ │ │ │ │ │ ├── sort + │ │ │ │ │ │ │ │ │ ├── inner-join (lookup partsupp) │ │ │ │ │ │ │ │ │ │ ├── columns: p_partkey:1!null p_mfgr:3!null p_type:5!null p_size:6!null ps_partkey:19!null ps_suppkey:20!null ps_supplycost:22!null + │ │ │ │ │ │ │ │ │ │ ├── key columns: [1] = [19] │ │ │ │ │ │ │ │ │ │ ├── key: (19,20) │ │ │ │ │ │ │ │ │ │ ├── fd: ()-->(6), (1)-->(3,5), (19,20)-->(22), (1)==(19), (19)==(1) - │ │ │ │ │ │ │ │ │ │ ├── ordering: +(1|19),+20 opt(6) [actual: +1,+20] - │ │ │ │ │ │ │ │ │ │ └── inner-join (lookup partsupp) - │ │ │ │ │ │ │ │ │ │ ├── columns: p_partkey:1!null p_mfgr:3!null p_type:5!null p_size:6!null ps_partkey:19!null ps_suppkey:20!null ps_supplycost:22!null - │ │ │ │ │ │ │ │ │ │ ├── key columns: [1] = [19] - │ │ │ │ │ │ │ │ │ │ ├── key: (19,20) - │ │ │ │ │ │ │ │ │ │ ├── fd: ()-->(6), (1)-->(3,5), (19,20)-->(22), (1)==(19), (19)==(1) - │ │ │ │ │ │ │ │ │ │ ├── select - │ │ │ │ │ │ │ │ │ │ │ ├── columns: p_partkey:1!null p_mfgr:3!null p_type:5!null p_size:6!null - │ │ │ │ │ │ │ │ │ │ │ ├── key: (1) - │ │ │ │ │ │ │ │ │ │ │ ├── fd: ()-->(6), (1)-->(3,5) - │ │ │ │ │ │ │ │ │ │ │ ├── scan part - │ │ │ │ │ │ │ │ │ │ │ │ ├── columns: p_partkey:1!null p_mfgr:3!null p_type:5!null p_size:6!null - │ │ │ │ │ │ │ │ │ │ │ │ ├── key: (1) - │ │ │ │ │ │ │ │ │ │ │ │ └── fd: (1)-->(3,5,6) - │ │ │ │ │ │ │ │ │ │ │ └── filters - │ │ │ │ │ │ │ │ │ │ │ ├── p_size:6 = 15 [outer=(6), constraints=(/6: [/15 - /15]; tight), fd=()-->(6)] - │ │ │ │ │ │ │ │ │ │ │ └── p_type:5 LIKE '%BRASS' [outer=(5), constraints=(/5: (/NULL - ])] - │ │ │ │ │ │ │ │ │ │ └── filters (true) + │ │ │ │ │ │ │ │ │ │ ├── select + │ │ │ │ │ │ │ │ │ │ │ ├── columns: p_partkey:1!null p_mfgr:3!null p_type:5!null p_size:6!null + │ │ │ │ │ │ │ │ │ │ │ ├── key: (1) + │ │ │ │ │ │ │ │ │ │ │ ├── fd: ()-->(6), (1)-->(3,5) + │ │ │ │ │ │ │ │ │ │ │ ├── scan part + │ │ │ │ │ │ │ │ │ │ │ │ ├── columns: p_partkey:1!null p_mfgr:3!null p_type:5!null p_size:6!null + │ │ │ │ │ │ │ │ │ │ │ │ ├── key: (1) + │ │ │ │ │ │ │ │ │ │ │ │ └── fd: (1)-->(3,5,6) + │ │ │ │ │ │ │ │ │ │ │ └── filters + │ │ │ │ │ │ │ │ │ │ │ ├── p_size:6 = 15 [outer=(6), constraints=(/6: [/15 - /15]; tight), fd=()-->(6)] + │ │ │ │ │ │ │ │ │ │ │ └── p_type:5 LIKE '%BRASS' [outer=(5), constraints=(/5: (/NULL - ])] + │ │ │ │ │ │ │ │ │ │ └── filters (true) │ │ │ │ │ │ │ │ │ └── filters (true) │ │ │ │ │ │ │ │ └── filters (true) │ │ │ │ │ │ │ └── filters @@ -423,43 +410,44 @@ GROUP BY ORDER BY o_orderpriority; ---- -sort +group-by ├── columns: o_orderpriority:6!null order_count:28!null + ├── grouping columns: o_orderpriority:6!null ├── key: (6) ├── fd: (6)-->(28) ├── ordering: +6 - └── group-by - ├── columns: o_orderpriority:6!null count_rows:28!null - ├── grouping columns: o_orderpriority:6!null - ├── key: (6) - ├── fd: (6)-->(28) - ├── project - │ ├── columns: o_orderkey:1!null o_orderdate:5!null o_orderpriority:6!null - │ ├── key: (1) - │ ├── fd: (1)-->(5,6) - │ └── inner-join (lookup orders) - │ ├── columns: o_orderkey:1!null o_orderdate:5!null o_orderpriority:6!null l_orderkey:11!null - │ ├── key columns: [11] = [1] - │ ├── lookup columns are key - │ ├── key: (11) - │ ├── fd: (1)-->(5,6), (1)==(11), (11)==(1) - │ ├── distinct-on - │ │ ├── columns: l_orderkey:11!null - │ │ ├── grouping columns: l_orderkey:11!null - │ │ ├── internal-ordering: +11 - │ │ ├── key: (11) - │ │ └── select - │ │ ├── columns: l_orderkey:11!null l_commitdate:22!null l_receiptdate:23!null - │ │ ├── ordering: +11 - │ │ ├── scan lineitem - │ │ │ ├── columns: l_orderkey:11!null l_commitdate:22!null l_receiptdate:23!null - │ │ │ └── ordering: +11 - │ │ └── filters - │ │ └── l_commitdate:22 < l_receiptdate:23 [outer=(22,23), constraints=(/22: (/NULL - ]; /23: (/NULL - ])] - │ └── filters - │ └── (o_orderdate:5 >= '1993-07-01') AND (o_orderdate:5 < '1993-10-01') [outer=(5), constraints=(/5: [/'1993-07-01' - /'1993-09-30']; tight)] - └── aggregations - └── count-rows [as=count_rows:28] + ├── sort + │ ├── columns: o_orderkey:1!null o_orderdate:5!null o_orderpriority:6!null + │ ├── key: (1) + │ ├── fd: (1)-->(5,6) + │ ├── ordering: +6 + │ └── project + │ ├── columns: o_orderkey:1!null o_orderdate:5!null o_orderpriority:6!null + │ ├── key: (1) + │ ├── fd: (1)-->(5,6) + │ └── inner-join (lookup orders) + │ ├── columns: o_orderkey:1!null o_orderdate:5!null o_orderpriority:6!null l_orderkey:11!null + │ ├── key columns: [11] = [1] + │ ├── lookup columns are key + │ ├── key: (11) + │ ├── fd: (1)-->(5,6), (1)==(11), (11)==(1) + │ ├── distinct-on + │ │ ├── columns: l_orderkey:11!null + │ │ ├── grouping columns: l_orderkey:11!null + │ │ ├── internal-ordering: +11 + │ │ ├── key: (11) + │ │ └── select + │ │ ├── columns: l_orderkey:11!null l_commitdate:22!null l_receiptdate:23!null + │ │ ├── ordering: +11 + │ │ ├── scan lineitem + │ │ │ ├── columns: l_orderkey:11!null l_commitdate:22!null l_receiptdate:23!null + │ │ │ └── ordering: +11 + │ │ └── filters + │ │ └── l_commitdate:22 < l_receiptdate:23 [outer=(22,23), constraints=(/22: (/NULL - ]; /23: (/NULL - ])] + │ └── filters + │ └── (o_orderdate:5 >= '1993-07-01') AND (o_orderdate:5 < '1993-10-01') [outer=(5), constraints=(/5: [/'1993-07-01' - /'1993-09-30']; tight)] + └── aggregations + └── count-rows [as=count_rows:28] # -------------------------------------------------- # Q5 @@ -694,67 +682,68 @@ group-by │ ├── immutable │ ├── inner-join (hash) │ │ ├── columns: s_suppkey:1!null s_nationkey:4!null l_orderkey:9!null l_suppkey:11!null l_extendedprice:14!null l_discount:15!null l_shipdate:19!null o_orderkey:26!null o_custkey:27!null c_custkey:36!null c_nationkey:39!null n1.n_nationkey:45!null n1.n_name:46!null n2.n_nationkey:50!null n2.n_name:51!null - │ │ ├── multiplicity: left-rows(zero-or-one), right-rows(zero-or-more) + │ │ ├── multiplicity: left-rows(zero-or-more), right-rows(zero-or-one) │ │ ├── fd: (1)-->(4), (26)-->(27), (36)-->(39), (45)-->(46), (50)-->(51), (39)==(50), (50)==(39), (27)==(36), (36)==(27), (9)==(26), (26)==(9), (1)==(11), (11)==(1), (4)==(45), (45)==(4) + │ │ ├── inner-join (merge) + │ │ │ ├── columns: s_suppkey:1!null s_nationkey:4!null n1.n_nationkey:45!null n1.n_name:46!null + │ │ │ ├── left ordering: +4 + │ │ │ ├── right ordering: +45 + │ │ │ ├── key: (1) + │ │ │ ├── fd: (1)-->(4), (45)-->(46), (4)==(45), (45)==(4) + │ │ │ ├── scan supplier@s_nk + │ │ │ │ ├── columns: s_suppkey:1!null s_nationkey:4!null + │ │ │ │ ├── key: (1) + │ │ │ │ ├── fd: (1)-->(4) + │ │ │ │ └── ordering: +4 + │ │ │ ├── scan nation [as=n1] + │ │ │ │ ├── columns: n1.n_nationkey:45!null n1.n_name:46!null + │ │ │ │ ├── key: (45) + │ │ │ │ ├── fd: (45)-->(46) + │ │ │ │ └── ordering: +45 + │ │ │ └── filters (true) │ │ ├── inner-join (hash) - │ │ │ ├── columns: s_suppkey:1!null s_nationkey:4!null l_orderkey:9!null l_suppkey:11!null l_extendedprice:14!null l_discount:15!null l_shipdate:19!null o_orderkey:26!null o_custkey:27!null n1.n_nationkey:45!null n1.n_name:46!null + │ │ │ ├── columns: l_orderkey:9!null l_suppkey:11!null l_extendedprice:14!null l_discount:15!null l_shipdate:19!null o_orderkey:26!null o_custkey:27!null c_custkey:36!null c_nationkey:39!null n2.n_nationkey:50!null n2.n_name:51!null │ │ │ ├── multiplicity: left-rows(exactly-one), right-rows(zero-or-more) - │ │ │ ├── fd: (26)-->(27), (1)-->(4), (45)-->(46), (4)==(45), (45)==(4), (1)==(11), (11)==(1), (9)==(26), (26)==(9) + │ │ │ ├── fd: (26)-->(27), (36)-->(39), (50)-->(51), (39)==(50), (50)==(39), (27)==(36), (36)==(27), (9)==(26), (26)==(9) + │ │ │ ├── select + │ │ │ │ ├── columns: l_orderkey:9!null l_suppkey:11!null l_extendedprice:14!null l_discount:15!null l_shipdate:19!null + │ │ │ │ ├── scan lineitem + │ │ │ │ │ └── columns: l_orderkey:9!null l_suppkey:11!null l_extendedprice:14!null l_discount:15!null l_shipdate:19!null + │ │ │ │ └── filters + │ │ │ │ └── (l_shipdate:19 >= '1995-01-01') AND (l_shipdate:19 <= '1996-12-31') [outer=(19), constraints=(/19: [/'1995-01-01' - /'1996-12-31']; tight)] │ │ │ ├── inner-join (hash) - │ │ │ │ ├── columns: l_orderkey:9!null l_suppkey:11!null l_extendedprice:14!null l_discount:15!null l_shipdate:19!null o_orderkey:26!null o_custkey:27!null + │ │ │ │ ├── columns: o_orderkey:26!null o_custkey:27!null c_custkey:36!null c_nationkey:39!null n2.n_nationkey:50!null n2.n_name:51!null │ │ │ │ ├── multiplicity: left-rows(exactly-one), right-rows(zero-or-more) - │ │ │ │ ├── fd: (26)-->(27), (9)==(26), (26)==(9) - │ │ │ │ ├── select - │ │ │ │ │ ├── columns: l_orderkey:9!null l_suppkey:11!null l_extendedprice:14!null l_discount:15!null l_shipdate:19!null - │ │ │ │ │ ├── scan lineitem - │ │ │ │ │ │ └── columns: l_orderkey:9!null l_suppkey:11!null l_extendedprice:14!null l_discount:15!null l_shipdate:19!null - │ │ │ │ │ └── filters - │ │ │ │ │ └── (l_shipdate:19 >= '1995-01-01') AND (l_shipdate:19 <= '1996-12-31') [outer=(19), constraints=(/19: [/'1995-01-01' - /'1996-12-31']; tight)] + │ │ │ │ ├── key: (26) + │ │ │ │ ├── fd: (26)-->(27), (36)-->(39), (50)-->(51), (39)==(50), (50)==(39), (27)==(36), (36)==(27) │ │ │ │ ├── scan orders@o_ck │ │ │ │ │ ├── columns: o_orderkey:26!null o_custkey:27!null │ │ │ │ │ ├── key: (26) │ │ │ │ │ └── fd: (26)-->(27) + │ │ │ │ ├── inner-join (merge) + │ │ │ │ │ ├── columns: c_custkey:36!null c_nationkey:39!null n2.n_nationkey:50!null n2.n_name:51!null + │ │ │ │ │ ├── left ordering: +39 + │ │ │ │ │ ├── right ordering: +50 + │ │ │ │ │ ├── key: (36) + │ │ │ │ │ ├── fd: (36)-->(39), (50)-->(51), (39)==(50), (50)==(39) + │ │ │ │ │ ├── scan customer@c_nk + │ │ │ │ │ │ ├── columns: c_custkey:36!null c_nationkey:39!null + │ │ │ │ │ │ ├── key: (36) + │ │ │ │ │ │ ├── fd: (36)-->(39) + │ │ │ │ │ │ └── ordering: +39 + │ │ │ │ │ ├── scan nation [as=n2] + │ │ │ │ │ │ ├── columns: n2.n_nationkey:50!null n2.n_name:51!null + │ │ │ │ │ │ ├── key: (50) + │ │ │ │ │ │ ├── fd: (50)-->(51) + │ │ │ │ │ │ └── ordering: +50 + │ │ │ │ │ └── filters (true) │ │ │ │ └── filters - │ │ │ │ └── o_orderkey:26 = l_orderkey:9 [outer=(9,26), constraints=(/9: (/NULL - ]; /26: (/NULL - ]), fd=(9)==(26), (26)==(9)] - │ │ │ ├── inner-join (merge) - │ │ │ │ ├── columns: s_suppkey:1!null s_nationkey:4!null n1.n_nationkey:45!null n1.n_name:46!null - │ │ │ │ ├── left ordering: +4 - │ │ │ │ ├── right ordering: +45 - │ │ │ │ ├── key: (1) - │ │ │ │ ├── fd: (1)-->(4), (45)-->(46), (4)==(45), (45)==(4) - │ │ │ │ ├── scan supplier@s_nk - │ │ │ │ │ ├── columns: s_suppkey:1!null s_nationkey:4!null - │ │ │ │ │ ├── key: (1) - │ │ │ │ │ ├── fd: (1)-->(4) - │ │ │ │ │ └── ordering: +4 - │ │ │ │ ├── scan nation [as=n1] - │ │ │ │ │ ├── columns: n1.n_nationkey:45!null n1.n_name:46!null - │ │ │ │ │ ├── key: (45) - │ │ │ │ │ ├── fd: (45)-->(46) - │ │ │ │ │ └── ordering: +45 - │ │ │ │ └── filters (true) + │ │ │ │ └── c_custkey:36 = o_custkey:27 [outer=(27,36), constraints=(/27: (/NULL - ]; /36: (/NULL - ]), fd=(27)==(36), (36)==(27)] │ │ │ └── filters - │ │ │ └── s_suppkey:1 = l_suppkey:11 [outer=(1,11), constraints=(/1: (/NULL - ]; /11: (/NULL - ]), fd=(1)==(11), (11)==(1)] - │ │ ├── inner-join (merge) - │ │ │ ├── columns: c_custkey:36!null c_nationkey:39!null n2.n_nationkey:50!null n2.n_name:51!null - │ │ │ ├── left ordering: +39 - │ │ │ ├── right ordering: +50 - │ │ │ ├── key: (36) - │ │ │ ├── fd: (36)-->(39), (50)-->(51), (39)==(50), (50)==(39) - │ │ │ ├── scan customer@c_nk - │ │ │ │ ├── columns: c_custkey:36!null c_nationkey:39!null - │ │ │ │ ├── key: (36) - │ │ │ │ ├── fd: (36)-->(39) - │ │ │ │ └── ordering: +39 - │ │ │ ├── scan nation [as=n2] - │ │ │ │ ├── columns: n2.n_nationkey:50!null n2.n_name:51!null - │ │ │ │ ├── key: (50) - │ │ │ │ ├── fd: (50)-->(51) - │ │ │ │ └── ordering: +50 - │ │ │ └── filters (true) + │ │ │ └── o_orderkey:26 = l_orderkey:9 [outer=(9,26), constraints=(/9: (/NULL - ]; /26: (/NULL - ]), fd=(9)==(26), (26)==(9)] │ │ └── filters │ │ ├── ((n1.n_name:46 = 'FRANCE') AND (n2.n_name:51 = 'GERMANY')) OR ((n1.n_name:46 = 'GERMANY') AND (n2.n_name:51 = 'FRANCE')) [outer=(46,51), constraints=(/46: [/'FRANCE' - /'FRANCE'] [/'GERMANY' - /'GERMANY']; /51: [/'FRANCE' - /'FRANCE'] [/'GERMANY' - /'GERMANY'])] - │ │ └── c_custkey:36 = o_custkey:27 [outer=(27,36), constraints=(/27: (/NULL - ]; /36: (/NULL - ]), fd=(27)==(36), (36)==(27)] + │ │ └── s_suppkey:1 = l_suppkey:11 [outer=(1,11), constraints=(/1: (/NULL - ]; /11: (/NULL - ]), fd=(1)==(11), (11)==(1)] │ └── projections │ ├── extract('year', l_shipdate:19) [as=l_year:55, outer=(19), immutable] │ └── l_extendedprice:14 * (1.0 - l_discount:15) [as=volume:56, outer=(14,15), immutable] @@ -813,110 +802,101 @@ GROUP BY ORDER BY o_year; ---- -sort +project ├── columns: o_year:69 mkt_share:74!null ├── immutable ├── key: (69) ├── fd: (69)-->(74) ├── ordering: +69 - └── project - ├── columns: mkt_share:74!null o_year:69 - ├── immutable - ├── key: (69) - ├── fd: (69)-->(74) - ├── group-by - │ ├── columns: o_year:69 sum:72!null sum:73!null - │ ├── grouping columns: o_year:69 - │ ├── immutable - │ ├── key: (69) - │ ├── fd: (69)-->(72,73) - │ ├── project - │ │ ├── columns: column71:71!null o_year:69 volume:70!null - │ │ ├── immutable - │ │ ├── project - │ │ │ ├── columns: o_year:69 volume:70!null n2.n_name:61!null - │ │ │ ├── immutable - │ │ │ ├── inner-join (hash) - │ │ │ │ ├── columns: p_partkey:1!null p_type:5!null s_suppkey:11!null s_nationkey:14!null l_orderkey:19!null l_partkey:20!null l_suppkey:21!null l_extendedprice:24!null l_discount:25!null o_orderkey:36!null o_custkey:37!null o_orderdate:40!null c_custkey:46!null c_nationkey:49!null n1.n_nationkey:55!null n1.n_regionkey:57!null n2.n_nationkey:60!null n2.n_name:61!null r_regionkey:65!null r_name:66!null - │ │ │ │ ├── multiplicity: left-rows(zero-or-one), right-rows(zero-or-more) - │ │ │ │ ├── fd: ()-->(5,66), (11)-->(14), (36)-->(37,40), (46)-->(49), (55)-->(57), (57)==(65), (65)==(57), (49)==(55), (55)==(49), (37)==(46), (46)==(37), (19)==(36), (36)==(19), (11)==(21), (21)==(11), (60)-->(61), (14)==(60), (60)==(14), (1)==(20), (20)==(1) - │ │ │ │ ├── inner-join (lookup nation [as=n2]) - │ │ │ │ │ ├── columns: p_partkey:1!null p_type:5!null s_suppkey:11!null s_nationkey:14!null l_orderkey:19!null l_partkey:20!null l_suppkey:21!null l_extendedprice:24!null l_discount:25!null o_orderkey:36!null o_custkey:37!null o_orderdate:40!null c_custkey:46!null c_nationkey:49!null n2.n_nationkey:60!null n2.n_name:61!null - │ │ │ │ │ ├── key columns: [14] = [60] - │ │ │ │ │ ├── lookup columns are key - │ │ │ │ │ ├── fd: ()-->(5), (46)-->(49), (36)-->(37,40), (11)-->(14), (60)-->(61), (14)==(60), (60)==(14), (11)==(21), (21)==(11), (19)==(36), (36)==(19), (37)==(46), (46)==(37), (1)==(20), (20)==(1) - │ │ │ │ │ ├── inner-join (lookup customer) - │ │ │ │ │ │ ├── columns: p_partkey:1!null p_type:5!null s_suppkey:11!null s_nationkey:14!null l_orderkey:19!null l_partkey:20!null l_suppkey:21!null l_extendedprice:24!null l_discount:25!null o_orderkey:36!null o_custkey:37!null o_orderdate:40!null c_custkey:46!null c_nationkey:49!null - │ │ │ │ │ │ ├── key columns: [37] = [46] - │ │ │ │ │ │ ├── lookup columns are key - │ │ │ │ │ │ ├── fd: ()-->(5), (11)-->(14), (36)-->(37,40), (46)-->(49), (37)==(46), (46)==(37), (19)==(36), (36)==(19), (11)==(21), (21)==(11), (1)==(20), (20)==(1) - │ │ │ │ │ │ ├── inner-join (lookup supplier) - │ │ │ │ │ │ │ ├── columns: p_partkey:1!null p_type:5!null s_suppkey:11!null s_nationkey:14!null l_orderkey:19!null l_partkey:20!null l_suppkey:21!null l_extendedprice:24!null l_discount:25!null o_orderkey:36!null o_custkey:37!null o_orderdate:40!null - │ │ │ │ │ │ │ ├── key columns: [21] = [11] - │ │ │ │ │ │ │ ├── lookup columns are key - │ │ │ │ │ │ │ ├── fd: ()-->(5), (11)-->(14), (36)-->(37,40), (19)==(36), (36)==(19), (11)==(21), (21)==(11), (1)==(20), (20)==(1) - │ │ │ │ │ │ │ ├── inner-join (lookup orders) - │ │ │ │ │ │ │ │ ├── columns: p_partkey:1!null p_type:5!null l_orderkey:19!null l_partkey:20!null l_suppkey:21!null l_extendedprice:24!null l_discount:25!null o_orderkey:36!null o_custkey:37!null o_orderdate:40!null - │ │ │ │ │ │ │ │ ├── key columns: [19] = [36] - │ │ │ │ │ │ │ │ ├── lookup columns are key - │ │ │ │ │ │ │ │ ├── fd: ()-->(5), (36)-->(37,40), (19)==(36), (36)==(19), (1)==(20), (20)==(1) - │ │ │ │ │ │ │ │ ├── inner-join (lookup lineitem) - │ │ │ │ │ │ │ │ │ ├── columns: p_partkey:1!null p_type:5!null l_orderkey:19!null l_partkey:20!null l_suppkey:21!null l_extendedprice:24!null l_discount:25!null - │ │ │ │ │ │ │ │ │ ├── key columns: [19 22] = [19 22] - │ │ │ │ │ │ │ │ │ ├── lookup columns are key - │ │ │ │ │ │ │ │ │ ├── fd: ()-->(5), (1)==(20), (20)==(1) - │ │ │ │ │ │ │ │ │ ├── inner-join (lookup lineitem@l_pk) - │ │ │ │ │ │ │ │ │ │ ├── columns: p_partkey:1!null p_type:5!null l_orderkey:19!null l_partkey:20!null l_linenumber:22!null - │ │ │ │ │ │ │ │ │ │ ├── key columns: [1] = [20] - │ │ │ │ │ │ │ │ │ │ ├── key: (19,22) - │ │ │ │ │ │ │ │ │ │ ├── fd: ()-->(5), (19,22)-->(20), (1)==(20), (20)==(1) - │ │ │ │ │ │ │ │ │ │ ├── select - │ │ │ │ │ │ │ │ │ │ │ ├── columns: p_partkey:1!null p_type:5!null - │ │ │ │ │ │ │ │ │ │ │ ├── key: (1) - │ │ │ │ │ │ │ │ │ │ │ ├── fd: ()-->(5) - │ │ │ │ │ │ │ │ │ │ │ ├── scan part - │ │ │ │ │ │ │ │ │ │ │ │ ├── columns: p_partkey:1!null p_type:5!null - │ │ │ │ │ │ │ │ │ │ │ │ ├── key: (1) - │ │ │ │ │ │ │ │ │ │ │ │ └── fd: (1)-->(5) - │ │ │ │ │ │ │ │ │ │ │ └── filters - │ │ │ │ │ │ │ │ │ │ │ └── p_type:5 = 'ECONOMY ANODIZED STEEL' [outer=(5), constraints=(/5: [/'ECONOMY ANODIZED STEEL' - /'ECONOMY ANODIZED STEEL']; tight), fd=()-->(5)] - │ │ │ │ │ │ │ │ │ │ └── filters (true) - │ │ │ │ │ │ │ │ │ └── filters (true) - │ │ │ │ │ │ │ │ └── filters - │ │ │ │ │ │ │ │ └── (o_orderdate:40 >= '1995-01-01') AND (o_orderdate:40 <= '1996-12-31') [outer=(40), constraints=(/40: [/'1995-01-01' - /'1996-12-31']; tight)] - │ │ │ │ │ │ │ └── filters (true) - │ │ │ │ │ │ └── filters (true) - │ │ │ │ │ └── filters (true) - │ │ │ │ ├── inner-join (lookup nation@n_rk [as=n1]) - │ │ │ │ │ ├── columns: n1.n_nationkey:55!null n1.n_regionkey:57!null r_regionkey:65!null r_name:66!null - │ │ │ │ │ ├── key columns: [65] = [57] - │ │ │ │ │ ├── key: (55) - │ │ │ │ │ ├── fd: ()-->(66), (55)-->(57), (57)==(65), (65)==(57) - │ │ │ │ │ ├── select - │ │ │ │ │ │ ├── columns: r_regionkey:65!null r_name:66!null - │ │ │ │ │ │ ├── key: (65) - │ │ │ │ │ │ ├── fd: ()-->(66) - │ │ │ │ │ │ ├── scan region - │ │ │ │ │ │ │ ├── columns: r_regionkey:65!null r_name:66!null - │ │ │ │ │ │ │ ├── key: (65) - │ │ │ │ │ │ │ └── fd: (65)-->(66) - │ │ │ │ │ │ └── filters - │ │ │ │ │ │ └── r_name:66 = 'AMERICA' [outer=(66), constraints=(/66: [/'AMERICA' - /'AMERICA']; tight), fd=()-->(66)] - │ │ │ │ │ └── filters (true) - │ │ │ │ └── filters - │ │ │ │ └── c_nationkey:49 = n1.n_nationkey:55 [outer=(49,55), constraints=(/49: (/NULL - ]; /55: (/NULL - ]), fd=(49)==(55), (55)==(49)] - │ │ │ └── projections - │ │ │ ├── extract('year', o_orderdate:40) [as=o_year:69, outer=(40), immutable] - │ │ │ └── l_extendedprice:24 * (1.0 - l_discount:25) [as=volume:70, outer=(24,25), immutable] - │ │ └── projections - │ │ └── CASE WHEN n2.n_name:61 = 'BRAZIL' THEN volume:70 ELSE 0.0 END [as=column71:71, outer=(61,70)] - │ └── aggregations - │ ├── sum [as=sum:72, outer=(71)] - │ │ └── column71:71 - │ └── sum [as=sum:73, outer=(70)] - │ └── volume:70 - └── projections - └── sum:72 / sum:73 [as=mkt_share:74, outer=(72,73), immutable] + ├── group-by + │ ├── columns: o_year:69 sum:72!null sum:73!null + │ ├── grouping columns: o_year:69 + │ ├── immutable + │ ├── key: (69) + │ ├── fd: (69)-->(72,73) + │ ├── ordering: +69 + │ ├── sort + │ │ ├── columns: o_year:69 volume:70!null column71:71!null + │ │ ├── immutable + │ │ ├── ordering: +69 + │ │ └── project + │ │ ├── columns: column71:71!null o_year:69 volume:70!null + │ │ ├── immutable + │ │ ├── project + │ │ │ ├── columns: o_year:69 volume:70!null n2.n_name:61!null + │ │ │ ├── immutable + │ │ │ ├── inner-join (lookup region) + │ │ │ │ ├── columns: p_partkey:1!null p_type:5!null s_suppkey:11!null s_nationkey:14!null l_orderkey:19!null l_partkey:20!null l_suppkey:21!null l_extendedprice:24!null l_discount:25!null o_orderkey:36!null o_custkey:37!null o_orderdate:40!null c_custkey:46!null c_nationkey:49!null n1.n_nationkey:55!null n1.n_regionkey:57!null n2.n_nationkey:60!null n2.n_name:61!null r_regionkey:65!null r_name:66!null + │ │ │ │ ├── key columns: [57] = [65] + │ │ │ │ ├── lookup columns are key + │ │ │ │ ├── fd: ()-->(5,66), (11)-->(14), (36)-->(37,40), (46)-->(49), (55)-->(57), (57)==(65), (65)==(57), (49)==(55), (55)==(49), (37)==(46), (46)==(37), (19)==(36), (36)==(19), (11)==(21), (21)==(11), (60)-->(61), (14)==(60), (60)==(14), (1)==(20), (20)==(1) + │ │ │ │ ├── inner-join (lookup nation [as=n1]) + │ │ │ │ │ ├── columns: p_partkey:1!null p_type:5!null s_suppkey:11!null s_nationkey:14!null l_orderkey:19!null l_partkey:20!null l_suppkey:21!null l_extendedprice:24!null l_discount:25!null o_orderkey:36!null o_custkey:37!null o_orderdate:40!null c_custkey:46!null c_nationkey:49!null n1.n_nationkey:55!null n1.n_regionkey:57!null n2.n_nationkey:60!null n2.n_name:61!null + │ │ │ │ │ ├── key columns: [49] = [55] + │ │ │ │ │ ├── lookup columns are key + │ │ │ │ │ ├── fd: ()-->(5), (55)-->(57), (46)-->(49), (36)-->(37,40), (11)-->(14), (60)-->(61), (14)==(60), (60)==(14), (11)==(21), (21)==(11), (19)==(36), (36)==(19), (37)==(46), (46)==(37), (49)==(55), (55)==(49), (1)==(20), (20)==(1) + │ │ │ │ │ ├── inner-join (lookup customer) + │ │ │ │ │ │ ├── columns: p_partkey:1!null p_type:5!null s_suppkey:11!null s_nationkey:14!null l_orderkey:19!null l_partkey:20!null l_suppkey:21!null l_extendedprice:24!null l_discount:25!null o_orderkey:36!null o_custkey:37!null o_orderdate:40!null c_custkey:46!null c_nationkey:49!null n2.n_nationkey:60!null n2.n_name:61!null + │ │ │ │ │ │ ├── key columns: [37] = [46] + │ │ │ │ │ │ ├── lookup columns are key + │ │ │ │ │ │ ├── fd: ()-->(5), (46)-->(49), (36)-->(37,40), (11)-->(14), (60)-->(61), (14)==(60), (60)==(14), (11)==(21), (21)==(11), (19)==(36), (36)==(19), (37)==(46), (46)==(37), (1)==(20), (20)==(1) + │ │ │ │ │ │ ├── inner-join (lookup orders) + │ │ │ │ │ │ │ ├── columns: p_partkey:1!null p_type:5!null s_suppkey:11!null s_nationkey:14!null l_orderkey:19!null l_partkey:20!null l_suppkey:21!null l_extendedprice:24!null l_discount:25!null o_orderkey:36!null o_custkey:37!null o_orderdate:40!null n2.n_nationkey:60!null n2.n_name:61!null + │ │ │ │ │ │ │ ├── key columns: [19] = [36] + │ │ │ │ │ │ │ ├── lookup columns are key + │ │ │ │ │ │ │ ├── fd: ()-->(5), (36)-->(37,40), (11)-->(14), (60)-->(61), (14)==(60), (60)==(14), (11)==(21), (21)==(11), (19)==(36), (36)==(19), (1)==(20), (20)==(1) + │ │ │ │ │ │ │ ├── inner-join (lookup nation [as=n2]) + │ │ │ │ │ │ │ │ ├── columns: p_partkey:1!null p_type:5!null s_suppkey:11!null s_nationkey:14!null l_orderkey:19!null l_partkey:20!null l_suppkey:21!null l_extendedprice:24!null l_discount:25!null n2.n_nationkey:60!null n2.n_name:61!null + │ │ │ │ │ │ │ │ ├── key columns: [14] = [60] + │ │ │ │ │ │ │ │ ├── lookup columns are key + │ │ │ │ │ │ │ │ ├── fd: ()-->(5), (11)-->(14), (60)-->(61), (14)==(60), (60)==(14), (11)==(21), (21)==(11), (1)==(20), (20)==(1) + │ │ │ │ │ │ │ │ ├── inner-join (lookup supplier) + │ │ │ │ │ │ │ │ │ ├── columns: p_partkey:1!null p_type:5!null s_suppkey:11!null s_nationkey:14!null l_orderkey:19!null l_partkey:20!null l_suppkey:21!null l_extendedprice:24!null l_discount:25!null + │ │ │ │ │ │ │ │ │ ├── key columns: [21] = [11] + │ │ │ │ │ │ │ │ │ ├── lookup columns are key + │ │ │ │ │ │ │ │ │ ├── fd: ()-->(5), (11)-->(14), (11)==(21), (21)==(11), (1)==(20), (20)==(1) + │ │ │ │ │ │ │ │ │ ├── inner-join (lookup lineitem) + │ │ │ │ │ │ │ │ │ │ ├── columns: p_partkey:1!null p_type:5!null l_orderkey:19!null l_partkey:20!null l_suppkey:21!null l_extendedprice:24!null l_discount:25!null + │ │ │ │ │ │ │ │ │ │ ├── key columns: [19 22] = [19 22] + │ │ │ │ │ │ │ │ │ │ ├── lookup columns are key + │ │ │ │ │ │ │ │ │ │ ├── fd: ()-->(5), (1)==(20), (20)==(1) + │ │ │ │ │ │ │ │ │ │ ├── inner-join (lookup lineitem@l_pk) + │ │ │ │ │ │ │ │ │ │ │ ├── columns: p_partkey:1!null p_type:5!null l_orderkey:19!null l_partkey:20!null l_linenumber:22!null + │ │ │ │ │ │ │ │ │ │ │ ├── key columns: [1] = [20] + │ │ │ │ │ │ │ │ │ │ │ ├── key: (19,22) + │ │ │ │ │ │ │ │ │ │ │ ├── fd: ()-->(5), (19,22)-->(20), (1)==(20), (20)==(1) + │ │ │ │ │ │ │ │ │ │ │ ├── select + │ │ │ │ │ │ │ │ │ │ │ │ ├── columns: p_partkey:1!null p_type:5!null + │ │ │ │ │ │ │ │ │ │ │ │ ├── key: (1) + │ │ │ │ │ │ │ │ │ │ │ │ ├── fd: ()-->(5) + │ │ │ │ │ │ │ │ │ │ │ │ ├── scan part + │ │ │ │ │ │ │ │ │ │ │ │ │ ├── columns: p_partkey:1!null p_type:5!null + │ │ │ │ │ │ │ │ │ │ │ │ │ ├── key: (1) + │ │ │ │ │ │ │ │ │ │ │ │ │ └── fd: (1)-->(5) + │ │ │ │ │ │ │ │ │ │ │ │ └── filters + │ │ │ │ │ │ │ │ │ │ │ │ └── p_type:5 = 'ECONOMY ANODIZED STEEL' [outer=(5), constraints=(/5: [/'ECONOMY ANODIZED STEEL' - /'ECONOMY ANODIZED STEEL']; tight), fd=()-->(5)] + │ │ │ │ │ │ │ │ │ │ │ └── filters (true) + │ │ │ │ │ │ │ │ │ │ └── filters (true) + │ │ │ │ │ │ │ │ │ └── filters (true) + │ │ │ │ │ │ │ │ └── filters (true) + │ │ │ │ │ │ │ └── filters + │ │ │ │ │ │ │ └── (o_orderdate:40 >= '1995-01-01') AND (o_orderdate:40 <= '1996-12-31') [outer=(40), constraints=(/40: [/'1995-01-01' - /'1996-12-31']; tight)] + │ │ │ │ │ │ └── filters (true) + │ │ │ │ │ └── filters (true) + │ │ │ │ └── filters + │ │ │ │ └── r_name:66 = 'AMERICA' [outer=(66), constraints=(/66: [/'AMERICA' - /'AMERICA']; tight), fd=()-->(66)] + │ │ │ └── projections + │ │ │ ├── extract('year', o_orderdate:40) [as=o_year:69, outer=(40), immutable] + │ │ │ └── l_extendedprice:24 * (1.0 - l_discount:25) [as=volume:70, outer=(24,25), immutable] + │ │ └── projections + │ │ └── CASE WHEN n2.n_name:61 = 'BRAZIL' THEN volume:70 ELSE 0.0 END [as=column71:71, outer=(61,70)] + │ └── aggregations + │ ├── sum [as=sum:72, outer=(71)] + │ │ └── column71:71 + │ └── sum [as=sum:73, outer=(70)] + │ └── volume:70 + └── projections + └── sum:72 / sum:73 [as=mkt_share:74, outer=(72,73), immutable] # -------------------------------------------------- # Q9 @@ -967,65 +947,64 @@ ORDER BY nation, o_year DESC; ---- -sort +group-by ├── columns: nation:53!null o_year:57 sum_profit:59!null + ├── grouping columns: n_name:53!null o_year:57 ├── immutable ├── key: (53,57) ├── fd: (53,57)-->(59) ├── ordering: +53,-57 - └── group-by - ├── columns: n_name:53!null o_year:57 sum:59!null - ├── grouping columns: n_name:53!null o_year:57 - ├── immutable - ├── key: (53,57) - ├── fd: (53,57)-->(59) - ├── project - │ ├── columns: o_year:57 amount:58!null n_name:53!null - │ ├── immutable - │ ├── inner-join (lookup part) - │ │ ├── columns: p_partkey:1!null p_name:2!null s_suppkey:11!null s_nationkey:14!null l_orderkey:19!null l_partkey:20!null l_suppkey:21!null l_quantity:23!null l_extendedprice:24!null l_discount:25!null ps_partkey:36!null ps_suppkey:37!null ps_supplycost:39!null o_orderkey:42!null o_orderdate:46!null n_nationkey:52!null n_name:53!null - │ │ ├── key columns: [20] = [1] - │ │ ├── lookup columns are key - │ │ ├── fd: (1)-->(2), (11)-->(14), (36,37)-->(39), (21)==(11,37), (37)==(11,21), (20)==(1,36), (36)==(1,20), (42)-->(46), (19)==(42), (42)==(19), (11)==(21,37), (52)-->(53), (14)==(52), (52)==(14), (1)==(20,36) - │ │ ├── inner-join (lookup nation) - │ │ │ ├── columns: s_suppkey:11!null s_nationkey:14!null l_orderkey:19!null l_partkey:20!null l_suppkey:21!null l_quantity:23!null l_extendedprice:24!null l_discount:25!null ps_partkey:36!null ps_suppkey:37!null ps_supplycost:39!null o_orderkey:42!null o_orderdate:46!null n_nationkey:52!null n_name:53!null - │ │ │ ├── key columns: [14] = [52] - │ │ │ ├── lookup columns are key - │ │ │ ├── fd: (11)-->(14), (36,37)-->(39), (21)==(11,37), (37)==(11,21), (20)==(36), (36)==(20), (42)-->(46), (19)==(42), (42)==(19), (11)==(21,37), (52)-->(53), (14)==(52), (52)==(14) - │ │ │ ├── inner-join (lookup supplier) - │ │ │ │ ├── columns: s_suppkey:11!null s_nationkey:14!null l_orderkey:19!null l_partkey:20!null l_suppkey:21!null l_quantity:23!null l_extendedprice:24!null l_discount:25!null ps_partkey:36!null ps_suppkey:37!null ps_supplycost:39!null o_orderkey:42!null o_orderdate:46!null - │ │ │ │ ├── key columns: [21] = [11] - │ │ │ │ ├── lookup columns are key - │ │ │ │ ├── fd: (11)-->(14), (36,37)-->(39), (21)==(11,37), (37)==(11,21), (20)==(36), (36)==(20), (42)-->(46), (19)==(42), (42)==(19), (11)==(21,37) - │ │ │ │ ├── inner-join (lookup orders) - │ │ │ │ │ ├── columns: l_orderkey:19!null l_partkey:20!null l_suppkey:21!null l_quantity:23!null l_extendedprice:24!null l_discount:25!null ps_partkey:36!null ps_suppkey:37!null ps_supplycost:39!null o_orderkey:42!null o_orderdate:46!null - │ │ │ │ │ ├── key columns: [19] = [42] - │ │ │ │ │ ├── lookup columns are key - │ │ │ │ │ ├── fd: (36,37)-->(39), (21)==(37), (37)==(21), (20)==(36), (36)==(20), (42)-->(46), (19)==(42), (42)==(19) - │ │ │ │ │ ├── inner-join (hash) - │ │ │ │ │ │ ├── columns: l_orderkey:19!null l_partkey:20!null l_suppkey:21!null l_quantity:23!null l_extendedprice:24!null l_discount:25!null ps_partkey:36!null ps_suppkey:37!null ps_supplycost:39!null - │ │ │ │ │ │ ├── multiplicity: left-rows(exactly-one), right-rows(zero-or-more) - │ │ │ │ │ │ ├── fd: (36,37)-->(39), (21)==(37), (37)==(21), (20)==(36), (36)==(20) - │ │ │ │ │ │ ├── scan lineitem - │ │ │ │ │ │ │ └── columns: l_orderkey:19!null l_partkey:20!null l_suppkey:21!null l_quantity:23!null l_extendedprice:24!null l_discount:25!null - │ │ │ │ │ │ ├── scan partsupp - │ │ │ │ │ │ │ ├── columns: ps_partkey:36!null ps_suppkey:37!null ps_supplycost:39!null - │ │ │ │ │ │ │ ├── key: (36,37) - │ │ │ │ │ │ │ └── fd: (36,37)-->(39) - │ │ │ │ │ │ └── filters - │ │ │ │ │ │ ├── ps_suppkey:37 = l_suppkey:21 [outer=(21,37), constraints=(/21: (/NULL - ]; /37: (/NULL - ]), fd=(21)==(37), (37)==(21)] - │ │ │ │ │ │ └── ps_partkey:36 = l_partkey:20 [outer=(20,36), constraints=(/20: (/NULL - ]; /36: (/NULL - ]), fd=(20)==(36), (36)==(20)] - │ │ │ │ │ └── filters (true) - │ │ │ │ └── filters (true) - │ │ │ └── filters (true) - │ │ └── filters - │ │ └── p_name:2 LIKE '%green%' [outer=(2), constraints=(/2: (/NULL - ])] - │ └── projections - │ ├── extract('year', o_orderdate:46) [as=o_year:57, outer=(46), immutable] - │ └── (l_extendedprice:24 * (1.0 - l_discount:25)) - (ps_supplycost:39 * l_quantity:23) [as=amount:58, outer=(23-25,39), immutable] - └── aggregations - └── sum [as=sum:59, outer=(58)] - └── amount:58 + ├── sort + │ ├── columns: n_name:53!null o_year:57 amount:58!null + │ ├── immutable + │ ├── ordering: +53,-57 + │ └── project + │ ├── columns: o_year:57 amount:58!null n_name:53!null + │ ├── immutable + │ ├── inner-join (lookup part) + │ │ ├── columns: p_partkey:1!null p_name:2!null s_suppkey:11!null s_nationkey:14!null l_orderkey:19!null l_partkey:20!null l_suppkey:21!null l_quantity:23!null l_extendedprice:24!null l_discount:25!null ps_partkey:36!null ps_suppkey:37!null ps_supplycost:39!null o_orderkey:42!null o_orderdate:46!null n_nationkey:52!null n_name:53!null + │ │ ├── key columns: [20] = [1] + │ │ ├── lookup columns are key + │ │ ├── fd: (1)-->(2), (11)-->(14), (36,37)-->(39), (21)==(11,37), (37)==(11,21), (20)==(1,36), (36)==(1,20), (42)-->(46), (19)==(42), (42)==(19), (11)==(21,37), (52)-->(53), (14)==(52), (52)==(14), (1)==(20,36) + │ │ ├── inner-join (lookup nation) + │ │ │ ├── columns: s_suppkey:11!null s_nationkey:14!null l_orderkey:19!null l_partkey:20!null l_suppkey:21!null l_quantity:23!null l_extendedprice:24!null l_discount:25!null ps_partkey:36!null ps_suppkey:37!null ps_supplycost:39!null o_orderkey:42!null o_orderdate:46!null n_nationkey:52!null n_name:53!null + │ │ │ ├── key columns: [14] = [52] + │ │ │ ├── lookup columns are key + │ │ │ ├── fd: (11)-->(14), (36,37)-->(39), (21)==(11,37), (37)==(11,21), (20)==(36), (36)==(20), (42)-->(46), (19)==(42), (42)==(19), (11)==(21,37), (52)-->(53), (14)==(52), (52)==(14) + │ │ │ ├── inner-join (lookup supplier) + │ │ │ │ ├── columns: s_suppkey:11!null s_nationkey:14!null l_orderkey:19!null l_partkey:20!null l_suppkey:21!null l_quantity:23!null l_extendedprice:24!null l_discount:25!null ps_partkey:36!null ps_suppkey:37!null ps_supplycost:39!null o_orderkey:42!null o_orderdate:46!null + │ │ │ │ ├── key columns: [21] = [11] + │ │ │ │ ├── lookup columns are key + │ │ │ │ ├── fd: (11)-->(14), (36,37)-->(39), (21)==(11,37), (37)==(11,21), (20)==(36), (36)==(20), (42)-->(46), (19)==(42), (42)==(19), (11)==(21,37) + │ │ │ │ ├── inner-join (lookup orders) + │ │ │ │ │ ├── columns: l_orderkey:19!null l_partkey:20!null l_suppkey:21!null l_quantity:23!null l_extendedprice:24!null l_discount:25!null ps_partkey:36!null ps_suppkey:37!null ps_supplycost:39!null o_orderkey:42!null o_orderdate:46!null + │ │ │ │ │ ├── key columns: [19] = [42] + │ │ │ │ │ ├── lookup columns are key + │ │ │ │ │ ├── fd: (36,37)-->(39), (21)==(37), (37)==(21), (20)==(36), (36)==(20), (42)-->(46), (19)==(42), (42)==(19) + │ │ │ │ │ ├── inner-join (hash) + │ │ │ │ │ │ ├── columns: l_orderkey:19!null l_partkey:20!null l_suppkey:21!null l_quantity:23!null l_extendedprice:24!null l_discount:25!null ps_partkey:36!null ps_suppkey:37!null ps_supplycost:39!null + │ │ │ │ │ │ ├── multiplicity: left-rows(exactly-one), right-rows(zero-or-more) + │ │ │ │ │ │ ├── fd: (36,37)-->(39), (21)==(37), (37)==(21), (20)==(36), (36)==(20) + │ │ │ │ │ │ ├── scan lineitem + │ │ │ │ │ │ │ └── columns: l_orderkey:19!null l_partkey:20!null l_suppkey:21!null l_quantity:23!null l_extendedprice:24!null l_discount:25!null + │ │ │ │ │ │ ├── scan partsupp + │ │ │ │ │ │ │ ├── columns: ps_partkey:36!null ps_suppkey:37!null ps_supplycost:39!null + │ │ │ │ │ │ │ ├── key: (36,37) + │ │ │ │ │ │ │ └── fd: (36,37)-->(39) + │ │ │ │ │ │ └── filters + │ │ │ │ │ │ ├── ps_suppkey:37 = l_suppkey:21 [outer=(21,37), constraints=(/21: (/NULL - ]; /37: (/NULL - ]), fd=(21)==(37), (37)==(21)] + │ │ │ │ │ │ └── ps_partkey:36 = l_partkey:20 [outer=(20,36), constraints=(/20: (/NULL - ]; /36: (/NULL - ]), fd=(20)==(36), (36)==(20)] + │ │ │ │ │ └── filters (true) + │ │ │ │ └── filters (true) + │ │ │ └── filters (true) + │ │ └── filters + │ │ └── p_name:2 LIKE '%green%' [outer=(2), constraints=(/2: (/NULL - ])] + │ └── projections + │ ├── extract('year', o_orderdate:46) [as=o_year:57, outer=(46), immutable] + │ └── (l_extendedprice:24 * (1.0 - l_discount:25)) - (ps_supplycost:39 * l_quantity:23) [as=amount:58, outer=(23-25,39), immutable] + └── aggregations + └── sum [as=sum:59, outer=(58)] + └── amount:58 # -------------------------------------------------- # Q10 @@ -1331,41 +1310,40 @@ GROUP BY ORDER BY l_shipmode; ---- -sort +group-by ├── columns: l_shipmode:25!null high_line_count:29!null low_line_count:31!null + ├── grouping columns: l_shipmode:25!null ├── key: (25) ├── fd: (25)-->(29,31) ├── ordering: +25 - └── group-by - ├── columns: l_shipmode:25!null sum:29!null sum:31!null - ├── grouping columns: l_shipmode:25!null - ├── key: (25) - ├── fd: (25)-->(29,31) - ├── project - │ ├── columns: column28:28!null column30:30!null l_shipmode:25!null - │ ├── inner-join (lookup orders) - │ │ ├── columns: o_orderkey:1!null o_orderpriority:6!null l_orderkey:11!null l_shipdate:21!null l_commitdate:22!null l_receiptdate:23!null l_shipmode:25!null - │ │ ├── key columns: [11] = [1] - │ │ ├── lookup columns are key - │ │ ├── fd: (1)-->(6), (1)==(11), (11)==(1) - │ │ ├── select - │ │ │ ├── columns: l_orderkey:11!null l_shipdate:21!null l_commitdate:22!null l_receiptdate:23!null l_shipmode:25!null - │ │ │ ├── scan lineitem - │ │ │ │ └── columns: l_orderkey:11!null l_shipdate:21!null l_commitdate:22!null l_receiptdate:23!null l_shipmode:25!null - │ │ │ └── filters - │ │ │ ├── (l_receiptdate:23 >= '1994-01-01') AND (l_receiptdate:23 < '1995-01-01') [outer=(23), constraints=(/23: [/'1994-01-01' - /'1994-12-31']; tight)] - │ │ │ ├── l_shipmode:25 IN ('MAIL', 'SHIP') [outer=(25), constraints=(/25: [/'MAIL' - /'MAIL'] [/'SHIP' - /'SHIP']; tight)] - │ │ │ ├── l_commitdate:22 < l_receiptdate:23 [outer=(22,23), constraints=(/22: (/NULL - ]; /23: (/NULL - ])] - │ │ │ └── l_shipdate:21 < l_commitdate:22 [outer=(21,22), constraints=(/21: (/NULL - ]; /22: (/NULL - ])] - │ │ └── filters (true) - │ └── projections - │ ├── CASE WHEN (o_orderpriority:6 = '1-URGENT') OR (o_orderpriority:6 = '2-HIGH') THEN 1 ELSE 0 END [as=column28:28, outer=(6)] - │ └── CASE WHEN (o_orderpriority:6 != '1-URGENT') AND (o_orderpriority:6 != '2-HIGH') THEN 1 ELSE 0 END [as=column30:30, outer=(6)] - └── aggregations - ├── sum [as=sum:29, outer=(28)] - │ └── column28:28 - └── sum [as=sum:31, outer=(30)] - └── column30:30 + ├── sort + │ ├── columns: l_shipmode:25!null column28:28!null column30:30!null + │ ├── ordering: +25 + │ └── project + │ ├── columns: column28:28!null column30:30!null l_shipmode:25!null + │ ├── inner-join (lookup orders) + │ │ ├── columns: o_orderkey:1!null o_orderpriority:6!null l_orderkey:11!null l_shipdate:21!null l_commitdate:22!null l_receiptdate:23!null l_shipmode:25!null + │ │ ├── key columns: [11] = [1] + │ │ ├── lookup columns are key + │ │ ├── fd: (1)-->(6), (1)==(11), (11)==(1) + │ │ ├── select + │ │ │ ├── columns: l_orderkey:11!null l_shipdate:21!null l_commitdate:22!null l_receiptdate:23!null l_shipmode:25!null + │ │ │ ├── scan lineitem + │ │ │ │ └── columns: l_orderkey:11!null l_shipdate:21!null l_commitdate:22!null l_receiptdate:23!null l_shipmode:25!null + │ │ │ └── filters + │ │ │ ├── (l_receiptdate:23 >= '1994-01-01') AND (l_receiptdate:23 < '1995-01-01') [outer=(23), constraints=(/23: [/'1994-01-01' - /'1994-12-31']; tight)] + │ │ │ ├── l_shipmode:25 IN ('MAIL', 'SHIP') [outer=(25), constraints=(/25: [/'MAIL' - /'MAIL'] [/'SHIP' - /'SHIP']; tight)] + │ │ │ ├── l_commitdate:22 < l_receiptdate:23 [outer=(22,23), constraints=(/22: (/NULL - ]; /23: (/NULL - ])] + │ │ │ └── l_shipdate:21 < l_commitdate:22 [outer=(21,22), constraints=(/21: (/NULL - ]; /22: (/NULL - ])] + │ │ └── filters (true) + │ └── projections + │ ├── CASE WHEN (o_orderpriority:6 = '1-URGENT') OR (o_orderpriority:6 = '2-HIGH') THEN 1 ELSE 0 END [as=column28:28, outer=(6)] + │ └── CASE WHEN (o_orderpriority:6 != '1-URGENT') AND (o_orderpriority:6 != '2-HIGH') THEN 1 ELSE 0 END [as=column30:30, outer=(6)] + └── aggregations + ├── sum [as=sum:29, outer=(28)] + │ └── column28:28 + └── sum [as=sum:31, outer=(30)] + └── column30:30 # -------------------------------------------------- # Q13 @@ -2255,20 +2233,20 @@ limit │ ├── grouping columns: s_name:2!null │ ├── key: (2) │ ├── fd: (2)-->(75) - │ ├── inner-join (lookup nation) + │ ├── anti-join (lookup lineitem [as=l3]) │ │ ├── columns: s_suppkey:1!null s_name:2!null s_nationkey:4!null l1.l_orderkey:9!null l1.l_suppkey:11!null l1.l_commitdate:20!null l1.l_receiptdate:21!null o_orderkey:26!null o_orderstatus:28!null n_nationkey:36!null n_name:37!null - │ │ ├── key columns: [4] = [36] - │ │ ├── lookup columns are key + │ │ ├── key columns: [9] = [58] │ │ ├── fd: ()-->(28,37), (1)-->(2,4), (9)==(26), (26)==(9), (1)==(11), (11)==(1), (4)==(36), (36)==(4) - │ │ ├── inner-join (lookup supplier) - │ │ │ ├── columns: s_suppkey:1!null s_name:2!null s_nationkey:4!null l1.l_orderkey:9!null l1.l_suppkey:11!null l1.l_commitdate:20!null l1.l_receiptdate:21!null o_orderkey:26!null o_orderstatus:28!null - │ │ │ ├── key columns: [11] = [1] + │ │ ├── inner-join (lookup nation) + │ │ │ ├── columns: s_suppkey:1!null s_name:2!null s_nationkey:4!null l1.l_orderkey:9!null l1.l_suppkey:11!null l1.l_commitdate:20!null l1.l_receiptdate:21!null o_orderkey:26!null o_orderstatus:28!null n_nationkey:36!null n_name:37!null + │ │ │ ├── key columns: [4] = [36] │ │ │ ├── lookup columns are key - │ │ │ ├── fd: ()-->(28), (1)-->(2,4), (9)==(26), (26)==(9), (1)==(11), (11)==(1) - │ │ │ ├── anti-join (lookup lineitem [as=l3]) - │ │ │ │ ├── columns: l1.l_orderkey:9!null l1.l_suppkey:11!null l1.l_commitdate:20!null l1.l_receiptdate:21!null o_orderkey:26!null o_orderstatus:28!null - │ │ │ │ ├── key columns: [9] = [58] - │ │ │ │ ├── fd: ()-->(28), (9)==(26), (26)==(9) + │ │ │ ├── fd: ()-->(28,37), (1)-->(2,4), (4)==(36), (36)==(4), (1)==(11), (11)==(1), (9)==(26), (26)==(9) + │ │ │ ├── inner-join (lookup supplier) + │ │ │ │ ├── columns: s_suppkey:1!null s_name:2!null s_nationkey:4!null l1.l_orderkey:9!null l1.l_suppkey:11!null l1.l_commitdate:20!null l1.l_receiptdate:21!null o_orderkey:26!null o_orderstatus:28!null + │ │ │ │ ├── key columns: [11] = [1] + │ │ │ │ ├── lookup columns are key + │ │ │ │ ├── fd: ()-->(28), (1)-->(2,4), (9)==(26), (26)==(9), (1)==(11), (11)==(1) │ │ │ │ ├── semi-join (hash) │ │ │ │ │ ├── columns: l1.l_orderkey:9!null l1.l_suppkey:11!null l1.l_commitdate:20!null l1.l_receiptdate:21!null o_orderkey:26!null o_orderstatus:28!null │ │ │ │ │ ├── fd: ()-->(28), (9)==(26), (26)==(9) @@ -2293,12 +2271,12 @@ limit │ │ │ │ │ └── filters │ │ │ │ │ ├── l2.l_orderkey:41 = l1.l_orderkey:9 [outer=(9,41), constraints=(/9: (/NULL - ]; /41: (/NULL - ]), fd=(9)==(41), (41)==(9)] │ │ │ │ │ └── l2.l_suppkey:43 != l1.l_suppkey:11 [outer=(11,43), constraints=(/11: (/NULL - ]; /43: (/NULL - ])] - │ │ │ │ └── filters - │ │ │ │ ├── l3.l_suppkey:60 != l1.l_suppkey:11 [outer=(11,60), constraints=(/11: (/NULL - ]; /60: (/NULL - ])] - │ │ │ │ └── l3.l_receiptdate:70 > l3.l_commitdate:69 [outer=(69,70), constraints=(/69: (/NULL - ]; /70: (/NULL - ])] - │ │ │ └── filters (true) + │ │ │ │ └── filters (true) + │ │ │ └── filters + │ │ │ └── n_name:37 = 'SAUDI ARABIA' [outer=(37), constraints=(/37: [/'SAUDI ARABIA' - /'SAUDI ARABIA']; tight), fd=()-->(37)] │ │ └── filters - │ │ └── n_name:37 = 'SAUDI ARABIA' [outer=(37), constraints=(/37: [/'SAUDI ARABIA' - /'SAUDI ARABIA']; tight), fd=()-->(37)] + │ │ ├── l3.l_suppkey:60 != l1.l_suppkey:11 [outer=(11,60), constraints=(/11: (/NULL - ]; /60: (/NULL - ])] + │ │ └── l3.l_receiptdate:70 > l3.l_commitdate:69 [outer=(69,70), constraints=(/69: (/NULL - ]; /70: (/NULL - ])] │ └── aggregations │ └── count-rows [as=count_rows:75] └── 100 @@ -2352,67 +2330,68 @@ GROUP BY ORDER BY cntrycode; ---- -group-by +sort ├── columns: cntrycode:30 numcust:31!null totacctbal:32!null - ├── grouping columns: cntrycode:30 ├── immutable ├── key: (30) ├── fd: (30)-->(31,32) ├── ordering: +30 - ├── sort - │ ├── columns: c_acctbal:6!null cntrycode:30 - │ ├── immutable - │ ├── ordering: +30 - │ └── project - │ ├── columns: cntrycode:30 c_acctbal:6!null - │ ├── immutable - │ ├── anti-join (merge) - │ │ ├── columns: c_custkey:1!null c_phone:5!null c_acctbal:6!null - │ │ ├── left ordering: +1 - │ │ ├── right ordering: +21 - │ │ ├── immutable - │ │ ├── key: (1) - │ │ ├── fd: (1)-->(5,6) - │ │ ├── select - │ │ │ ├── columns: c_custkey:1!null c_phone:5!null c_acctbal:6!null - │ │ │ ├── immutable - │ │ │ ├── key: (1) - │ │ │ ├── fd: (1)-->(5,6) - │ │ │ ├── ordering: +1 - │ │ │ ├── scan customer - │ │ │ │ ├── columns: c_custkey:1!null c_phone:5!null c_acctbal:6!null - │ │ │ │ ├── key: (1) - │ │ │ │ ├── fd: (1)-->(5,6) - │ │ │ │ └── ordering: +1 - │ │ │ └── filters - │ │ │ ├── substring(c_phone:5, 1, 2) IN ('13', '17', '18', '23', '29', '30', '31') [outer=(5), immutable] - │ │ │ └── gt [outer=(6), immutable, subquery, constraints=(/6: (/NULL - ])] - │ │ │ ├── c_acctbal:6 - │ │ │ └── subquery - │ │ │ └── scalar-group-by - │ │ │ ├── columns: avg:19 - │ │ │ ├── cardinality: [1 - 1] - │ │ │ ├── immutable - │ │ │ ├── key: () - │ │ │ ├── fd: ()-->(19) - │ │ │ ├── select - │ │ │ │ ├── columns: c_phone:14!null c_acctbal:15!null - │ │ │ │ ├── immutable - │ │ │ │ ├── scan customer - │ │ │ │ │ └── columns: c_phone:14!null c_acctbal:15!null - │ │ │ │ └── filters - │ │ │ │ ├── c_acctbal:15 > 0.0 [outer=(15), constraints=(/15: [/5e-324 - ]; tight)] - │ │ │ │ └── substring(c_phone:14, 1, 2) IN ('13', '17', '18', '23', '29', '30', '31') [outer=(14), immutable] - │ │ │ └── aggregations - │ │ │ └── avg [as=avg:19, outer=(15)] - │ │ │ └── c_acctbal:15 - │ │ ├── scan orders@o_ck - │ │ │ ├── columns: o_custkey:21!null - │ │ │ └── ordering: +21 - │ │ └── filters (true) - │ └── projections - │ └── substring(c_phone:5, 1, 2) [as=cntrycode:30, outer=(5), immutable] - └── aggregations - ├── count-rows [as=count_rows:31] - └── sum [as=sum:32, outer=(6)] - └── c_acctbal:6 + └── group-by + ├── columns: cntrycode:30 count_rows:31!null sum:32!null + ├── grouping columns: cntrycode:30 + ├── immutable + ├── key: (30) + ├── fd: (30)-->(31,32) + ├── project + │ ├── columns: cntrycode:30 c_acctbal:6!null + │ ├── immutable + │ ├── anti-join (merge) + │ │ ├── columns: c_custkey:1!null c_phone:5!null c_acctbal:6!null + │ │ ├── left ordering: +1 + │ │ ├── right ordering: +21 + │ │ ├── immutable + │ │ ├── key: (1) + │ │ ├── fd: (1)-->(5,6) + │ │ ├── select + │ │ │ ├── columns: c_custkey:1!null c_phone:5!null c_acctbal:6!null + │ │ │ ├── immutable + │ │ │ ├── key: (1) + │ │ │ ├── fd: (1)-->(5,6) + │ │ │ ├── ordering: +1 + │ │ │ ├── scan customer + │ │ │ │ ├── columns: c_custkey:1!null c_phone:5!null c_acctbal:6!null + │ │ │ │ ├── key: (1) + │ │ │ │ ├── fd: (1)-->(5,6) + │ │ │ │ └── ordering: +1 + │ │ │ └── filters + │ │ │ ├── substring(c_phone:5, 1, 2) IN ('13', '17', '18', '23', '29', '30', '31') [outer=(5), immutable] + │ │ │ └── gt [outer=(6), immutable, subquery, constraints=(/6: (/NULL - ])] + │ │ │ ├── c_acctbal:6 + │ │ │ └── subquery + │ │ │ └── scalar-group-by + │ │ │ ├── columns: avg:19 + │ │ │ ├── cardinality: [1 - 1] + │ │ │ ├── immutable + │ │ │ ├── key: () + │ │ │ ├── fd: ()-->(19) + │ │ │ ├── select + │ │ │ │ ├── columns: c_phone:14!null c_acctbal:15!null + │ │ │ │ ├── immutable + │ │ │ │ ├── scan customer + │ │ │ │ │ └── columns: c_phone:14!null c_acctbal:15!null + │ │ │ │ └── filters + │ │ │ │ ├── c_acctbal:15 > 0.0 [outer=(15), constraints=(/15: [/5e-324 - ]; tight)] + │ │ │ │ └── substring(c_phone:14, 1, 2) IN ('13', '17', '18', '23', '29', '30', '31') [outer=(14), immutable] + │ │ │ └── aggregations + │ │ │ └── avg [as=avg:19, outer=(15)] + │ │ │ └── c_acctbal:15 + │ │ ├── scan orders@o_ck + │ │ │ ├── columns: o_custkey:21!null + │ │ │ └── ordering: +21 + │ │ └── filters (true) + │ └── projections + │ └── substring(c_phone:5, 1, 2) [as=cntrycode:30, outer=(5), immutable] + └── aggregations + ├── count-rows [as=count_rows:31] + └── sum [as=sum:32, outer=(6)] + └── c_acctbal:6 diff --git a/pkg/sql/opt/xform/testdata/external/trading b/pkg/sql/opt/xform/testdata/external/trading index a9d219550f2a..c5fae365daff 100644 --- a/pkg/sql/opt/xform/testdata/external/trading +++ b/pkg/sql/opt/xform/testdata/external/trading @@ -572,7 +572,7 @@ project │ └── scan cardsinfo@cardsinfoversionindex │ ├── columns: dealerid:8!null cardid:9!null version:16!null │ ├── constraint: /8/16: (/1/1584421773604892000.0000000000 - /1] - │ ├── stats: [rows=0.0201621426, distinct(8)=0.0201621426, null(8)=0, distinct(9)=0.0201621393, null(9)=0, distinct(16)=0.0201621426, null(16)=0, distinct(8,16)=0.0201621426, null(8,16)=0] + │ ├── stats: [rows=0.0201621426, distinct(8)=0.0201621426, null(8)=0, distinct(9)=0.0201621426, null(9)=0, distinct(16)=0.0201621426, null(16)=0, distinct(8,16)=0.0201621426, null(8,16)=0] │ │ histogram(16)= 0 0 0.020162 0 │ │ <--- 1584421773604892000.0000000000 ---------- 1584421778604892000 │ ├── key: (9) @@ -726,7 +726,7 @@ project │ │ │ └── scan transactiondetails@detailscardidindex,rev │ │ │ ├── columns: transactiondetails.dealerid:1!null transactiondetails.isbuy:2!null transactiondate:3!null cardid:4!null quantity:5!null │ │ │ ├── constraint: /1/2/4/3/5: [/1/false/21953 - /1/false/21953] - │ │ │ ├── stats: [rows=478.646617, distinct(1)=1, null(1)=0, distinct(2)=1, null(2)=0, distinct(3)=478.646617, null(3)=0, distinct(4)=1, null(4)=0, distinct(5)=478.640889, null(5)=0, distinct(1,2,4)=1, null(1,2,4)=0] + │ │ │ ├── stats: [rows=478.646617, distinct(1)=1, null(1)=0, distinct(2)=1, null(2)=0, distinct(3)=478.646617, null(3)=0, distinct(4)=1, null(4)=0, distinct(5)=478.646617, null(5)=0, distinct(1,2,4)=1, null(1,2,4)=0] │ │ │ ├── key: (3,5) │ │ │ ├── fd: ()-->(1,2,4) │ │ │ ├── ordering: -3 opt(1,2,4) [actual: -3] @@ -947,7 +947,7 @@ ORDER BY extract(day from d.TransactionDate) sort ├── columns: extract:41 totalsell:36!null totalbuy:38!null totalprofit:40!null ├── stable - ├── stats: [rows=750327.164, distinct(41)=750327.164, null(41)=0] + ├── stats: [rows=1171234.57, distinct(41)=1171234.57, null(41)=0] ├── key: (41) ├── fd: (41)-->(36,38,40) ├── ordering: +41 @@ -955,23 +955,23 @@ sort ├── columns: sum:36!null sum:38!null sum:40!null column41:41 ├── grouping columns: column41:41 ├── stable - ├── stats: [rows=750327.164, distinct(41)=750327.164, null(41)=0] + ├── stats: [rows=1171234.57, distinct(41)=1171234.57, null(41)=0] ├── key: (41) ├── fd: (41)-->(36,38,40) ├── project │ ├── columns: column35:35!null column37:37!null column39:39!null column41:41 │ ├── stable - │ ├── stats: [rows=1198631.87, distinct(41)=750327.164, null(41)=0] + │ ├── stats: [rows=1198631.87, distinct(41)=1171234.57, null(41)=0] │ ├── inner-join (hash) │ │ ├── columns: transactiondetails.dealerid:1!null transactiondetails.isbuy:2!null transactiondate:3!null transactiondetails.cardid:4!null quantity:5!null transactiondetails.sellprice:6!null transactiondetails.buyprice:7!null transactions.dealerid:10!null transactions.isbuy:11!null date:12!null accountname:13!null customername:14!null id:18!null cardsinfo.dealerid:25!null cardsinfo.cardid:26!null │ │ ├── multiplicity: left-rows(zero-or-one), right-rows(zero-or-more) - │ │ ├── stats: [rows=1198631.87, distinct(3)=750327.164, null(3)=0, distinct(4)=37420.3552, null(4)=0, distinct(18)=37420.3552, null(18)=0] + │ │ ├── stats: [rows=1198631.87, distinct(3)=1171234.57, null(3)=0, distinct(4)=37420.3552, null(4)=0, distinct(18)=37420.3552, null(18)=0] │ │ ├── key: (5,12,26) │ │ ├── fd: ()-->(1,2,10,11,25), (3-5)-->(6,7), (12)-->(13,14), (3)==(12), (12)==(3), (18)==(4,26), (26)==(4,18), (4)==(18,26) │ │ ├── inner-join (hash) │ │ │ ├── columns: transactiondetails.dealerid:1!null transactiondetails.isbuy:2!null transactiondate:3!null transactiondetails.cardid:4!null quantity:5!null transactiondetails.sellprice:6!null transactiondetails.buyprice:7!null transactions.dealerid:10!null transactions.isbuy:11!null date:12!null accountname:13!null customername:14!null │ │ │ ├── multiplicity: left-rows(zero-or-one), right-rows(zero-or-more) - │ │ │ ├── stats: [rows=1171234.57, distinct(1)=1, null(1)=0, distinct(2)=1, null(2)=0, distinct(3)=1171234.57, null(3)=0, distinct(4)=56999.9999, null(4)=0, distinct(5)=1091498.71, null(5)=0, distinct(6)=1091498.71, null(6)=0, distinct(7)=1091498.71, null(7)=0, distinct(10)=1, null(10)=0, distinct(11)=1, null(11)=0, distinct(12)=1171234.57, null(12)=0, distinct(13)=551608.449, null(13)=0, distinct(14)=551608.449, null(14)=0] + │ │ │ ├── stats: [rows=1171234.57, distinct(1)=1, null(1)=0, distinct(2)=1, null(2)=0, distinct(3)=1171234.57, null(3)=0, distinct(4)=57000, null(4)=0, distinct(5)=1171234.57, null(5)=0, distinct(6)=1171234.57, null(6)=0, distinct(7)=1171234.57, null(7)=0, distinct(10)=1, null(10)=0, distinct(11)=1, null(11)=0, distinct(12)=1171234.57, null(12)=0, distinct(13)=666666.667, null(13)=0, distinct(14)=666666.667, null(14)=0] │ │ │ ├── key: (4,5,12) │ │ │ ├── fd: ()-->(1,2,10,11), (3-5)-->(6,7), (12)-->(13,14), (3)==(12), (12)==(3) │ │ │ ├── scan transactiondetails diff --git a/pkg/sql/opt/xform/testdata/external/trading-mutation b/pkg/sql/opt/xform/testdata/external/trading-mutation index 66d8ef3defb8..6226c02fee9b 100644 --- a/pkg/sql/opt/xform/testdata/external/trading-mutation +++ b/pkg/sql/opt/xform/testdata/external/trading-mutation @@ -730,7 +730,7 @@ project │ │ │ └── scan transactiondetails@detailscardidindex,rev │ │ │ ├── columns: transactiondetails.dealerid:1!null transactiondetails.isbuy:2!null transactiondate:3!null cardid:4!null quantity:5!null │ │ │ ├── constraint: /1/2/4/3/5: [/1/false/21953 - /1/false/21953] - │ │ │ ├── stats: [rows=478.646617, distinct(1)=1, null(1)=0, distinct(2)=1, null(2)=0, distinct(3)=478.646617, null(3)=0, distinct(4)=1, null(4)=0, distinct(5)=478.640889, null(5)=0, distinct(1,2,4)=1, null(1,2,4)=0] + │ │ │ ├── stats: [rows=478.646617, distinct(1)=1, null(1)=0, distinct(2)=1, null(2)=0, distinct(3)=478.646617, null(3)=0, distinct(4)=1, null(4)=0, distinct(5)=478.646617, null(5)=0, distinct(1,2,4)=1, null(1,2,4)=0] │ │ │ ├── key: (3,5) │ │ │ ├── fd: ()-->(1,2,4) │ │ │ ├── ordering: -3 opt(1,2,4) [actual: -3] @@ -951,7 +951,7 @@ ORDER BY extract(day from d.TransactionDate) sort ├── columns: extract:49 totalsell:44!null totalbuy:46!null totalprofit:48!null ├── stable - ├── stats: [rows=750327.164, distinct(49)=750327.164, null(49)=0] + ├── stats: [rows=1171234.57, distinct(49)=1171234.57, null(49)=0] ├── key: (49) ├── fd: (49)-->(44,46,48) ├── ordering: +49 @@ -959,23 +959,23 @@ sort ├── columns: sum:44!null sum:46!null sum:48!null column49:49 ├── grouping columns: column49:49 ├── stable - ├── stats: [rows=750327.164, distinct(49)=750327.164, null(49)=0] + ├── stats: [rows=1171234.57, distinct(49)=1171234.57, null(49)=0] ├── key: (49) ├── fd: (49)-->(44,46,48) ├── project │ ├── columns: column43:43!null column45:45!null column47:47!null column49:49 │ ├── stable - │ ├── stats: [rows=1198631.87, distinct(49)=750327.164, null(49)=0] + │ ├── stats: [rows=1198631.87, distinct(49)=1171234.57, null(49)=0] │ ├── inner-join (hash) │ │ ├── columns: transactiondetails.dealerid:1!null transactiondetails.isbuy:2!null transactiondate:3!null transactiondetails.cardid:4!null quantity:5!null transactiondetails.sellprice:6!null transactiondetails.buyprice:7!null transactions.dealerid:12!null transactions.isbuy:13!null date:14!null accountname:15!null customername:16!null id:22!null cardsinfo.dealerid:29!null cardsinfo.cardid:30!null │ │ ├── multiplicity: left-rows(zero-or-one), right-rows(zero-or-more) - │ │ ├── stats: [rows=1198631.87, distinct(3)=750327.164, null(3)=0, distinct(4)=37420.3552, null(4)=0, distinct(22)=37420.3552, null(22)=0] + │ │ ├── stats: [rows=1198631.87, distinct(3)=1171234.57, null(3)=0, distinct(4)=37420.3552, null(4)=0, distinct(22)=37420.3552, null(22)=0] │ │ ├── key: (5,14,30) │ │ ├── fd: ()-->(1,2,12,13,29), (3-5)-->(6,7), (14)-->(15,16), (3)==(14), (14)==(3), (22)==(4,30), (30)==(4,22), (4)==(22,30) │ │ ├── inner-join (hash) │ │ │ ├── columns: transactiondetails.dealerid:1!null transactiondetails.isbuy:2!null transactiondate:3!null transactiondetails.cardid:4!null quantity:5!null transactiondetails.sellprice:6!null transactiondetails.buyprice:7!null transactions.dealerid:12!null transactions.isbuy:13!null date:14!null accountname:15!null customername:16!null │ │ │ ├── multiplicity: left-rows(zero-or-one), right-rows(zero-or-more) - │ │ │ ├── stats: [rows=1171234.57, distinct(1)=1, null(1)=0, distinct(2)=1, null(2)=0, distinct(3)=1171234.57, null(3)=0, distinct(4)=56999.9999, null(4)=0, distinct(5)=1091498.71, null(5)=0, distinct(6)=1091498.71, null(6)=0, distinct(7)=1091498.71, null(7)=0, distinct(12)=1, null(12)=0, distinct(13)=1, null(13)=0, distinct(14)=1171234.57, null(14)=0, distinct(15)=551608.449, null(15)=0, distinct(16)=551608.449, null(16)=0] + │ │ │ ├── stats: [rows=1171234.57, distinct(1)=1, null(1)=0, distinct(2)=1, null(2)=0, distinct(3)=1171234.57, null(3)=0, distinct(4)=57000, null(4)=0, distinct(5)=1171234.57, null(5)=0, distinct(6)=1171234.57, null(6)=0, distinct(7)=1171234.57, null(7)=0, distinct(12)=1, null(12)=0, distinct(13)=1, null(13)=0, distinct(14)=1171234.57, null(14)=0, distinct(15)=666666.667, null(15)=0, distinct(16)=666666.667, null(16)=0] │ │ │ ├── key: (4,5,14) │ │ │ ├── fd: ()-->(1,2,12,13), (3-5)-->(6,7), (14)-->(15,16), (3)==(14), (14)==(3) │ │ │ ├── scan transactiondetails diff --git a/pkg/sql/opt/xform/testdata/rules/select b/pkg/sql/opt/xform/testdata/rules/select index 0db6f19af852..30a3bde52045 100644 --- a/pkg/sql/opt/xform/testdata/rules/select +++ b/pkg/sql/opt/xform/testdata/rules/select @@ -250,7 +250,7 @@ memo (optimized, ~13KB, required=[presentation: i:1,f:2,s:3,b:4]) ├── G1: (select G2 G3) (index-join G4 p,cols=(1-4)) (index-join G5 p,cols=(1-4)) (index-join G6 p,cols=(1-4)) (index-join G7 p,cols=(1-4)) │ └── [presentation: i:1,f:2,s:3,b:4] │ ├── best: (index-join G4 p,cols=(1-4)) - │ └── cost: 49.00 + │ └── cost: 34.26 ├── G2: (scan p,cols=(1-4)) │ └── [] │ ├── best: (scan p,cols=(1-4)) @@ -1407,11 +1407,16 @@ SELECT * FROM p WHERE s = 'foo' AND i > 5 AND i < 10 index-join p ├── columns: i:1!null f:2 s:3!null b:4 ├── fd: ()-->(3) - └── scan p@idx,partial + └── select ├── columns: i:1!null rowid:5!null - ├── constraint: /1/5: [/6 - /9] ├── key: (5) - └── fd: (5)-->(1) + ├── fd: (5)-->(1) + ├── scan p@idx,partial + │ ├── columns: i:1 rowid:5!null + │ ├── key: (5) + │ └── fd: (5)-->(1) + └── filters + └── (i:1 > 5) AND (i:1 < 10) [outer=(1), constraints=(/1: [/6 - /9]; tight)] exec-ddl DROP INDEX idx @@ -1501,7 +1506,7 @@ memo (optimized, ~17KB, required=[presentation: i:1]) ├── G2: (select G6 G7) (select G8 G9) (index-join G4 p,cols=(1,3)) (select G10 G9) (index-join G5 p,cols=(1,3)) │ └── [] │ ├── best: (index-join G4 p,cols=(1,3)) - │ └── cost: 21.05 + │ └── cost: 16.43 ├── G3: (projections) ├── G4: (select G11 G9) │ └── [] @@ -1519,7 +1524,7 @@ memo (optimized, ~17KB, required=[presentation: i:1]) ├── G8: (index-join G14 p,cols=(1,3)) │ └── [] │ ├── best: (index-join G14 p,cols=(1,3)) - │ └── cost: 374.63 + │ └── cost: 373.86 ├── G9: (filters G12) ├── G10: (index-join G15 p,cols=(1,3)) │ └── [] @@ -4443,7 +4448,7 @@ memo (optimized, ~30KB, required=[presentation: p:1,q:2,r:3,s:4]) ├── G8: (index-join G19 pqr,cols=(1-4)) │ └── [] │ ├── best: (index-join G19 pqr,cols=(1-4)) - │ └── cost: 21.76 + │ └── cost: 14.74 ├── G9: (filters G14) ├── G10: (index-join G20 pqr,cols=(1-4)) │ └── []