github.com/cockroachdb/cockroach@v20.2.0-alpha.1+incompatible/pkg/sql/opt/memo/testdata/format (about) 1 exec-ddl 2 CREATE TABLE t (a INT, b INT, k INT PRIMARY KEY) 3 ---- 4 5 opt format=show-all 6 SELECT a + 1, min(b) FROM t WHERE k + a > b GROUP BY a ORDER BY a 7 ---- 8 sort 9 ├── columns: "?column?":5(int) min:4(int!null) [hidden: t.public.t.a:1(int)] 10 ├── stats: [rows=98.1771622] 11 ├── cost: 1097.87224 12 ├── key: (1) 13 ├── fd: (1)-->(4,5) 14 ├── ordering: +1 15 ├── prune: (1,4,5) 16 └── project 17 ├── columns: "?column?":5(int) t.public.t.a:1(int) min:4(int!null) 18 ├── stats: [rows=98.1771622] 19 ├── cost: 1082.90531 20 ├── key: (1) 21 ├── fd: (1)-->(4,5) 22 ├── prune: (1,4,5) 23 ├── group-by 24 │ ├── columns: t.public.t.a:1(int) min:4(int!null) 25 │ ├── grouping columns: t.public.t.a:1(int) 26 │ ├── stats: [rows=98.1771622, distinct(1)=98.1771622, null(1)=1] 27 │ ├── cost: 1080.93177 28 │ ├── key: (1) 29 │ ├── fd: (1)-->(4) 30 │ ├── prune: (4) 31 │ ├── select 32 │ │ ├── columns: t.public.t.a:1(int) t.public.t.b:2(int!null) t.public.t.k:3(int!null) 33 │ │ ├── stats: [rows=330, distinct(1)=98.1771622, null(1)=3.3, distinct(2)=100, null(2)=0] 34 │ │ ├── cost: 1070.03 35 │ │ ├── key: (3) 36 │ │ ├── fd: (3)-->(1,2) 37 │ │ ├── interesting orderings: (+3) 38 │ │ ├── scan t.public.t 39 │ │ │ ├── columns: t.public.t.a:1(int) t.public.t.b:2(int) t.public.t.k:3(int!null) 40 │ │ │ ├── stats: [rows=1000, distinct(1)=100, null(1)=10, distinct(2)=100, null(2)=10] 41 │ │ │ ├── cost: 1060.02 42 │ │ │ ├── key: (3) 43 │ │ │ ├── fd: (3)-->(1,2) 44 │ │ │ ├── prune: (1-3) 45 │ │ │ └── interesting orderings: (+3) 46 │ │ └── filters 47 │ │ └── lt [type=bool, outer=(1-3), constraints=(/2: (/NULL - ])] 48 │ │ ├── variable: t.public.t.b:2 [type=int] 49 │ │ └── plus [type=int] 50 │ │ ├── variable: t.public.t.k:3 [type=int] 51 │ │ └── variable: t.public.t.a:1 [type=int] 52 │ └── aggregations 53 │ └── min [as=min:4, type=int, outer=(2)] 54 │ └── variable: t.public.t.b:2 [type=int] 55 └── projections 56 └── plus [as="?column?":5, type=int, outer=(1)] 57 ├── variable: t.public.t.a:1 [type=int] 58 └── const: 1 [type=int] 59 60 opt format=(hide-miscprops,hide-constraints,hide-funcdeps,hide-ruleprops) 61 SELECT a + 1, min(b) FROM t WHERE k + a > b GROUP BY a ORDER BY a 62 ---- 63 sort 64 ├── columns: "?column?":5(int) min:4(int!null) [hidden: t.public.t.a:1(int)] 65 ├── stats: [rows=98.1771622] 66 ├── cost: 1097.87224 67 ├── ordering: +1 68 └── project 69 ├── columns: "?column?":5(int) t.public.t.a:1(int) min:4(int!null) 70 ├── stats: [rows=98.1771622] 71 ├── cost: 1082.90531 72 ├── group-by 73 │ ├── columns: t.public.t.a:1(int) min:4(int!null) 74 │ ├── grouping columns: t.public.t.a:1(int) 75 │ ├── stats: [rows=98.1771622, distinct(1)=98.1771622, null(1)=1] 76 │ ├── cost: 1080.93177 77 │ ├── select 78 │ │ ├── columns: t.public.t.a:1(int) t.public.t.b:2(int!null) t.public.t.k:3(int!null) 79 │ │ ├── stats: [rows=330, distinct(1)=98.1771622, null(1)=3.3, distinct(2)=100, null(2)=0] 80 │ │ ├── cost: 1070.03 81 │ │ ├── scan t.public.t 82 │ │ │ ├── columns: t.public.t.a:1(int) t.public.t.b:2(int) t.public.t.k:3(int!null) 83 │ │ │ ├── stats: [rows=1000, distinct(1)=100, null(1)=10, distinct(2)=100, null(2)=10] 84 │ │ │ └── cost: 1060.02 85 │ │ └── filters 86 │ │ └── lt [type=bool] 87 │ │ ├── variable: t.public.t.b:2 [type=int] 88 │ │ └── plus [type=int] 89 │ │ ├── variable: t.public.t.k:3 [type=int] 90 │ │ └── variable: t.public.t.a:1 [type=int] 91 │ └── aggregations 92 │ └── min [as=min:4, type=int] 93 │ └── variable: t.public.t.b:2 [type=int] 94 └── projections 95 └── plus [as="?column?":5, type=int] 96 ├── variable: t.public.t.a:1 [type=int] 97 └── const: 1 [type=int] 98 99 opt format=(hide-stats,hide-cost,hide-qual,hide-scalars) 100 SELECT a + 1, min(b) FROM t WHERE k + a > b GROUP BY a ORDER BY a 101 ---- 102 sort 103 ├── columns: "?column?":5(int) min:4(int!null) [hidden: a:1(int)] 104 ├── key: (1) 105 ├── fd: (1)-->(4,5) 106 ├── ordering: +1 107 ├── prune: (1,4,5) 108 └── project 109 ├── columns: "?column?":5(int) a:1(int) min:4(int!null) 110 ├── key: (1) 111 ├── fd: (1)-->(4,5) 112 ├── prune: (1,4,5) 113 ├── group-by 114 │ ├── columns: a:1(int) min:4(int!null) 115 │ ├── grouping columns: a:1(int) 116 │ ├── key: (1) 117 │ ├── fd: (1)-->(4) 118 │ ├── prune: (4) 119 │ ├── select 120 │ │ ├── columns: a:1(int) b:2(int!null) k:3(int!null) 121 │ │ ├── key: (3) 122 │ │ ├── fd: (3)-->(1,2) 123 │ │ ├── interesting orderings: (+3) 124 │ │ ├── scan t 125 │ │ │ ├── columns: a:1(int) b:2(int) k:3(int!null) 126 │ │ │ ├── key: (3) 127 │ │ │ ├── fd: (3)-->(1,2) 128 │ │ │ ├── prune: (1-3) 129 │ │ │ └── interesting orderings: (+3) 130 │ │ └── filters 131 │ │ └── b:2 < (k:3 + a:1) [type=bool, outer=(1-3), constraints=(/2: (/NULL - ])] 132 │ └── aggregations 133 │ └── min [as=min:4, type=int, outer=(2)] 134 │ └── b:2 [type=int] 135 └── projections 136 └── a:1 + 1 [as="?column?":5, type=int, outer=(1)] 137 138 opt format=(hide-stats,hide-cost,hide-qual,hide-scalars,hide-types) 139 SELECT a + 1, min(b) FROM t WHERE k + a > b GROUP BY a ORDER BY a 140 ---- 141 sort 142 ├── columns: "?column?":5 min:4!null [hidden: a:1] 143 ├── key: (1) 144 ├── fd: (1)-->(4,5) 145 ├── ordering: +1 146 ├── prune: (1,4,5) 147 └── project 148 ├── columns: "?column?":5 a:1 min:4!null 149 ├── key: (1) 150 ├── fd: (1)-->(4,5) 151 ├── prune: (1,4,5) 152 ├── group-by 153 │ ├── columns: a:1 min:4!null 154 │ ├── grouping columns: a:1 155 │ ├── key: (1) 156 │ ├── fd: (1)-->(4) 157 │ ├── prune: (4) 158 │ ├── select 159 │ │ ├── columns: a:1 b:2!null k:3!null 160 │ │ ├── key: (3) 161 │ │ ├── fd: (3)-->(1,2) 162 │ │ ├── interesting orderings: (+3) 163 │ │ ├── scan t 164 │ │ │ ├── columns: a:1 b:2 k:3!null 165 │ │ │ ├── key: (3) 166 │ │ │ ├── fd: (3)-->(1,2) 167 │ │ │ ├── prune: (1-3) 168 │ │ │ └── interesting orderings: (+3) 169 │ │ └── filters 170 │ │ └── b:2 < (k:3 + a:1) [outer=(1-3), constraints=(/2: (/NULL - ])] 171 │ └── aggregations 172 │ └── min [as=min:4, outer=(2)] 173 │ └── b:2 174 └── projections 175 └── a:1 + 1 [as="?column?":5, outer=(1)] 176 177 opt format=(hide-stats,hide-cost,hide-qual,hide-scalars,hide-notnull) 178 SELECT a + 1, min(b) FROM t WHERE k + a > b GROUP BY a ORDER BY a 179 ---- 180 sort 181 ├── columns: "?column?":5(int) min:4(int) [hidden: a:1(int)] 182 ├── key: (1) 183 ├── fd: (1)-->(4,5) 184 ├── ordering: +1 185 ├── prune: (1,4,5) 186 └── project 187 ├── columns: "?column?":5(int) a:1(int) min:4(int) 188 ├── key: (1) 189 ├── fd: (1)-->(4,5) 190 ├── prune: (1,4,5) 191 ├── group-by 192 │ ├── columns: a:1(int) min:4(int) 193 │ ├── grouping columns: a:1(int) 194 │ ├── key: (1) 195 │ ├── fd: (1)-->(4) 196 │ ├── prune: (4) 197 │ ├── select 198 │ │ ├── columns: a:1(int) b:2(int) k:3(int) 199 │ │ ├── key: (3) 200 │ │ ├── fd: (3)-->(1,2) 201 │ │ ├── interesting orderings: (+3) 202 │ │ ├── scan t 203 │ │ │ ├── columns: a:1(int) b:2(int) k:3(int) 204 │ │ │ ├── key: (3) 205 │ │ │ ├── fd: (3)-->(1,2) 206 │ │ │ ├── prune: (1-3) 207 │ │ │ └── interesting orderings: (+3) 208 │ │ └── filters 209 │ │ └── b:2 < (k:3 + a:1) [type=bool, outer=(1-3), constraints=(/2: (/NULL - ])] 210 │ └── aggregations 211 │ └── min [as=min:4, type=int, outer=(2)] 212 │ └── b:2 [type=int] 213 └── projections 214 └── a:1 + 1 [as="?column?":5, type=int, outer=(1)] 215 216 opt format=(hide-stats,hide-cost,hide-qual,hide-scalars,hide-types,hide-notnull) 217 SELECT a + 1, min(b) FROM t WHERE k + a > b GROUP BY a ORDER BY a 218 ---- 219 sort 220 ├── columns: "?column?":5 min:4 [hidden: a:1] 221 ├── key: (1) 222 ├── fd: (1)-->(4,5) 223 ├── ordering: +1 224 ├── prune: (1,4,5) 225 └── project 226 ├── columns: "?column?":5 a:1 min:4 227 ├── key: (1) 228 ├── fd: (1)-->(4,5) 229 ├── prune: (1,4,5) 230 ├── group-by 231 │ ├── columns: a:1 min:4 232 │ ├── grouping columns: a:1 233 │ ├── key: (1) 234 │ ├── fd: (1)-->(4) 235 │ ├── prune: (4) 236 │ ├── select 237 │ │ ├── columns: a:1 b:2 k:3 238 │ │ ├── key: (3) 239 │ │ ├── fd: (3)-->(1,2) 240 │ │ ├── interesting orderings: (+3) 241 │ │ ├── scan t 242 │ │ │ ├── columns: a:1 b:2 k:3 243 │ │ │ ├── key: (3) 244 │ │ │ ├── fd: (3)-->(1,2) 245 │ │ │ ├── prune: (1-3) 246 │ │ │ └── interesting orderings: (+3) 247 │ │ └── filters 248 │ │ └── b:2 < (k:3 + a:1) [outer=(1-3), constraints=(/2: (/NULL - ])] 249 │ └── aggregations 250 │ └── min [as=min:4, outer=(2)] 251 │ └── b:2 252 └── projections 253 └── a:1 + 1 [as="?column?":5, outer=(1)] 254 255 opt format=(hide-miscprops,hide-physprops,hide-columns) 256 SELECT a + 1, min(b) FROM t WHERE k + a > b GROUP BY a ORDER BY a 257 ---- 258 sort 259 ├── stats: [rows=98.1771622] 260 ├── cost: 1097.87224 261 ├── key: (1) 262 ├── fd: (1)-->(4,5) 263 ├── prune: (1,4,5) 264 └── project 265 ├── stats: [rows=98.1771622] 266 ├── cost: 1082.90531 267 ├── key: (1) 268 ├── fd: (1)-->(4,5) 269 ├── prune: (1,4,5) 270 ├── group-by 271 │ ├── stats: [rows=98.1771622, distinct(1)=98.1771622, null(1)=1] 272 │ ├── cost: 1080.93177 273 │ ├── key: (1) 274 │ ├── fd: (1)-->(4) 275 │ ├── prune: (4) 276 │ ├── select 277 │ │ ├── stats: [rows=330, distinct(1)=98.1771622, null(1)=3.3, distinct(2)=100, null(2)=0] 278 │ │ ├── cost: 1070.03 279 │ │ ├── key: (3) 280 │ │ ├── fd: (3)-->(1,2) 281 │ │ ├── interesting orderings: (+3) 282 │ │ ├── scan t.public.t 283 │ │ │ ├── stats: [rows=1000, distinct(1)=100, null(1)=10, distinct(2)=100, null(2)=10] 284 │ │ │ ├── cost: 1060.02 285 │ │ │ ├── key: (3) 286 │ │ │ ├── fd: (3)-->(1,2) 287 │ │ │ ├── prune: (1-3) 288 │ │ │ └── interesting orderings: (+3) 289 │ │ └── filters 290 │ │ └── lt [type=bool, constraints=(/2: (/NULL - ])] 291 │ │ ├── variable: t.public.t.b [type=int] 292 │ │ └── plus [type=int] 293 │ │ ├── variable: t.public.t.k [type=int] 294 │ │ └── variable: t.public.t.a [type=int] 295 │ └── aggregations 296 │ └── min [type=int] 297 │ └── variable: t.public.t.b [type=int] 298 └── projections 299 └── plus [type=int] 300 ├── variable: t.public.t.a [type=int] 301 └── const: 1 [type=int] 302 303 opt format=hide-all 304 SELECT a + 1, min(b) FROM t WHERE k + a > b GROUP BY a ORDER BY a 305 ---- 306 sort 307 └── project 308 ├── group-by 309 │ ├── select 310 │ │ ├── scan t 311 │ │ └── filters 312 │ │ └── b < (k + a) 313 │ └── aggregations 314 │ └── min 315 │ └── b 316 └── projections 317 └── a + 1