github.com/cockroachdb/cockroach@v20.2.0-alpha.1+incompatible/pkg/sql/opt/memo/testdata/logprops/update (about)

     1  exec-ddl
     2  CREATE TABLE abcde (
     3      a INT NOT NULL,
     4      b INT,
     5      c INT NOT NULL DEFAULT (10),
     6      d INT AS (b + c + 1) STORED,
     7      "e:write-only" INT NOT NULL
     8  )
     9  ----
    10  
    11  exec-ddl
    12  CREATE TABLE xyz (
    13      x TEXT PRIMARY KEY,
    14      y INT8 NOT NULL,
    15      z FLOAT8
    16  )
    17  ----
    18  
    19  # Properties with no RETURNING clause.
    20  build
    21  UPDATE abcde SET b=10 WHERE a=1
    22  ----
    23  update abcde
    24   ├── columns: <none>
    25   ├── fetch columns: a:7(int) b:8(int) c:9(int) d:10(int) rowid:11(int) e:12(int)
    26   ├── update-mapping:
    27   │    ├── b_new:13 => b:2
    28   │    ├── column15:15 => d:4
    29   │    └── column14:14 => e:6
    30   ├── cardinality: [0 - 0]
    31   ├── volatile, side-effects, mutations
    32   └── project
    33        ├── columns: column15:15(int!null) a:7(int!null) b:8(int) c:9(int!null) d:10(int) rowid:11(int!null) e:12(int) b_new:13(int!null) column14:14(int!null)
    34        ├── key: (11)
    35        ├── fd: ()-->(7,13,14), (11)-->(8-10,12), (9)-->(15)
    36        ├── prune: (7-15)
    37        ├── interesting orderings: (+11)
    38        ├── project
    39        │    ├── columns: column14:14(int!null) a:7(int!null) b:8(int) c:9(int!null) d:10(int) rowid:11(int!null) e:12(int) b_new:13(int!null)
    40        │    ├── key: (11)
    41        │    ├── fd: ()-->(7,13,14), (11)-->(8-10,12)
    42        │    ├── prune: (7-14)
    43        │    ├── interesting orderings: (+11)
    44        │    ├── project
    45        │    │    ├── columns: b_new:13(int!null) a:7(int!null) b:8(int) c:9(int!null) d:10(int) rowid:11(int!null) e:12(int)
    46        │    │    ├── key: (11)
    47        │    │    ├── fd: ()-->(7,13), (11)-->(8-10,12)
    48        │    │    ├── prune: (7-13)
    49        │    │    ├── interesting orderings: (+11)
    50        │    │    ├── select
    51        │    │    │    ├── columns: a:7(int!null) b:8(int) c:9(int!null) d:10(int) rowid:11(int!null) e:12(int)
    52        │    │    │    ├── key: (11)
    53        │    │    │    ├── fd: ()-->(7), (11)-->(8-10,12)
    54        │    │    │    ├── prune: (8-12)
    55        │    │    │    ├── interesting orderings: (+11)
    56        │    │    │    ├── scan abcde
    57        │    │    │    │    ├── columns: a:7(int!null) b:8(int) c:9(int!null) d:10(int) rowid:11(int!null) e:12(int)
    58        │    │    │    │    ├── computed column expressions
    59        │    │    │    │    │    └── d:10
    60        │    │    │    │    │         └── plus [type=int]
    61        │    │    │    │    │              ├── plus [type=int]
    62        │    │    │    │    │              │    ├── variable: b:8 [type=int]
    63        │    │    │    │    │              │    └── variable: c:9 [type=int]
    64        │    │    │    │    │              └── const: 1 [type=int]
    65        │    │    │    │    ├── key: (11)
    66        │    │    │    │    ├── fd: (11)-->(7-10,12)
    67        │    │    │    │    ├── prune: (7-12)
    68        │    │    │    │    └── interesting orderings: (+11)
    69        │    │    │    └── filters
    70        │    │    │         └── eq [type=bool, outer=(7), constraints=(/7: [/1 - /1]; tight), fd=()-->(7)]
    71        │    │    │              ├── variable: a:7 [type=int]
    72        │    │    │              └── const: 1 [type=int]
    73        │    │    └── projections
    74        │    │         └── const: 10 [as=b_new:13, type=int]
    75        │    └── projections
    76        │         └── const: 0 [as=column14:14, type=int]
    77        └── projections
    78             └── plus [as=column15:15, type=int, outer=(9,13)]
    79                  ├── plus [type=int]
    80                  │    ├── variable: b_new:13 [type=int]
    81                  │    └── variable: c:9 [type=int]
    82                  └── const: 1 [type=int]
    83  
    84  # Properties with RETURNING clause.
    85  build
    86  UPDATE abcde SET b=10 WHERE a=1 RETURNING *
    87  ----
    88  project
    89   ├── columns: a:1(int!null) b:2(int!null) c:3(int!null) d:4(int!null)
    90   ├── volatile, side-effects, mutations
    91   ├── fd: ()-->(1,2), (3)-->(4)
    92   ├── prune: (1-4)
    93   └── update abcde
    94        ├── columns: a:1(int!null) b:2(int!null) c:3(int!null) d:4(int!null) rowid:5(int!null)
    95        ├── fetch columns: a:7(int) b:8(int) c:9(int) d:10(int) rowid:11(int) e:12(int)
    96        ├── update-mapping:
    97        │    ├── b_new:13 => b:2
    98        │    ├── column15:15 => d:4
    99        │    └── column14:14 => e:6
   100        ├── volatile, side-effects, mutations
   101        ├── key: (5)
   102        ├── fd: ()-->(1,2), (5)-->(3,4), (3)-->(4)
   103        └── project
   104             ├── columns: column15:15(int!null) a:7(int!null) b:8(int) c:9(int!null) d:10(int) rowid:11(int!null) e:12(int) b_new:13(int!null) column14:14(int!null)
   105             ├── key: (11)
   106             ├── fd: ()-->(7,13,14), (11)-->(8-10,12), (9)-->(15)
   107             ├── prune: (7-15)
   108             ├── interesting orderings: (+11)
   109             ├── project
   110             │    ├── columns: column14:14(int!null) a:7(int!null) b:8(int) c:9(int!null) d:10(int) rowid:11(int!null) e:12(int) b_new:13(int!null)
   111             │    ├── key: (11)
   112             │    ├── fd: ()-->(7,13,14), (11)-->(8-10,12)
   113             │    ├── prune: (7-14)
   114             │    ├── interesting orderings: (+11)
   115             │    ├── project
   116             │    │    ├── columns: b_new:13(int!null) a:7(int!null) b:8(int) c:9(int!null) d:10(int) rowid:11(int!null) e:12(int)
   117             │    │    ├── key: (11)
   118             │    │    ├── fd: ()-->(7,13), (11)-->(8-10,12)
   119             │    │    ├── prune: (7-13)
   120             │    │    ├── interesting orderings: (+11)
   121             │    │    ├── select
   122             │    │    │    ├── columns: a:7(int!null) b:8(int) c:9(int!null) d:10(int) rowid:11(int!null) e:12(int)
   123             │    │    │    ├── key: (11)
   124             │    │    │    ├── fd: ()-->(7), (11)-->(8-10,12)
   125             │    │    │    ├── prune: (8-12)
   126             │    │    │    ├── interesting orderings: (+11)
   127             │    │    │    ├── scan abcde
   128             │    │    │    │    ├── columns: a:7(int!null) b:8(int) c:9(int!null) d:10(int) rowid:11(int!null) e:12(int)
   129             │    │    │    │    ├── computed column expressions
   130             │    │    │    │    │    └── d:10
   131             │    │    │    │    │         └── plus [type=int]
   132             │    │    │    │    │              ├── plus [type=int]
   133             │    │    │    │    │              │    ├── variable: b:8 [type=int]
   134             │    │    │    │    │              │    └── variable: c:9 [type=int]
   135             │    │    │    │    │              └── const: 1 [type=int]
   136             │    │    │    │    ├── key: (11)
   137             │    │    │    │    ├── fd: (11)-->(7-10,12)
   138             │    │    │    │    ├── prune: (7-12)
   139             │    │    │    │    └── interesting orderings: (+11)
   140             │    │    │    └── filters
   141             │    │    │         └── eq [type=bool, outer=(7), constraints=(/7: [/1 - /1]; tight), fd=()-->(7)]
   142             │    │    │              ├── variable: a:7 [type=int]
   143             │    │    │              └── const: 1 [type=int]
   144             │    │    └── projections
   145             │    │         └── const: 10 [as=b_new:13, type=int]
   146             │    └── projections
   147             │         └── const: 0 [as=column14:14, type=int]
   148             └── projections
   149                  └── plus [as=column15:15, type=int, outer=(9,13)]
   150                       ├── plus [type=int]
   151                       │    ├── variable: b_new:13 [type=int]
   152                       │    └── variable: c:9 [type=int]
   153                       └── const: 1 [type=int]
   154  
   155  # Input is cardinality 0-1 expression.
   156  build
   157  UPDATE abcde SET b=10 WHERE rowid=1 RETURNING *
   158  ----
   159  project
   160   ├── columns: a:1(int!null) b:2(int!null) c:3(int!null) d:4(int!null)
   161   ├── cardinality: [0 - 1]
   162   ├── volatile, side-effects, mutations
   163   ├── key: ()
   164   ├── fd: ()-->(1-4)
   165   ├── prune: (1-4)
   166   └── update abcde
   167        ├── columns: a:1(int!null) b:2(int!null) c:3(int!null) d:4(int!null) rowid:5(int!null)
   168        ├── fetch columns: a:7(int) b:8(int) c:9(int) d:10(int) rowid:11(int) e:12(int)
   169        ├── update-mapping:
   170        │    ├── b_new:13 => b:2
   171        │    ├── column15:15 => d:4
   172        │    └── column14:14 => e:6
   173        ├── cardinality: [0 - 1]
   174        ├── volatile, side-effects, mutations
   175        ├── key: ()
   176        ├── fd: ()-->(1-5)
   177        └── project
   178             ├── columns: column15:15(int!null) a:7(int!null) b:8(int) c:9(int!null) d:10(int) rowid:11(int!null) e:12(int) b_new:13(int!null) column14:14(int!null)
   179             ├── cardinality: [0 - 1]
   180             ├── key: ()
   181             ├── fd: ()-->(7-15)
   182             ├── prune: (7-15)
   183             ├── interesting orderings: (+11)
   184             ├── project
   185             │    ├── columns: column14:14(int!null) a:7(int!null) b:8(int) c:9(int!null) d:10(int) rowid:11(int!null) e:12(int) b_new:13(int!null)
   186             │    ├── cardinality: [0 - 1]
   187             │    ├── key: ()
   188             │    ├── fd: ()-->(7-14)
   189             │    ├── prune: (7-14)
   190             │    ├── interesting orderings: (+11)
   191             │    ├── project
   192             │    │    ├── columns: b_new:13(int!null) a:7(int!null) b:8(int) c:9(int!null) d:10(int) rowid:11(int!null) e:12(int)
   193             │    │    ├── cardinality: [0 - 1]
   194             │    │    ├── key: ()
   195             │    │    ├── fd: ()-->(7-13)
   196             │    │    ├── prune: (7-13)
   197             │    │    ├── interesting orderings: (+11)
   198             │    │    ├── select
   199             │    │    │    ├── columns: a:7(int!null) b:8(int) c:9(int!null) d:10(int) rowid:11(int!null) e:12(int)
   200             │    │    │    ├── cardinality: [0 - 1]
   201             │    │    │    ├── key: ()
   202             │    │    │    ├── fd: ()-->(7-12)
   203             │    │    │    ├── prune: (7-10,12)
   204             │    │    │    ├── interesting orderings: (+11)
   205             │    │    │    ├── scan abcde
   206             │    │    │    │    ├── columns: a:7(int!null) b:8(int) c:9(int!null) d:10(int) rowid:11(int!null) e:12(int)
   207             │    │    │    │    ├── computed column expressions
   208             │    │    │    │    │    └── d:10
   209             │    │    │    │    │         └── plus [type=int]
   210             │    │    │    │    │              ├── plus [type=int]
   211             │    │    │    │    │              │    ├── variable: b:8 [type=int]
   212             │    │    │    │    │              │    └── variable: c:9 [type=int]
   213             │    │    │    │    │              └── const: 1 [type=int]
   214             │    │    │    │    ├── key: (11)
   215             │    │    │    │    ├── fd: (11)-->(7-10,12)
   216             │    │    │    │    ├── prune: (7-12)
   217             │    │    │    │    └── interesting orderings: (+11)
   218             │    │    │    └── filters
   219             │    │    │         └── eq [type=bool, outer=(11), constraints=(/11: [/1 - /1]; tight), fd=()-->(11)]
   220             │    │    │              ├── variable: rowid:11 [type=int]
   221             │    │    │              └── const: 1 [type=int]
   222             │    │    └── projections
   223             │    │         └── const: 10 [as=b_new:13, type=int]
   224             │    └── projections
   225             │         └── const: 0 [as=column14:14, type=int]
   226             └── projections
   227                  └── plus [as=column15:15, type=int, outer=(9,13)]
   228                       ├── plus [type=int]
   229                       │    ├── variable: b_new:13 [type=int]
   230                       │    └── variable: c:9 [type=int]
   231                       └── const: 1 [type=int]
   232  
   233  # Filter FD set.
   234  build
   235  UPDATE abcde SET a=1 WHERE b=c RETURNING *;
   236  ----
   237  project
   238   ├── columns: a:1(int!null) b:2(int!null) c:3(int!null) d:4(int!null)
   239   ├── volatile, side-effects, mutations
   240   ├── fd: ()-->(1), (2)==(3), (3)==(2), (2)-->(4)
   241   ├── prune: (1-4)
   242   └── update abcde
   243        ├── columns: a:1(int!null) b:2(int!null) c:3(int!null) d:4(int!null) rowid:5(int!null)
   244        ├── fetch columns: a:7(int) b:8(int) c:9(int) d:10(int) rowid:11(int) e:12(int)
   245        ├── update-mapping:
   246        │    ├── a_new:13 => a:1
   247        │    ├── column15:15 => d:4
   248        │    └── column14:14 => e:6
   249        ├── volatile, side-effects, mutations
   250        ├── key: (5)
   251        ├── fd: ()-->(1), (2)==(3), (3)==(2), (5)-->(2-4), (2)-->(4)
   252        └── project
   253             ├── columns: column15:15(int!null) a:7(int!null) b:8(int!null) c:9(int!null) d:10(int) rowid:11(int!null) e:12(int) a_new:13(int!null) column14:14(int!null)
   254             ├── key: (11)
   255             ├── fd: ()-->(13,14), (11)-->(7-10,12), (8)==(9), (9)==(8), (8,9)-->(15)
   256             ├── prune: (7-15)
   257             ├── interesting orderings: (+11)
   258             ├── project
   259             │    ├── columns: column14:14(int!null) a:7(int!null) b:8(int!null) c:9(int!null) d:10(int) rowid:11(int!null) e:12(int) a_new:13(int!null)
   260             │    ├── key: (11)
   261             │    ├── fd: ()-->(13,14), (11)-->(7-10,12), (8)==(9), (9)==(8)
   262             │    ├── prune: (7-14)
   263             │    ├── interesting orderings: (+11)
   264             │    ├── project
   265             │    │    ├── columns: a_new:13(int!null) a:7(int!null) b:8(int!null) c:9(int!null) d:10(int) rowid:11(int!null) e:12(int)
   266             │    │    ├── key: (11)
   267             │    │    ├── fd: ()-->(13), (11)-->(7-10,12), (8)==(9), (9)==(8)
   268             │    │    ├── prune: (7-13)
   269             │    │    ├── interesting orderings: (+11)
   270             │    │    ├── select
   271             │    │    │    ├── columns: a:7(int!null) b:8(int!null) c:9(int!null) d:10(int) rowid:11(int!null) e:12(int)
   272             │    │    │    ├── key: (11)
   273             │    │    │    ├── fd: (11)-->(7-10,12), (8)==(9), (9)==(8)
   274             │    │    │    ├── prune: (7,10-12)
   275             │    │    │    ├── interesting orderings: (+11)
   276             │    │    │    ├── scan abcde
   277             │    │    │    │    ├── columns: a:7(int!null) b:8(int) c:9(int!null) d:10(int) rowid:11(int!null) e:12(int)
   278             │    │    │    │    ├── computed column expressions
   279             │    │    │    │    │    └── d:10
   280             │    │    │    │    │         └── plus [type=int]
   281             │    │    │    │    │              ├── plus [type=int]
   282             │    │    │    │    │              │    ├── variable: b:8 [type=int]
   283             │    │    │    │    │              │    └── variable: c:9 [type=int]
   284             │    │    │    │    │              └── const: 1 [type=int]
   285             │    │    │    │    ├── key: (11)
   286             │    │    │    │    ├── fd: (11)-->(7-10,12)
   287             │    │    │    │    ├── prune: (7-12)
   288             │    │    │    │    └── interesting orderings: (+11)
   289             │    │    │    └── filters
   290             │    │    │         └── eq [type=bool, outer=(8,9), constraints=(/8: (/NULL - ]; /9: (/NULL - ]), fd=(8)==(9), (9)==(8)]
   291             │    │    │              ├── variable: b:8 [type=int]
   292             │    │    │              └── variable: c:9 [type=int]
   293             │    │    └── projections
   294             │    │         └── const: 1 [as=a_new:13, type=int]
   295             │    └── projections
   296             │         └── const: 0 [as=column14:14, type=int]
   297             └── projections
   298                  └── plus [as=column15:15, type=int, outer=(8,9)]
   299                       ├── plus [type=int]
   300                       │    ├── variable: b:8 [type=int]
   301                       │    └── variable: c:9 [type=int]
   302                       └── const: 1 [type=int]