github.com/cockroachdb/cockroach@v20.2.0-alpha.1+incompatible/pkg/sql/opt/memo/testdata/logprops/srfs (about) 1 exec-ddl 2 CREATE TABLE xy (x INT PRIMARY KEY, y INT) 3 ---- 4 5 exec-ddl 6 CREATE TABLE uv (u INT, v INT NOT NULL) 7 ---- 8 9 opt 10 SELECT generate_series(0,1) FROM (SELECT * FROM xy LIMIT 0) 11 ---- 12 project-set 13 ├── columns: generate_series:3(int) 14 ├── cardinality: [0 - 0] 15 ├── immutable, side-effects 16 ├── values 17 │ ├── cardinality: [0 - 0] 18 │ └── key: () 19 └── zip 20 └── function: generate_series [type=int, immutable, side-effects] 21 ├── const: 0 [type=int] 22 └── const: 1 [type=int] 23 24 opt 25 SELECT (SELECT unnest(ARRAY[1,2,y,v]) FROM xy WHERE x = u) FROM uv 26 ---- 27 project 28 ├── columns: unnest:7(int) 29 ├── prune: (7) 30 ├── ensure-distinct-on 31 │ ├── columns: rowid:3(int!null) unnest:6(int) 32 │ ├── grouping columns: rowid:3(int!null) 33 │ ├── error: "more than one row returned by a subquery used as an expression" 34 │ ├── key: (3) 35 │ ├── fd: (3)-->(6) 36 │ ├── prune: (6) 37 │ ├── left-join-apply 38 │ │ ├── columns: u:1(int) v:2(int!null) rowid:3(int!null) x:4(int) y:5(int) unnest:6(int) 39 │ │ ├── fd: (3)-->(1,2) 40 │ │ ├── prune: (3,6) 41 │ │ ├── reject-nulls: (4-6) 42 │ │ ├── interesting orderings: (+3) (+4) 43 │ │ ├── scan uv 44 │ │ │ ├── columns: u:1(int) v:2(int!null) rowid:3(int!null) 45 │ │ │ ├── key: (3) 46 │ │ │ ├── fd: (3)-->(1,2) 47 │ │ │ ├── prune: (1-3) 48 │ │ │ └── interesting orderings: (+3) 49 │ │ ├── inner-join-apply 50 │ │ │ ├── columns: x:4(int!null) y:5(int) unnest:6(int) 51 │ │ │ ├── outer: (1,2) 52 │ │ │ ├── cardinality: [0 - 4] 53 │ │ │ ├── fd: ()-->(4,5) 54 │ │ │ ├── prune: (6) 55 │ │ │ ├── interesting orderings: (+4) 56 │ │ │ ├── select 57 │ │ │ │ ├── columns: x:4(int!null) y:5(int) 58 │ │ │ │ ├── outer: (1) 59 │ │ │ │ ├── cardinality: [0 - 1] 60 │ │ │ │ ├── key: () 61 │ │ │ │ ├── fd: ()-->(4,5) 62 │ │ │ │ ├── prune: (5) 63 │ │ │ │ ├── interesting orderings: (+4) 64 │ │ │ │ ├── scan xy 65 │ │ │ │ │ ├── columns: x:4(int!null) y:5(int) 66 │ │ │ │ │ ├── key: (4) 67 │ │ │ │ │ ├── fd: (4)-->(5) 68 │ │ │ │ │ ├── prune: (4,5) 69 │ │ │ │ │ └── interesting orderings: (+4) 70 │ │ │ │ └── filters 71 │ │ │ │ └── eq [type=bool, outer=(1,4), constraints=(/1: (/NULL - ]; /4: (/NULL - ]), fd=(1)==(4), (4)==(1)] 72 │ │ │ │ ├── variable: x:4 [type=int] 73 │ │ │ │ └── variable: u:1 [type=int] 74 │ │ │ ├── values 75 │ │ │ │ ├── columns: unnest:6(int) 76 │ │ │ │ ├── outer: (2,5) 77 │ │ │ │ ├── cardinality: [4 - 4] 78 │ │ │ │ ├── prune: (6) 79 │ │ │ │ ├── tuple [type=tuple{int}] 80 │ │ │ │ │ └── const: 1 [type=int] 81 │ │ │ │ ├── tuple [type=tuple{int}] 82 │ │ │ │ │ └── const: 2 [type=int] 83 │ │ │ │ ├── tuple [type=tuple{int}] 84 │ │ │ │ │ └── variable: y:5 [type=int] 85 │ │ │ │ └── tuple [type=tuple{int}] 86 │ │ │ │ └── variable: v:2 [type=int] 87 │ │ │ └── filters (true) 88 │ │ └── filters (true) 89 │ └── aggregations 90 │ └── const-agg [as=unnest:6, type=int, outer=(6)] 91 │ └── variable: unnest:6 [type=int] 92 └── projections 93 └── variable: unnest:6 [as=unnest:7, type=int, outer=(6)]