Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

opt: add one-time cost for all operators #32616

Merged
merged 1 commit into from
Nov 27, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pkg/sql/opt/exec/execbuilder/testdata/explain
Original file line number Diff line number Diff line change
Expand Up @@ -588,14 +588,14 @@ project
├── columns: r:1(int!null)
├── cardinality: [1 - 1]
├── stats: [rows=1]
├── cost: 0.03
├── cost: 0.05
├── key: ()
├── fd: ()-->(1)
├── prune: (1)
├── values
│ ├── cardinality: [1 - 1]
│ ├── stats: [rows=1]
│ ├── cost: 0.01
│ ├── cost: 0.02
│ ├── key: ()
│ └── tuple [type=tuple]
└── projections
Expand Down
20 changes: 10 additions & 10 deletions pkg/sql/opt/memo/testdata/logprops/constraints
Original file line number Diff line number Diff line change
Expand Up @@ -700,7 +700,7 @@ scan c@v
├── columns: k:1(int!null) u:2(int!null) v:3(int!null)
├── constraint: /3/2/1: [/1/2 - /1/4]
├── stats: [rows=0.29403, distinct(1)=0.29403, null(1)=0, distinct(2)=0.29403, null(2)=0, distinct(3)=0.29403, null(3)=0]
├── cost: 0.3116718
├── cost: 0.3216718
├── key: (1)
├── fd: ()-->(3), (1)-->(2)
├── prune: (1)
Expand All @@ -713,7 +713,7 @@ scan c@v
├── columns: k:1(int!null) u:2(int!null) v:3(int!null)
├── constraint: /3/2/1: [/1/2 - /1/2] [/3/2 - /3/2] [/5/2 - /5/2]
├── stats: [rows=0.29403, distinct(1)=0.29403, null(1)=0, distinct(2)=0.29403, null(2)=0, distinct(3)=0.29403, null(3)=0]
├── cost: 0.3116718
├── cost: 0.3216718
├── key: (1)
├── fd: ()-->(2), (1)-->(3)
├── prune: (1)
Expand All @@ -726,7 +726,7 @@ scan c@v
├── columns: k:1(int!null) u:2(int!null) v:3(int!null)
├── constraint: /3/2/1: [/1/2 - /1/2]
├── stats: [rows=0.09801, distinct(1)=0.09801, null(1)=0, distinct(2)=0.09801, null(2)=0, distinct(3)=0.09801, null(3)=0]
├── cost: 0.1038906
├── cost: 0.1138906
├── key: (1)
├── fd: ()-->(2,3)
├── prune: (1)
Expand All @@ -739,7 +739,7 @@ scan c@v
├── columns: k:1(int!null) u:2(int!null) v:3(int!null)
├── constraint: /3/2/1: [/1/2 - /1/4]
├── stats: [rows=0.29403, distinct(1)=0.29403, null(1)=0, distinct(2)=0.29403, null(2)=0, distinct(3)=0.29403, null(3)=0]
├── cost: 0.3116718
├── cost: 0.3216718
├── key: (1)
├── fd: ()-->(3), (1)-->(2)
├── prune: (1)
Expand All @@ -752,7 +752,7 @@ scan c@v
├── columns: k:1(int!null) u:2(int!null) v:3(int!null)
├── constraint: /3/2/1: [/1/2 - /1/2] [/3/2 - /3/2] [/5/2 - /5/2]
├── stats: [rows=0.29403, distinct(1)=0.29403, null(1)=0, distinct(2)=0.29403, null(2)=0, distinct(3)=0.29403, null(3)=0]
├── cost: 0.3116718
├── cost: 0.3216718
├── key: (1)
├── fd: ()-->(2), (1)-->(3)
├── prune: (1)
Expand All @@ -765,7 +765,7 @@ scan c@v
├── columns: k:1(int!null) u:2(int!null) v:3(int!null)
├── constraint: /3/2/1: [/1/2 - /1/2]
├── stats: [rows=0.09801, distinct(1)=0.09801, null(1)=0, distinct(2)=0.09801, null(2)=0, distinct(3)=0.09801, null(3)=0]
├── cost: 0.1038906
├── cost: 0.1138906
├── key: (1)
├── fd: ()-->(2,3)
├── prune: (1)
Expand Down Expand Up @@ -905,15 +905,15 @@ SELECT * FROM d WHERE (p, q) IN ((1, 2), (1, 3), (1, 4))
select
├── columns: k:1(int!null) p:2(int!null) q:3(int!null)
├── stats: [rows=0.29403, distinct(1)=0.29403, null(1)=0, distinct(2)=0.29403, null(2)=0, distinct(3)=0.29403, null(3)=0]
├── cost: 1070
├── cost: 1070.02
├── key: (1)
├── fd: ()-->(2), (1)-->(3)
├── prune: (1)
├── interesting orderings: (+1)
├── scan d
│ ├── columns: k:1(int!null) p:2(int) q:3(int)
│ ├── stats: [rows=1000, distinct(1)=1000, null(1)=0, distinct(2)=100, null(2)=10, distinct(3)=100, null(3)=10]
│ ├── cost: 1060
│ ├── cost: 1060.01
│ ├── key: (1)
│ ├── fd: (1)-->(2,3)
│ ├── prune: (1-3)
Expand All @@ -940,15 +940,15 @@ SELECT * FROM d WHERE (p, q) IN ((2, 1), (3, 1), (4, 1))
select
├── columns: k:1(int!null) p:2(int!null) q:3(int!null)
├── stats: [rows=0.29403, distinct(1)=0.29403, null(1)=0, distinct(2)=0.29403, null(2)=0, distinct(3)=0.29403, null(3)=0]
├── cost: 1070
├── cost: 1070.02
├── key: (1)
├── fd: ()-->(3), (1)-->(2)
├── prune: (1)
├── interesting orderings: (+1)
├── scan d
│ ├── columns: k:1(int!null) p:2(int) q:3(int)
│ ├── stats: [rows=1000, distinct(1)=1000, null(1)=0, distinct(2)=100, null(2)=10, distinct(3)=100, null(3)=10]
│ ├── cost: 1060
│ ├── cost: 1060.01
│ ├── key: (1)
│ ├── fd: (1)-->(2,3)
│ ├── prune: (1-3)
Expand Down
80 changes: 40 additions & 40 deletions pkg/sql/opt/memo/testdata/memo
Original file line number Diff line number Diff line change
Expand Up @@ -134,64 +134,64 @@ memo (optimized, ~15KB, required=[presentation: y:2,x:3,c:6] [ordering: +2])
├── G1: (project G2 G3 y x)
│ ├── [presentation: y:2,x:3,c:6] [ordering: +2]
│ │ ├── best: (project G2="[ordering: +2]" G3 y x)
│ │ └── cost: 2170.29
│ │ └── cost: 2170.37
│ └── []
│ ├── best: (project G2 G3 y x)
│ └── cost: 2170.29
│ └── cost: 2170.37
├── G2: (limit G4 G5 ordering=+2)
│ ├── [ordering: +2]
│ │ ├── best: (limit G4="[ordering: +2]" G5 ordering=+2)
│ │ └── cost: 2170.09
│ │ └── cost: 2170.16
│ └── []
│ ├── best: (limit G4="[ordering: +2]" G5 ordering=+2)
│ └── cost: 2170.09
│ └── cost: 2170.16
├── G3: (projections G6)
├── G4: (inner-join G7 G8 G9) (inner-join G8 G7 G9) (lookup-join G7 G10 b,keyCols=[5],outCols=(2,3,5)) (merge-join G8 G7 G10 inner-join,+3,+5)
│ ├── [ordering: +2]
│ │ ├── best: (sort G4)
│ │ └── cost: 2169.99
│ │ └── cost: 2170.05
│ └── []
│ ├── best: (inner-join G8 G7 G9)
│ └── cost: 2108.17
│ └── cost: 2108.22
├── G5: (const 10)
├── G6: (plus G11 G12)
├── G7: (project G13 G14 y)
│ ├── [ordering: +2]
│ │ ├── best: (sort G7)
│ │ └── cost: 1118.42
│ │ └── cost: 1118.46
│ ├── [ordering: +5]
│ │ ├── best: (sort G7)
│ │ └── cost: 1118.42
│ │ └── cost: 1118.46
│ └── []
│ ├── best: (project G13 G14 y)
│ └── cost: 1056.60
│ └── cost: 1056.63
├── G8: (scan b,cols=(3))
│ ├── [ordering: +3]
│ │ ├── best: (scan b,cols=(3))
│ │ └── cost: 1030.00
│ │ └── cost: 1030.01
│ └── []
│ ├── best: (scan b,cols=(3))
│ └── cost: 1030.00
│ └── cost: 1030.01
├── G9: (filters G15)
├── G10: (filters)
├── G11: (variable y)
├── G12: (const 1)
├── G13: (select G16 G17)
│ ├── [ordering: +2]
│ │ ├── best: (sort G13)
│ │ └── cost: 1111.82
│ │ └── cost: 1111.85
│ └── []
│ ├── best: (select G16 G17)
│ └── cost: 1050.00
│ └── cost: 1050.02
├── G14: (projections G18)
├── G15: (eq G19 G20)
├── G16: (scan a)
│ ├── [ordering: +2]
│ │ ├── best: (sort G16)
│ │ └── cost: 1259.32
│ │ └── cost: 1259.34
│ └── []
│ ├── best: (scan a)
│ └── cost: 1040.00
│ └── cost: 1040.01
├── G17: (filters G21)
├── G18: (cast G22 STRING)
├── G19: (variable column5)
Expand All @@ -209,16 +209,16 @@ memo (optimized, ~3KB, required=[presentation: a:3,b:4,c:5,d:6])
├── G1: (project G2 G3)
│ └── [presentation: a:3,b:4,c:5,d:6]
│ ├── best: (project G2 G3)
│ └── cost: 1050.17
│ └── cost: 1050.20
├── G2: (select G4 G5)
│ └── []
│ ├── best: (select G4 G5)
│ └── cost: 1050.00
│ └── cost: 1050.02
├── G3: (projections G6 G7 G8 G9)
├── G4: (scan b)
│ └── []
│ ├── best: (scan b)
│ └── cost: 1040.00
│ └── cost: 1040.01
├── G5: (filters G10 G11)
├── G6: (const 1)
├── G7: (plus G12 G13)
Expand All @@ -244,21 +244,21 @@ memo (optimized, ~4KB, required=[presentation: x:1])
├── G1: (project G2 G3 x)
│ └── [presentation: x:1]
│ ├── best: (project G2 G3 x)
│ └── cost: 1.05
│ └── cost: 1.08
├── G2: (select G4 G5) (select G6 G7)
│ └── []
│ ├── best: (select G6 G7)
│ └── cost: 1.05
│ └── cost: 1.07
├── G3: (projections)
├── G4: (scan a)
│ └── []
│ ├── best: (scan a)
│ └── cost: 1040.00
│ └── cost: 1040.01
├── G5: (filters G8 G9)
├── G6: (scan a,constrained)
│ └── []
│ ├── best: (scan a,constrained)
│ └── cost: 1.04
│ └── cost: 1.05
├── G7: (filters G9)
├── G8: (eq G10 G11)
├── G9: (eq G12 G11)
Expand All @@ -274,19 +274,19 @@ memo (optimized, ~4KB, required=[presentation: x:7,y:8])
├── G1: (union G2 G3)
│ └── [presentation: x:7,y:8]
│ ├── best: (union G2 G3)
│ └── cost: 2149.80
│ └── cost: 2149.84
├── G2: (scan a)
│ └── []
│ ├── best: (scan a)
│ └── cost: 1040.00
│ └── cost: 1040.01
├── G3: (project G4 G5)
│ └── []
│ ├── best: (project G4 G5)
│ └── cost: 1070.00
│ └── cost: 1070.02
├── G4: (scan a)
│ └── []
│ ├── best: (scan a)
│ └── cost: 1040.00
│ └── cost: 1040.01
├── G5: (projections G6 G7)
├── G6: (plus G8 G9)
├── G7: (plus G10 G9)
Expand All @@ -301,11 +301,11 @@ memo (optimized, ~3KB, required=[presentation: array_agg:3])
├── G1: (scalar-group-by G2 G3 cols=())
│ └── [presentation: array_agg:3]
│ ├── best: (scalar-group-by G2 G3 cols=())
│ └── cost: 1040.01
│ └── cost: 1040.03
├── G2: (scan a,cols=(1))
│ └── []
│ ├── best: (scan a,cols=(1))
│ └── cost: 1030.00
│ └── cost: 1030.01
├── G3: (aggregations G4)
├── G4: (array-agg G5)
└── G5: (variable x)
Expand All @@ -317,16 +317,16 @@ memo (optimized, ~3KB, required=[presentation: array_agg:3])
├── G1: (project G2 G3 array_agg)
│ └── [presentation: array_agg:3]
│ ├── best: (project G2 G3 array_agg)
│ └── cost: 1072.00
│ └── cost: 1072.03
├── G2: (group-by G4 G5 cols=(2))
│ └── []
│ ├── best: (group-by G4 G5 cols=(2))
│ └── cost: 1071.00
│ └── cost: 1071.02
├── G3: (projections)
├── G4: (scan a)
│ └── []
│ ├── best: (scan a)
│ └── cost: 1040.00
│ └── cost: 1040.01
├── G5: (aggregations G6)
├── G6: (array-agg G7)
└── G7: (variable x)
Expand All @@ -338,14 +338,14 @@ memo (optimized, ~2KB, required=[presentation: array_agg:3])
├── G1: (scalar-group-by G2 G3 cols=(),ordering=+2)
│ └── [presentation: array_agg:3]
│ ├── best: (scalar-group-by G2="[ordering: +2]" G3 cols=(),ordering=+2)
│ └── cost: 1269.33
│ └── cost: 1269.36
├── G2: (scan a)
│ ├── [ordering: +2]
│ │ ├── best: (sort G2)
│ │ └── cost: 1259.32
│ │ └── cost: 1259.34
│ └── []
│ ├── best: (scan a)
│ └── cost: 1040.00
│ └── cost: 1040.01
├── G3: (aggregations G4)
├── G4: (array-agg G5)
└── G5: (variable x)
Expand All @@ -357,20 +357,20 @@ memo (optimized, ~4KB, required=[presentation: field:3])
├── G1: (distinct-on G2 G3 cols=(3))
│ └── [presentation: field:3]
│ ├── best: (distinct-on G2 G3 cols=(3))
│ └── cost: 0.03
│ └── cost: 0.07
├── G2: (explain G4 [presentation: k:1])
│ └── []
│ ├── best: (explain G4="[presentation: k:1]" [presentation: k:1])
│ └── cost: 0.03
│ └── cost: 0.06
├── G3: (aggregations)
├── G4: (project G5 G6)
│ └── [presentation: k:1]
│ ├── best: (project G5 G6)
│ └── cost: 0.03
│ └── cost: 0.05
├── G5: (values G7)
│ └── []
│ ├── best: (values G7)
│ └── cost: 0.01
│ └── cost: 0.02
├── G6: (projections G8)
├── G7: (scalar-list G9)
├── G8: (const 123)
Expand All @@ -384,9 +384,9 @@ memo (optimized, ~2KB, required=[presentation: tag:4])
├── G1: (distinct-on G2 G3 cols=(4))
│ └── [presentation: tag:4]
│ ├── best: (distinct-on G2 G3 cols=(4))
│ └── cost: 0.00
│ └── cost: 0.02
├── G2: (show-trace-for-session &{TRACE false [1 2 3 4 5 6 7]})
│ └── []
│ ├── best: (show-trace-for-session &{TRACE false [1 2 3 4 5 6 7]})
│ └── cost: 0.00
│ └── cost: 0.01
└── G3: (aggregations)
Loading