exec-ddl
CREATE TABLE a (
    k INT PRIMARY KEY,
    i INT,
    f FLOAT,
    s STRING,
    j JSON,
    UNIQUE INDEX (s DESC, f) STORING (j)
)
----

exec-ddl
CREATE TABLE t.xy (x INT PRIMARY KEY, y INT)
----

# --------------------------------------------------
# Use optsteps.
# --------------------------------------------------
optsteps
SELECT s FROM a INNER JOIN xy ON a.k=xy.x AND i+1=10
----
================================================================================
Initial expression
  Cost: 15601.37
================================================================================
  project
   ├── columns: s:4
   ├── immutable
   └── inner-join (cross)
        ├── columns: k:1!null i:2 f:3 s:4 j:5 a.crdb_internal_mvcc_timestamp:6 a.tableoid:7 x:8!null y:9 xy.crdb_internal_mvcc_timestamp:10 xy.tableoid:11
        ├── immutable
        ├── key: (1,8)
        ├── fd: (1)-->(2-7), (3,4)~~>(1,2,5-7), (8)-->(9-11)
        ├── scan a
        │    ├── columns: k:1!null i:2 f:3 s:4 j:5 a.crdb_internal_mvcc_timestamp:6 a.tableoid:7
        │    ├── key: (1)
        │    └── fd: (1)-->(2-7), (3,4)~~>(1,2,5-7)
        ├── scan xy
        │    ├── columns: x:8!null y:9 xy.crdb_internal_mvcc_timestamp:10 xy.tableoid:11
        │    ├── key: (8)
        │    └── fd: (8)-->(9-11)
        └── filters
             └── (k:1 = x:8) AND ((i:2 + 1) = 10) [outer=(1,2,8), immutable, constraints=(/1: (/NULL - ]; /8: (/NULL - ])]
================================================================================
NormalizeCmpPlusConst
  Cost: 12301.37
================================================================================
   project
    ├── columns: s:4
  - ├── immutable
    └── inner-join (cross)
  -      ├── columns: k:1!null i:2 f:3 s:4 j:5 a.crdb_internal_mvcc_timestamp:6 a.tableoid:7 x:8!null y:9 xy.crdb_internal_mvcc_timestamp:10 xy.tableoid:11
  -      ├── immutable
  +      ├── columns: k:1!null i:2!null f:3 s:4 j:5 a.crdb_internal_mvcc_timestamp:6 a.tableoid:7 x:8!null y:9 xy.crdb_internal_mvcc_timestamp:10 xy.tableoid:11
         ├── key: (1,8)
  -      ├── fd: (1)-->(2-7), (3,4)~~>(1,2,5-7), (8)-->(9-11)
  +      ├── fd: ()-->(2), (1)-->(3-7), (3,4)~~>(1,5-7), (8)-->(9-11)
         ├── scan a
         │    ├── columns: k:1!null i:2 f:3 s:4 j:5 a.crdb_internal_mvcc_timestamp:6 a.tableoid:7
         │    ├── key: (1)
         │    └── fd: (1)-->(2-7), (3,4)~~>(1,2,5-7)
         ├── scan xy
         │    ├── columns: x:8!null y:9 xy.crdb_internal_mvcc_timestamp:10 xy.tableoid:11
         │    ├── key: (8)
         │    └── fd: (8)-->(9-11)
         └── filters
  -           └── (k:1 = x:8) AND ((i:2 + 1) = 10) [outer=(1,2,8), immutable, constraints=(/1: (/NULL - ]; /8: (/NULL - ])]
  +           └── (k:1 = x:8) AND (i:2 = 9) [outer=(1,2,8), constraints=(/1: (/NULL - ]; /2: [/9 - /9]; /8: (/NULL - ]), fd=()-->(2)]
================================================================================
SimplifyJoinFilters
  Cost: 2278.14
================================================================================
   project
    ├── columns: s:4
  - └── inner-join (cross)
  + └── inner-join (hash)
         ├── columns: k:1!null i:2!null f:3 s:4 j:5 a.crdb_internal_mvcc_timestamp:6 a.tableoid:7 x:8!null y:9 xy.crdb_internal_mvcc_timestamp:10 xy.tableoid:11
  -      ├── key: (1,8)
  -      ├── fd: ()-->(2), (1)-->(3-7), (3,4)~~>(1,5-7), (8)-->(9-11)
  +      ├── multiplicity: left-rows(zero-or-one), right-rows(zero-or-one)
  +      ├── key: (8)
  +      ├── fd: ()-->(2), (1)-->(3-7), (3,4)~~>(1,5-7), (8)-->(9-11), (1)==(8), (8)==(1)
         ├── scan a
         │    ├── columns: k:1!null i:2 f:3 s:4 j:5 a.crdb_internal_mvcc_timestamp:6 a.tableoid:7
         │    ├── key: (1)
         │    └── fd: (1)-->(2-7), (3,4)~~>(1,2,5-7)
         ├── scan xy
         │    ├── columns: x:8!null y:9 xy.crdb_internal_mvcc_timestamp:10 xy.tableoid:11
         │    ├── key: (8)
         │    └── fd: (8)-->(9-11)
         └── filters
  -           └── (k:1 = x:8) AND (i:2 = 9) [outer=(1,2,8), constraints=(/1: (/NULL - ]; /2: [/9 - /9]; /8: (/NULL - ]), fd=()-->(2)]
  +           ├── k:1 = x:8 [outer=(1,8), constraints=(/1: (/NULL - ]; /8: (/NULL - ]), fd=(1)==(8), (8)==(1)]
  +           └── i:2 = 9 [outer=(2), constraints=(/2: [/9 - /9]; tight), fd=()-->(2)]
================================================================================
PushFilterIntoJoinLeft
  Cost: 2265.88
================================================================================
   project
    ├── columns: s:4
    └── inner-join (hash)
         ├── columns: k:1!null i:2!null f:3 s:4 j:5 a.crdb_internal_mvcc_timestamp:6 a.tableoid:7 x:8!null y:9 xy.crdb_internal_mvcc_timestamp:10 xy.tableoid:11
         ├── multiplicity: left-rows(zero-or-one), right-rows(zero-or-one)
         ├── key: (8)
         ├── fd: ()-->(2), (1)-->(3-7), (3,4)~~>(1,5-7), (8)-->(9-11), (1)==(8), (8)==(1)
  -      ├── scan a
  -      │    ├── columns: k:1!null i:2 f:3 s:4 j:5 a.crdb_internal_mvcc_timestamp:6 a.tableoid:7
  +      ├── select
  +      │    ├── columns: k:1!null i:2!null f:3 s:4 j:5 a.crdb_internal_mvcc_timestamp:6 a.tableoid:7
         │    ├── key: (1)
  -      │    └── fd: (1)-->(2-7), (3,4)~~>(1,2,5-7)
  +      │    ├── fd: ()-->(2), (1)-->(3-7), (3,4)~~>(1,5-7)
  +      │    ├── scan a
  +      │    │    ├── columns: k:1!null i:2 f:3 s:4 j:5 a.crdb_internal_mvcc_timestamp:6 a.tableoid:7
  +      │    │    ├── key: (1)
  +      │    │    └── fd: (1)-->(2-7), (3,4)~~>(1,2,5-7)
  +      │    └── filters
  +      │         └── i:2 = 9 [outer=(2), constraints=(/2: [/9 - /9]; tight), fd=()-->(2)]
         ├── scan xy
         │    ├── columns: x:8!null y:9 xy.crdb_internal_mvcc_timestamp:10 xy.tableoid:11
         │    ├── key: (8)
         │    └── fd: (8)-->(9-11)
         └── filters
  -           ├── k:1 = x:8 [outer=(1,8), constraints=(/1: (/NULL - ]; /8: (/NULL - ]), fd=(1)==(8), (8)==(1)]
  -           └── i:2 = 9 [outer=(2), constraints=(/2: [/9 - /9]; tight), fd=()-->(2)]
  +           └── k:1 = x:8 [outer=(1,8), constraints=(/1: (/NULL - ]; /8: (/NULL - ]), fd=(1)==(8), (8)==(1)]
================================================================================
PruneJoinLeftCols
  Cost: 2266.00
================================================================================
   project
    ├── columns: s:4
    └── inner-join (hash)
  -      ├── columns: k:1!null i:2!null f:3 s:4 j:5 a.crdb_internal_mvcc_timestamp:6 a.tableoid:7 x:8!null y:9 xy.crdb_internal_mvcc_timestamp:10 xy.tableoid:11
  +      ├── columns: k:1!null i:2!null s:4 x:8!null y:9 xy.crdb_internal_mvcc_timestamp:10 xy.tableoid:11
         ├── multiplicity: left-rows(zero-or-one), right-rows(zero-or-one)
         ├── key: (8)
  -      ├── fd: ()-->(2), (1)-->(3-7), (3,4)~~>(1,5-7), (8)-->(9-11), (1)==(8), (8)==(1)
  -      ├── select
  -      │    ├── columns: k:1!null i:2!null f:3 s:4 j:5 a.crdb_internal_mvcc_timestamp:6 a.tableoid:7
  +      ├── fd: ()-->(2), (1)-->(4), (8)-->(9-11), (1)==(8), (8)==(1)
  +      ├── project
  +      │    ├── columns: k:1!null i:2!null s:4
         │    ├── key: (1)
  -      │    ├── fd: ()-->(2), (1)-->(3-7), (3,4)~~>(1,5-7)
  -      │    ├── scan a
  -      │    │    ├── columns: k:1!null i:2 f:3 s:4 j:5 a.crdb_internal_mvcc_timestamp:6 a.tableoid:7
  -      │    │    ├── key: (1)
  -      │    │    └── fd: (1)-->(2-7), (3,4)~~>(1,2,5-7)
  -      │    └── filters
  -      │         └── i:2 = 9 [outer=(2), constraints=(/2: [/9 - /9]; tight), fd=()-->(2)]
  +      │    ├── fd: ()-->(2), (1)-->(4)
  +      │    └── select
  +      │         ├── columns: k:1!null i:2!null f:3 s:4 j:5 a.crdb_internal_mvcc_timestamp:6 a.tableoid:7
  +      │         ├── key: (1)
  +      │         ├── fd: ()-->(2), (1)-->(3-7), (3,4)~~>(1,5-7)
  +      │         ├── scan a
  +      │         │    ├── columns: k:1!null i:2 f:3 s:4 j:5 a.crdb_internal_mvcc_timestamp:6 a.tableoid:7
  +      │         │    ├── key: (1)
  +      │         │    └── fd: (1)-->(2-7), (3,4)~~>(1,2,5-7)
  +      │         └── filters
  +      │              └── i:2 = 9 [outer=(2), constraints=(/2: [/9 - /9]; tight), fd=()-->(2)]
         ├── scan xy
         │    ├── columns: x:8!null y:9 xy.crdb_internal_mvcc_timestamp:10 xy.tableoid:11
         │    ├── key: (8)
         │    └── fd: (8)-->(9-11)
         └── filters
              └── k:1 = x:8 [outer=(1,8), constraints=(/1: (/NULL - ]; /8: (/NULL - ]), fd=(1)==(8), (8)==(1)]
================================================================================
PruneSelectCols
  Cost: 2225.60
================================================================================
   project
    ├── columns: s:4
    └── inner-join (hash)
         ├── columns: k:1!null i:2!null s:4 x:8!null y:9 xy.crdb_internal_mvcc_timestamp:10 xy.tableoid:11
         ├── multiplicity: left-rows(zero-or-one), right-rows(zero-or-one)
         ├── key: (8)
         ├── fd: ()-->(2), (1)-->(4), (8)-->(9-11), (1)==(8), (8)==(1)
         ├── project
         │    ├── columns: k:1!null i:2!null s:4
         │    ├── key: (1)
         │    ├── fd: ()-->(2), (1)-->(4)
         │    └── select
  -      │         ├── columns: k:1!null i:2!null f:3 s:4 j:5 a.crdb_internal_mvcc_timestamp:6 a.tableoid:7
  +      │         ├── columns: k:1!null i:2!null s:4
         │         ├── key: (1)
  -      │         ├── fd: ()-->(2), (1)-->(3-7), (3,4)~~>(1,5-7)
  +      │         ├── fd: ()-->(2), (1)-->(4)
         │         ├── scan a
  -      │         │    ├── columns: k:1!null i:2 f:3 s:4 j:5 a.crdb_internal_mvcc_timestamp:6 a.tableoid:7
  +      │         │    ├── columns: k:1!null i:2 s:4
         │         │    ├── key: (1)
  -      │         │    └── fd: (1)-->(2-7), (3,4)~~>(1,2,5-7)
  +      │         │    └── fd: (1)-->(2,4)
         │         └── filters
         │              └── i:2 = 9 [outer=(2), constraints=(/2: [/9 - /9]; tight), fd=()-->(2)]
         ├── scan xy
         │    ├── columns: x:8!null y:9 xy.crdb_internal_mvcc_timestamp:10 xy.tableoid:11
         │    ├── key: (8)
         │    └── fd: (8)-->(9-11)
         └── filters
              └── k:1 = x:8 [outer=(1,8), constraints=(/1: (/NULL - ]; /8: (/NULL - ]), fd=(1)==(8), (8)==(1)]
================================================================================
EliminateProject
  Cost: 2225.48
================================================================================
   project
    ├── columns: s:4
    └── inner-join (hash)
         ├── columns: k:1!null i:2!null s:4 x:8!null y:9 xy.crdb_internal_mvcc_timestamp:10 xy.tableoid:11
         ├── multiplicity: left-rows(zero-or-one), right-rows(zero-or-one)
         ├── key: (8)
         ├── fd: ()-->(2), (1)-->(4), (8)-->(9-11), (1)==(8), (8)==(1)
  -      ├── project
  +      ├── select
         │    ├── columns: k:1!null i:2!null s:4
         │    ├── key: (1)
         │    ├── fd: ()-->(2), (1)-->(4)
  -      │    └── select
  -      │         ├── columns: k:1!null i:2!null s:4
  -      │         ├── key: (1)
  -      │         ├── fd: ()-->(2), (1)-->(4)
  -      │         ├── scan a
  -      │         │    ├── columns: k:1!null i:2 s:4
  -      │         │    ├── key: (1)
  -      │         │    └── fd: (1)-->(2,4)
  -      │         └── filters
  -      │              └── i:2 = 9 [outer=(2), constraints=(/2: [/9 - /9]; tight), fd=()-->(2)]
  +      │    ├── scan a
  +      │    │    ├── columns: k:1!null i:2 s:4
  +      │    │    ├── key: (1)
  +      │    │    └── fd: (1)-->(2,4)
  +      │    └── filters
  +      │         └── i:2 = 9 [outer=(2), constraints=(/2: [/9 - /9]; tight), fd=()-->(2)]
         ├── scan xy
         │    ├── columns: x:8!null y:9 xy.crdb_internal_mvcc_timestamp:10 xy.tableoid:11
         │    ├── key: (8)
         │    └── fd: (8)-->(9-11)
         └── filters
              └── k:1 = x:8 [outer=(1,8), constraints=(/1: (/NULL - ]; /8: (/NULL - ]), fd=(1)==(8), (8)==(1)]
================================================================================
PruneJoinRightCols
  Cost: 2195.18
================================================================================
   project
    ├── columns: s:4
    └── inner-join (hash)
  -      ├── columns: k:1!null i:2!null s:4 x:8!null y:9 xy.crdb_internal_mvcc_timestamp:10 xy.tableoid:11
  +      ├── columns: k:1!null i:2!null s:4 x:8!null
         ├── multiplicity: left-rows(zero-or-one), right-rows(zero-or-one)
         ├── key: (8)
  -      ├── fd: ()-->(2), (1)-->(4), (8)-->(9-11), (1)==(8), (8)==(1)
  +      ├── fd: ()-->(2), (1)-->(4), (1)==(8), (8)==(1)
         ├── select
         │    ├── columns: k:1!null i:2!null s:4
         │    ├── key: (1)
         │    ├── fd: ()-->(2), (1)-->(4)
         │    ├── scan a
         │    │    ├── columns: k:1!null i:2 s:4
         │    │    ├── key: (1)
         │    │    └── fd: (1)-->(2,4)
         │    └── filters
         │         └── i:2 = 9 [outer=(2), constraints=(/2: [/9 - /9]; tight), fd=()-->(2)]
         ├── scan xy
  -      │    ├── columns: x:8!null y:9 xy.crdb_internal_mvcc_timestamp:10 xy.tableoid:11
  -      │    ├── key: (8)
  -      │    └── fd: (8)-->(9-11)
  +      │    ├── columns: x:8!null
  +      │    └── key: (8)
         └── filters
              └── k:1 = x:8 [outer=(1,8), constraints=(/1: (/NULL - ]; /8: (/NULL - ]), fd=(1)==(8), (8)==(1)]
--------------------------------------------------------------------------------
GenerateIndexScans (no changes)
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
GeneratePartialIndexScans (no changes)
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
GenerateConstrainedScans (no changes)
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
GenerateZigzagJoins (no changes)
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
GenerateIndexScans (no changes)
--------------------------------------------------------------------------------
================================================================================
ReorderJoins
  Cost: 2190.09
================================================================================
   project
    ├── columns: s:4
    └── inner-join (hash)
         ├── columns: k:1!null i:2!null s:4 x:8!null
         ├── multiplicity: left-rows(zero-or-one), right-rows(zero-or-one)
         ├── key: (8)
         ├── fd: ()-->(2), (1)-->(4), (1)==(8), (8)==(1)
  +      ├── scan xy
  +      │    ├── columns: x:8!null
  +      │    └── key: (8)
         ├── select
         │    ├── columns: k:1!null i:2!null s:4
         │    ├── key: (1)
         │    ├── fd: ()-->(2), (1)-->(4)
         │    ├── scan a
         │    │    ├── columns: k:1!null i:2 s:4
         │    │    ├── key: (1)
         │    │    └── fd: (1)-->(2,4)
         │    └── filters
         │         └── i:2 = 9 [outer=(2), constraints=(/2: [/9 - /9]; tight), fd=()-->(2)]
  -      ├── scan xy
  -      │    ├── columns: x:8!null
  -      │    └── key: (8)
         └── filters
              └── k:1 = x:8 [outer=(1,8), constraints=(/1: (/NULL - ]; /8: (/NULL - ]), fd=(1)==(8), (8)==(1)]
================================================================================
GenerateMergeJoins
  Cost: 2188.50
================================================================================
   project
    ├── columns: s:4
  - └── inner-join (hash)
  + └── inner-join (merge)
         ├── columns: k:1!null i:2!null s:4 x:8!null
  -      ├── multiplicity: left-rows(zero-or-one), right-rows(zero-or-one)
  +      ├── left ordering: +1
  +      ├── right ordering: +8
         ├── key: (8)
         ├── fd: ()-->(2), (1)-->(4), (1)==(8), (8)==(1)
  -      ├── scan xy
  -      │    ├── columns: x:8!null
  -      │    └── key: (8)
         ├── select
         │    ├── columns: k:1!null i:2!null s:4
         │    ├── key: (1)
         │    ├── fd: ()-->(2), (1)-->(4)
  +      │    ├── ordering: +1 opt(2) [actual: +1]
         │    ├── scan a
         │    │    ├── columns: k:1!null i:2 s:4
         │    │    ├── key: (1)
  -      │    │    └── fd: (1)-->(2,4)
  +      │    │    ├── fd: (1)-->(2,4)
  +      │    │    └── ordering: +1
         │    └── filters
         │         └── i:2 = 9 [outer=(2), constraints=(/2: [/9 - /9]; tight), fd=()-->(2)]
  -      └── filters
  -           └── k:1 = x:8 [outer=(1,8), constraints=(/1: (/NULL - ]; /8: (/NULL - ]), fd=(1)==(8), (8)==(1)]
  +      ├── scan xy
  +      │    ├── columns: x:8!null
  +      │    ├── key: (8)
  +      │    └── ordering: +8
  +      └── filters (true)
================================================================================
GenerateLookupJoins
  Cost: 1183.39
================================================================================
   project
    ├── columns: s:4
  - └── inner-join (merge)
  + └── inner-join (lookup xy)
         ├── columns: k:1!null i:2!null s:4 x:8!null
  -      ├── left ordering: +1
  -      ├── right ordering: +8
  +      ├── key columns: [1] = [8]
  +      ├── lookup columns are key
         ├── key: (8)
         ├── fd: ()-->(2), (1)-->(4), (1)==(8), (8)==(1)
         ├── select
         │    ├── columns: k:1!null i:2!null s:4
         │    ├── key: (1)
         │    ├── fd: ()-->(2), (1)-->(4)
  -      │    ├── ordering: +1 opt(2) [actual: +1]
         │    ├── scan a
         │    │    ├── columns: k:1!null i:2 s:4
         │    │    ├── key: (1)
  -      │    │    ├── fd: (1)-->(2,4)
  -      │    │    └── ordering: +1
  +      │    │    └── fd: (1)-->(2,4)
         │    └── filters
         │         └── i:2 = 9 [outer=(2), constraints=(/2: [/9 - /9]; tight), fd=()-->(2)]
  -      ├── scan xy
  -      │    ├── columns: x:8!null
  -      │    ├── key: (8)
  -      │    └── ordering: +8
         └── filters (true)
--------------------------------------------------------------------------------
GenerateMergeJoins (higher cost)
--------------------------------------------------------------------------------
   project
    ├── columns: s:4
  - └── inner-join (lookup xy)
  + └── inner-join (merge)
         ├── columns: k:1!null i:2!null s:4 x:8!null
  -      ├── key columns: [1] = [8]
  -      ├── lookup columns are key
  +      ├── left ordering: +8
  +      ├── right ordering: +1
         ├── key: (8)
         ├── fd: ()-->(2), (1)-->(4), (1)==(8), (8)==(1)
  +      ├── scan xy
  +      │    ├── columns: x:8!null
  +      │    ├── key: (8)
  +      │    └── ordering: +8
         ├── select
         │    ├── columns: k:1!null i:2!null s:4
         │    ├── key: (1)
         │    ├── fd: ()-->(2), (1)-->(4)
  +      │    ├── ordering: +1 opt(2) [actual: +1]
         │    ├── scan a
         │    │    ├── columns: k:1!null i:2 s:4
         │    │    ├── key: (1)
  -      │    │    └── fd: (1)-->(2,4)
  +      │    │    ├── fd: (1)-->(2,4)
  +      │    │    └── ordering: +1
         │    └── filters
         │         └── i:2 = 9 [outer=(2), constraints=(/2: [/9 - /9]; tight), fd=()-->(2)]
         └── filters (true)
--------------------------------------------------------------------------------
GenerateLookupJoinsWithFilter (higher cost)
--------------------------------------------------------------------------------
   project
    ├── columns: s:4
  - └── inner-join (merge)
  + └── inner-join (lookup a)
         ├── columns: k:1!null i:2!null s:4 x:8!null
  -      ├── left ordering: +8
  -      ├── right ordering: +1
  +      ├── key columns: [8] = [1]
  +      ├── lookup columns are key
         ├── key: (8)
         ├── fd: ()-->(2), (1)-->(4), (1)==(8), (8)==(1)
         ├── scan xy
         │    ├── columns: x:8!null
  -      │    ├── key: (8)
  -      │    └── ordering: +8
  -      ├── select
  -      │    ├── columns: k:1!null i:2!null s:4
  -      │    ├── key: (1)
  -      │    ├── fd: ()-->(2), (1)-->(4)
  -      │    ├── ordering: +1 opt(2) [actual: +1]
  -      │    ├── scan a
  -      │    │    ├── columns: k:1!null i:2 s:4
  -      │    │    ├── key: (1)
  -      │    │    ├── fd: (1)-->(2,4)
  -      │    │    └── ordering: +1
  -      │    └── filters
  -      │         └── i:2 = 9 [outer=(2), constraints=(/2: [/9 - /9]; tight), fd=()-->(2)]
  -      └── filters (true)
  +      │    └── key: (8)
  +      └── filters
  +           └── i:2 = 9 [outer=(2), constraints=(/2: [/9 - /9]; tight), fd=()-->(2)]
================================================================================
Final best expression
  Cost: 1183.39
================================================================================
  project
   ├── columns: s:4
   └── inner-join (lookup xy)
        ├── columns: k:1!null i:2!null s:4 x:8!null
        ├── key columns: [1] = [8]
        ├── lookup columns are key
        ├── key: (8)
        ├── fd: ()-->(2), (1)-->(4), (1)==(8), (8)==(1)
        ├── select
        │    ├── columns: k:1!null i:2!null s:4
        │    ├── key: (1)
        │    ├── fd: ()-->(2), (1)-->(4)
        │    ├── scan a
        │    │    ├── columns: k:1!null i:2 s:4
        │    │    ├── key: (1)
        │    │    └── fd: (1)-->(2,4)
        │    └── filters
        │         └── i:2 = 9 [outer=(2), constraints=(/2: [/9 - /9]; tight), fd=()-->(2)]
        └── filters (true)

# Use optstepsweb.
optstepsweb
SELECT s FROM a INNER JOIN xy ON a.k=xy.x AND i+1=10
----
https://raduberinde.github.io/optsteps.html?eJzsnN1um0gbx8_fq3heH4EMSXDShrBCyipNV6lct5vsag-SqKLOuJmaD4uPXburrapegw_36nolKzAm4JnBYAaCE_eoZoYZnpnh9__PB_m7c_Vrv6N1rs7752e_gQevL9-9BQMuBoPzS3jz7mIA0xm8G4CxN9ans70p_Dx4Bbir6MpBR-oMHNd6hUejjtaRZRmM_Qsb-9gwb-xutwsfH36enoKsQFeRlBM4Pb2xuxPX-YyG_o3dhR_zf3_Mv_2Yf4OhYwaW7WngaUfZFGxZgW98NNHi8nx52baRK392sA3C0HU8TwzTo3-UUsea8n87ME3AWg9G2mFYDXzWXoCxN3TvPn7Ato9c2zA_WH8Ohx98bCHPN6yJ9hKMvahyB99pxzDV1EUxM-0EprP8e5WDMEtyt6JQHjAT3EraGM00EBRJpUU2ugvTRFm-CQ4ODpHQk49FCYRD6Uj8-jW-pkg96cXiuvqQ80RWFFqJ3tCwwUglfK-1LdkVxXGLZI75BsGzIp3OCoTKrb-pIarrQszptSQfNn3keknKSrIw1hTQwzjE6PUVhLDTuqCIoINyIMK1E_jI1aPmUkXpYUBKMHRsz3cNbPueLuwrGgj7g9_7fZDh9ifYV9O_xdsbe0GBEAuGib-gM2vy3gy8s7CQJRMYiREhQjyEkDiOIAEJJKj9EkFCpr9HsAYSctshQTxgHiSoD7_4z-NFAHkoI8Ljj7KoxFSB4W2pCg6pFTCLJ6JZkhKaIiWrogdSrubYjJT0SENSrg2V25BhkjI3xJxeI0gpPzYpC6I6rF-HE7Lm_Op6Glzvn4AM-ydk7RKM7vTMq5GQ-wpbExOPZm8cbL9OVCXiNjUppvZxytoVpXa-h6On3xvePW2IthKABOPWA5AbrggaWoHp44mJh9ifaWCikS-7zl-e8AW5juy4smMjUQIXf7qnJDB9KduVcookulXXBXWRqOvCDsbPFsaNsTDL5iTw5eOk6l9fO606Ykgz9SAOOamxR9SXjc4PX-A8wL8PvPsFvS9s3wlZ3kejxJuzUtPmvHdUGPMsF75VGCeesiJKyXFFvlDNoZTQoSVK5aZQSs7MkRmvDJV4goqjpAjRV1uk4kLEd05dzS6StZjT9JpO4aUdrg3LWhyJM9QH2ueo2c1oJN0ncOw6ugjXHNRCl93ARkvBPXPMZNpFSVioce8oUmOVlxoXWxJ7bDUus_YVPuEWqX-tU8Ki6h9rbyn1r6y9ZaeQR8UjJIpObTyVDjF-jcoaBQ4SzyqS5dbqlvg19bHbopLEMx3YiijVLvEbmrijHJtCd70NIHlNlSy3xotVa8qle9gSby73hinoZhkjtYKlBcagp-Sqb-TTO-ipmVt6MzbmA68iFhAuMH059oAqXw9YBjhb5q7KEquExyCKTnVECVKV8hisHAUUiPWW0L1f8QFRlwKVayzqACCdSLnBsLF8le4OGl0Jf1diUNUtf_RK2f1S0CjSRygH9VxXosTsEpZI7HT3KejuuYktbBs-ep_MDyPhJa9nlPdR9kJ2ystcvyBn96srG6VA1pQksya2VSU5PmyRczMffSRjoNGqko6xQ-ErKRIzliKrDStZG1hyqLTJE5-zzr1z8-0aKW-9Y7ct88QUNNmouAz7gLqFkUrJ7GEcPsYeBg8V3XQ3otX7ClVW14sUXehAV5vVmnUr6xTaplOmEk-_wbSm2IymYRSv3XfidiiTieLcYx45Jy3XPTFbCiky0Aqud6TO-XRiOi7KfON1iRz3Drkh0BPEZ6_FcD_kC3di1LQRtkTShkTk8L1SqQG3A-9zAC_9tF8p8LIB2VaMLaj1C7KRa_joLXI_oQy7aCkZgr2s_F1DTDDWZw1WWHMlwhEdy_u8f1gCRIzH9icNujTzG5WWzqQ2gsrtYhgL3-m2BWfiCz0Rro2hHxhmeOm2FfQre5qDugJAa7OiN80prdUivpJDsfQaQxG-yky-0k9INvLlQo6lZvmQLCpYnzWD4LtBCKUsyPuOMw4mVJJnkjIoP6gb5WZUNUxn7cb5GM0enuZauQUdrtVbGvcX8cR5wXBReO-O6ztvuqXetKXsLMa8nXnlYl7VIuaV_ScM6oVcLY6Bl0ZvF5N3XvsJe-2tBnnKof6B_fib2xwbm86UxrtS_ABKNUNrtJvwWT-rRn5Wab2f3QD1rNcvZ7uvwjc9lEMXRVBV4eRL_oGRzc-K8AZtaz5FIcpuAwbrC7fzz__-CwAA__-U-F62

# When the URL is very long, the compressed data is added as a fragment rather
# than a query parameter.
optstepsweb
SELECT * FROM a a1
INNER JOIN a a2 ON a1.k = a1.k
INNER JOIN a a3 ON a2.k = a3.k
INNER JOIN a a4 ON a3.k = a4.k
INNER JOIN a a5 ON a4.k = a5.k
----
https://raduberinde.github.io/optsteps.html#eJzsXd1y2ziWvt-nwPrKXlFqERRtSVOu6t50utYpr5ONM3szmepiO_I2E1nKSvLsZLd2amqeIZfzdP0kU_yRRIL4OYBAEmROblwBCYjEwflwcL4P4P-d3f_H7dn87P7l7csX78i_kJ_evv53EpHIf7-6ubt7-Za8en1zlxRQ8vqORP7oE7lO_7DXg_Q6za4H1euT9HqQXZ9Ur4fp9Ul2PRx9OvPO7tabpx_jx8ez-dlwOCTRdzereBdHy_erwWBAfjn-9_vvydAnA98LKfn--_erwefN-uPiYfd-NSC_ff37b1__-tvXv5KH9fL5abWdk09z_59Xz8slieeUPM4Dsp1PyMd5SD7Np_sLM_I498dkO_d98nHu06RSuL_oXyZXr5Kr0-TqjHyaU3poMyCPczoh2zkNycc5vUyuzvZXg3Hykz7ZzgNKPs6DoPyQnxZf5uTc9-jsonzh8UNSfjEcvn8ej4PFOR2GFx45D7zJxV_-kpf5HvXS0unxvtnQp55_OfRnHg2G9NILxsMgSG7yx57vHytPvZmX3Bqmt9LkVjrb3xqCGrzy_GmhwfTG0PMvvWqLlEJapBOPhpUWswf0aOCVWpxBWgx8L6CCFrMH9IKxl907vbi-PvfD9LdmeTdcX59PjwWUZgXJTbP8IQ4FNClI_-9fJg8bjNM2LpOS2bGABlmBf5kXBONDAc0NlTZy5dGJF_hZT6cl42MJneQl_lVeEvjHEjpJa2UlU4-GSSckJdkr-scSGuYl_jQvCeixhKajy89KZkn355bPXpMeS-hlXuLP8pIgOJbQy3x0f81Hd7xaLTbDj-t4Rc5_jba_ppfTfxz_TeBn78KRP0q8OPJHiSNH_ijx5cgfJe4c-aOHzYdffo5Xu8VmFS1_fvrTw8PPu_hpsd1FT5_nl8kdu-iX5WIdf5hfpei1R4CIjhIQiOgoxYGIjlIoiOgoRYOIypv2g-SWQ9v-JIW-A4REwShFkSgYpUASBaMUS6JglMJJFMibp-PklkPz1E-R84BB0WSUwlA0GaVIFE1GKRhFk1GKR9FE0fxVcsux-WmKyAcQi8JRimNROEqhLApHKZpF4SgBtOSvtPlgktxyaD4IOcZ-el7u4s_L-CHefZmT5eJxN9ys_2d7vvhz9LBbfhmuV4sLj2zi__o1v_C_i816uN4Mn9abBW_0MMDKXK2i6xUfXbPyMr5OhGi6v1aAT_9ySH0OWu6BMr9axMcEwqYcONxj4P5qAQATvAs5eLeHt_wqIlyNCJfUSkvo2KNXXpA-Ic3eNCiUXO1LxnlJMDmW0HS8-WkJ9T069TLL0exNJ4WS6b7Ez0uC8FhCp7xhL4PdvyH6OoK-YqNYQ8m_CcCSSm7qA2YeAbCMfmXoK8NcGePKAMeAGYNkDIwxiMXAFYNVDCwxmMQAEoM9DPAwqMMADIMuDLRIxgMATBBTwJii7Dzbvi-AAD9U3-scEuRuXfDpggsX_LforkVfLXpm0S2LTlj0wKK_FZ2t6FpFv1J3adGZHjbr7VZcpU9OBX3J_eicgrulxjEKfYTtQ7QiEflDtL2O_D-qajVsVs3HyQ2gfPf8z1cDK5h0KzXv1hZHNbdv1UOb17c2x-2h4Xi5W2y28ttJuU42SvNc8dwnf1g_7xab6_MEBh_Wq-1uE8Wr3fb6_Dt_Ts6_u_v97S0Zkj9eiO3HM3egNHfVzu3M2nz3kcytXMfRnAmFjcMsy5o09ZA8vT_3w4NN8xC5bNZp0ay_I9_5YcnOHnn8cM2bpzkW5Vl-oh4oR5M3vDrj2pq7lOIZWXcVU21VYV3WrLk1r_f9dPTVfF3E-GvIWJZSjmUzcxYXUn5Ysi3PqKHE-EdrNpWK5JtxJuvwD3P9NFyhOZHhWIvldrre98XBYvu0XdliZQMlFptxLJZZqZjkozSxWEa93cdPn5fx45f76Gnxn9Hm5X8_R8t4Fy-2ezJOckNKz3khLTB05MDQcW3sGkPHzY0kI0EeYSJDhwxdd_PX2eiWMHSExfJOLz27nSOufVqsGPvU_FOlQQZYmavO5ZiQoes8wrnH0FWGvQx2-5T46zb6io1iDSVlDJ3opj5gJjJ0-gydaDwAwAQxRSPXp-g8274vY-gU9zqHBB1g6BRdymPoBFX65FTQlywydLAatTJ0sEdgGTp5rcYZOq3HOTJ0oGpmDJ1-t1Lzbm1xVAsZOv2-tTluKwnjoeR2Uq5jn6Hj_cp53vrNPfnx5v7dzd2Ld9kekxc_3L87Txv94Z7c3L2bXlyQ12_Lxf_6-vXtBfTBfkd2yUx6IR5fIgZRF7XbiSrEDCJwjJgxiILGKyOPex875JpiENmHETGIioHSGIOoeI4Cg6gyhxmDyLaqsC5r1kYZxMPPixhEkfEbYxBFD1BgEIUdbsYgVkzCGo61WIsM4qt1vPrpQHCWuMPSJWQNkTVE1rBzOXVkDTuUt0bWsAMZcGQN3UI4ZA0RfZE1dBszkTVE1tBNTEHWEFlDZA2RNUTWEFnDDrKGrfB5-vsOAY-HvKIMAJBXRF4ReUXkFYnccKzFWuAV3zxvf81Iw5vVbv1qHa9uF4-7PbUoulpiF6-QXUR2EdnFDuTekV3sUH4b2cUOZMqRXXQL4ZBdRPRFdtFtzER2EdlFNzEF2UVkF5Fd7Ai7KKNdTE8NPdRaLPNUluzurnCR8p46iYvUOpmzxqaNDodt3H4mT6V5VGz91tQ619QdmhHpcfEAsQm8FjbV1jMutE7rJee7zTMgYkPSGklrJK2RtEbSuknS-u3iaf2nxd16d_e8XL5Yrz7Eu3i92pPWoqs5aX2VktaXSFojaY2kdQcoHSStO0SbIGndAQIGSWu3EA5Ja0RfJK3dxkwkrZG0dhNTkLRG0hpJ646Q1rBH6Bf9rFXN5lZYBUcMquxmJ5_W1ydxxHpiAggJ6BwXaEYJIsEsHl017r9Gplbt28jUIlOLTC0ytc0ztS-X8VO8inaL-zykzSjaSnHOzV6m3KyP3Cxys8jNdoC5QG62Q-wAcrMd4BmQm3UL4ZCbRfRFbtZtzERuFrlZNzEFuVnkZpGb7Qg3C9xQvE9kwe7u5eHGIA7QjNHVaprtXVDlxjvZ5Kk0-7pxRvfAuukxqXjONdT0yLMiz4o8K_KsyLMizwrgWW8Xj7sfttv1QxztFq_W8Wr7Nlkz7vlW4eWcd_WRd0XeFXnXzrASyLt2KPOPvGsHOATkXd1COORdEX2Rd3UbM5F31edd2WSrBEzY1KoBq4T4A8kJChLgyNH2gqNVWJfnTTAmsNNOBX3JIkcLq-ECR2vCCzpGCLpwjPNph2i3fZ6y7gnKtXQdYF5vkZqsfWqFvav2DFu8oDkMQnAFbUa1t1OoICpBJl6MHzUeqX1g4hWRDcvE60Y17UTdYq8FdpIZEy9oHHaQASnf3BgTr69BC6CHHzQ-HLSeCozldgaH1tHxeh9cb3moQEU-qPFAjQdqPFDjgRoP1HigxgM1Hp1LRaDGAzUeqPFwC-Hc03gM2WEvS9_q8LEI0a1DtJh7RyEICkGcFIIo-GgEFQvqjpL8QnGvc77aAe5Ig6RQU_WucPS65LwdalmTjm-dhwcT8Ha7B06594lrrz16UvRhPRw-J4GvuLMh1h6jpEaiJDZqVru6oEYPPR76rid6JuxHwDvmUV2D6hqnzrkwO7iiLZmEQRcDnNKOTEL-G7BDLVqWScBkQEIFlkgmAV7AN5wBE0dZqo4wk0mwrSrkVewoaFQmoaGJnhhootuJ1rXDajt2h6mPBPc5NQqUgikU1aCohmtfFNWgqAZFNRdti2qGclHNQHC5Quwi-dJ6TrL2KbMiB0DRDYpuOo6AHRPdiChwhN_W4VdslJLwRXRTH8ANKR17whegEqB1CQCY-z-R1Yay_e3R_Gp-31IXaByO0wdir-ths8g2liUCnASW6BZ3RQEYHmN4DDx30Fj7gNhobydxPWIK-D5l9xENY2KUOaHMCWVOKHNCmRPKnNyUOSnmG-ApL21pW3SgWhZL2dG2CBo3-4ZTo9oWhRqrqnITaVvUyfmmiDpxakD4smbaliFrOlbCxlq2UW0LZOdQqLNzqOGMETzDY8eaCpUXe4MbthW6aypserN5XqWKpdvF4-7FerndS5o4F1DMhGImNhmJYibnc5XiE4IqrDnS5a2nFpubRM2NjcZz5nyn0ixW8eM-iCeQ-nJrOnGP-qog2gkRHA56HPSdGPSVmUAljGpfAKT7y8ojs1T5GuMzQsStiIDE1of_MLRqPbSqlzAE7Kdzn7zH6QmnJ5QjOYONKEdCORLKkZzyeJQjoRwJ5UgoR7LglChHQjmSSsrwDcmR2CeCnqTTlmhF8RySPIAd0QrbquY3xxoVrVR-XiFaSU_Z4apWCldKspUQZStV0gNlKyhbcS6n1YhspbsLzK6n25uVoWiZQqtjNbrJgnwDeWwE1X4RBTbFGxjHYBzjnMsBpBqiJW0dggnhclBD6gD5_p1afoKxV-sHFtolIypQflhlWz2Gx7VYDr6ZzH0aFOM1tyYP9-I1yAcJBVMAzgTWP8VwImKf_KEH9xENhR2nn71o7Oo99Hjou9bjmWIOGVYBhR3X8g-OKoQd8lrtCDu0nuko7ABVO0HYod_BgXkHt-rypk5pR9gB_KQs_9NJbgg7ND7-K_lMVlvCDh2olsVSdoQdsE-TCe5jB0Cr58xAj5FpS9gBC555eQA7wo4Tv5LmxEkznHkFk_iYxHcuDyPeIqg8dJyI4Km7a6Cu57-lBrJ6_DgRzgnS-9xNp2CC2C1gci9BLB3YULTsYeKo9nUIpCPrADfxQgdyu7tQh5lj_cwxxOKaGNBDKNB64RpdVpy40qiFKeV9Slmj09i8MqBqO8ll_Qc7ZpjhdU9IMxt2enBip7ePDyc5r53UM-CHYEfkupCEhkxd8q_5SwdfS5_0lz4TMFSzk5iW_YLGKGGHR4uf-SfiwVE9NZs_oFo6Opv_MKrshJ20tfSMbNkAYC3v4s7El8v4KV5Fu3QP4u9XHxabN5kG8nbxuNtvUlTclO9XDNP9iuMu7lccine4oM4fKYJ-ZuISzOIMe8pcwGGvGPY4SGsdpCLuar-pthLWfAv7MisbWmrbl_lt-DBOXR1DhcrWHWb-QgfAScyh4Spde3dxR2XlhQ4LPqv7KF2bbuGSORSM4ZTaLYwSyTOVu2eE8Xd3Cc-uC8akBrK604cbhnEQkReQOamiQMGYW8DknmBMOrChaNlDlUjDG1f4HVkHuEF3xoAjQEegDgVjp2415ltcEwN6CAVaL1yjy4o1Jxq1UDB2zd2DLO00-UZkbtV2BGP6Dybakiyra21fMrjTq5uT9Tq9fXw4yXntCMYAPwTbxeiCYAwydcm3LksHX0v7l6XPBAzV7AjGZL-gMUrY4dHinmYiHhzVjc38AdXS7mb-w6iyE3YEY9JtzLIBwFreiR3PhgZ0IMkvfiehjhTz9pjManZbNniTUS_XiQ2Ly20vPRWtS2AGc0Q9zhEpjA139R56PPRd6_FM8ZISVgFTQdfcvYPQLJC8VjsJIK1nEm0WtJ_20e_g6hZBV5I9Bl0McEo7KR75byj2-biR2FHMN_JNgK2nc3SgWhZL2UniCBqHjQN2ALS41-_4FLkyL16vRPsU_14esFl-J13se2Q_ZJW7CXNgzivH82B8qDyDVE7hPK_9OA_8Q21_DKmezgJ59e08oMfqvrB6wVHTySOv_nEeBMfqLe2mG5OB700mvdlNR3E3HeZhnMrDVAdpHnP0dpDikKp1SBHcqaazU43iTjWcFlzzYeG-svJ6tKfDFQdXzRMEEa_Mv7VdYN1jkxW7wHgn5SObjIjSBpts6GZaYWA9PqkSbXDzwh1zM3SKZqZZNe-KX_yrXWLRhz6sjim7bDV-1hB1JPhZQxc_awhSeMm4alSOAJUjZpIRp7QiuiIR--oQM1lI43oQwWwqdi78WCh-LFTL8fBjofixUEfUWfixUNFwsKbOsjPWBLNSB75EChKjNTXe2W7k6tDKN5HyaFLp0FSVpTo0VWWFDk1VXaFDk3_iVKlDU6ngTqx-6PVszBqq_zIQMlX_ZdBlrP7LEM9Y_ZcBZdvqv8mEDHwvmPZF_ZeHC8ibY0LfllZv6pJUD-1fM6GDwjq4sK68NnPCPxBxO-ZxQhnc1DkVHI6EmrGXMTZq1rokppFr1rhpPBTToP-LTwX_tsU0ypdsQggiS74jFQakwsw4MKfIL13Wyz7dZcZzOUZwaTNb9VBaZjRDW0cMNBkbaY0OsD-qhMY8uqnW0AgDmWaWtIoJwAU5K1B3BjmvQh_rCdMi8ncFJklVHXqOhAkBB-42HgEH7zYuAQfvNi4BB6c9uQQcnPY0qn7o9WymMaQ9s5nJlPbM5jNj2jObBo1pz2z2NKM932yeV4v7h2j1Yr3c7mlOpjCjNYNpd2lNUTLUGVYTw4eawwc7dhZaFW2IPGIbPGLlpcvoxlxEiOuve1jl9RDnkLNrgLNTv0n38lLyPuXleTEv1V1n1ckxIqg6AKpmBJJb-UODp1DugVfSUPa3O0palPgKpjgxxWk_xQnvNvkeA5McJbjbeDlKeLdxc5TwbuPmKLnVrecoD7su3uwDR2Y3xqG8lKnMjl8eHqLNAT9r0OH0JS73uh-ZDBVprUoS51tIawnl8dbTWjj02xz6jCHZTIda0wvNdCiUtJyw1yTTUXkhJ9TJdWU65H2qm-lAR3TAERtfHQNFs2brUukqUuTvpVWk9IO6qlWkqrJ0FamqrFhFqqqbbHSHryLB3cZbRYK7jbeKhHcbdxUJ7za4UAa-igR3G28VCe423ioS3m3cVSS827irSLi-iLuKHLJV2FXkQBJiDGxEF5xGjoHF4LSYYsALJ6RP3b1IQth_0wvuRYwf3IofOCaqCnOtRg3i5rgD58RYgePCzHfZzCIEST3F19hM4wJJTeU32EyjAUjv8I-sMYsBQL0jOKjGdOYH9Y5A3mqqbDUVtZrrWc2lrKZz-0AyrZ95Zy___Hm53ix-jB8fz-ZnWbb47WK9-bDYvFrHq4OgtVyWZ4knhSyxQFGGuWGcV1vODYtzY1bSYtKM2ImyH67ip1eBqzT-wMSX8w4GyHlZTndBMl32klyq_JZpass0q2We0DLPZZmnsUwzWKbJK_O8lXnKyjxbZZqoMs1RmaenzDNT5kmpTuecZMm0LMj-t3W83eWyi58266ebJHxOwut9xC25gRN-D3nh96Afe8wwEO9-nNDpQHzIJ6R7FYgL-296wb2IgbhbDlacLrlzwelOZoeROJ5dyxtR1qFdmVv3gbl1g7ACEl2cGGT0ee3FQW1GW2AqKzBVFJiLCcx1BOYSAlP1gKlwwFwzYC4XMFcKmIoETPUB5tIAc1WAuSBArgVgHZtzi4Dm03RVXgUFsaftnLwqSipP2x2lry793gSctdP2PPmry78loUPQaTqZ9NWl58zocHHa_jQwcKQTCDVcvOPawo21BVGsLSzEzXZIo-OQc2Nt0XndjmKJ4QOXGPDjFNRrJ8X6QiOlozDc0K7hxM1x8yz2eSs2ShOuq6RBsXS3L5zF0o7S5PGvfCevDmGlGaVJX126S1eHm9KO0uSvLt-BC6ehNKM0-avLd9fqME7aUdrZ___TPwIAAP__j1rCsA==

# Exploration patterns with varying costs.
optsteps
SELECT s, k FROM a WHERE s='foo' AND f>100
----
================================================================================
Initial expression
  Cost: 1159.36
================================================================================
  project
   ├── columns: s:4!null k:1!null
   ├── key: (1)
   ├── fd: ()-->(4)
   └── select
        ├── columns: k:1!null i:2 f:3!null s:4!null j:5 crdb_internal_mvcc_timestamp:6 tableoid:7
        ├── key: (1)
        ├── fd: ()-->(4), (1)-->(2,3,5-7), (3)-->(1,2,5-7)
        ├── scan a
        │    ├── columns: k:1!null i:2 f:3 s:4 j:5 crdb_internal_mvcc_timestamp:6 tableoid:7
        │    ├── key: (1)
        │    └── fd: (1)-->(2-7), (3,4)~~>(1,2,5-7)
        └── filters
             └── (s:4 = 'foo') AND (f:3 > 100.0) [outer=(3,4), constraints=(/3: [/100.00000000000001 - ]; /4: [/'foo' - /'foo']; tight), fd=()-->(4)]
================================================================================
SimplifySelectFilters
  Cost: 1159.37
================================================================================
   project
    ├── columns: s:4!null k:1!null
    ├── key: (1)
    ├── fd: ()-->(4)
    └── select
         ├── columns: k:1!null i:2 f:3!null s:4!null j:5 crdb_internal_mvcc_timestamp:6 tableoid:7
         ├── key: (1)
         ├── fd: ()-->(4), (1)-->(2,3,5-7), (3)-->(1,2,5-7)
         ├── scan a
         │    ├── columns: k:1!null i:2 f:3 s:4 j:5 crdb_internal_mvcc_timestamp:6 tableoid:7
         │    ├── key: (1)
         │    └── fd: (1)-->(2-7), (3,4)~~>(1,2,5-7)
         └── filters
  -           └── (s:4 = 'foo') AND (f:3 > 100.0) [outer=(3,4), constraints=(/3: [/100.00000000000001 - ]; /4: [/'foo' - /'foo']; tight), fd=()-->(4)]
  +           ├── s:4 = 'foo' [outer=(4), constraints=(/4: [/'foo' - /'foo']; tight), fd=()-->(4)]
  +           └── f:3 > 100.0 [outer=(3), constraints=(/3: [/100.00000000000001 - ]; tight)]
================================================================================
PruneSelectCols
  Cost: 1118.97
================================================================================
   project
    ├── columns: s:4!null k:1!null
    ├── key: (1)
    ├── fd: ()-->(4)
    └── select
  -      ├── columns: k:1!null i:2 f:3!null s:4!null j:5 crdb_internal_mvcc_timestamp:6 tableoid:7
  +      ├── columns: k:1!null f:3!null s:4!null
         ├── key: (1)
  -      ├── fd: ()-->(4), (1)-->(2,3,5-7), (3)-->(1,2,5-7)
  +      ├── fd: ()-->(4), (1)-->(3), (3)-->(1)
         ├── scan a
  -      │    ├── columns: k:1!null i:2 f:3 s:4 j:5 crdb_internal_mvcc_timestamp:6 tableoid:7
  +      │    ├── columns: k:1!null f:3 s:4
         │    ├── key: (1)
  -      │    └── fd: (1)-->(2-7), (3,4)~~>(1,2,5-7)
  +      │    └── fd: (1)-->(3,4), (3,4)~~>(1)
         └── filters
              ├── s:4 = 'foo' [outer=(4), constraints=(/4: [/'foo' - /'foo']; tight), fd=()-->(4)]
              └── f:3 > 100.0 [outer=(3), constraints=(/3: [/100.00000000000001 - ]; tight)]
================================================================================
GenerateIndexScans
  Cost: 1108.87
================================================================================
   project
    ├── columns: s:4!null k:1!null
    ├── key: (1)
    ├── fd: ()-->(4)
    └── select
         ├── columns: k:1!null f:3!null s:4!null
         ├── key: (1)
         ├── fd: ()-->(4), (1)-->(3), (3)-->(1)
  -      ├── scan a
  +      ├── scan a@a_s_f_key
         │    ├── columns: k:1!null f:3 s:4
         │    ├── key: (1)
         │    └── fd: (1)-->(3,4), (3,4)~~>(1)
         └── filters
              ├── s:4 = 'foo' [outer=(4), constraints=(/4: [/'foo' - /'foo']; tight), fd=()-->(4)]
              └── f:3 > 100.0 [outer=(3), constraints=(/3: [/100.00000000000001 - ]; tight)]
--------------------------------------------------------------------------------
GeneratePartialIndexScans (no changes)
--------------------------------------------------------------------------------
================================================================================
GenerateConstrainedScans
  Cost: 28.12
================================================================================
   project
    ├── columns: s:4!null k:1!null
    ├── key: (1)
    ├── fd: ()-->(4)
  - └── select
  + └── scan a@a_s_f_key
         ├── columns: k:1!null f:3!null s:4!null
  +      ├── constraint: /-4/3: [/'foo'/100.00000000000001 - /'foo']
         ├── key: (1)
  -      ├── fd: ()-->(4), (1)-->(3), (3)-->(1)
  -      ├── scan a@a_s_f_key
  -      │    ├── columns: k:1!null f:3 s:4
  -      │    ├── key: (1)
  -      │    └── fd: (1)-->(3,4), (3,4)~~>(1)
  -      └── filters
  -           ├── s:4 = 'foo' [outer=(4), constraints=(/4: [/'foo' - /'foo']; tight), fd=()-->(4)]
  -           └── f:3 > 100.0 [outer=(3), constraints=(/3: [/100.00000000000001 - ]; tight)]
  +      └── fd: ()-->(4), (1)-->(3), (3)-->(1)
--------------------------------------------------------------------------------
GenerateZigzagJoins (no changes)
--------------------------------------------------------------------------------
================================================================================
Final best expression
  Cost: 28.12
================================================================================
  project
   ├── columns: s:4!null k:1!null
   ├── key: (1)
   ├── fd: ()-->(4)
   └── scan a@a_s_f_key
        ├── columns: k:1!null f:3!null s:4!null
        ├── constraint: /-4/3: [/'foo'/100.00000000000001 - /'foo']
        ├── key: (1)
        └── fd: ()-->(4), (1)-->(3), (3)-->(1)

# Decorrelation pattern.
optsteps
SELECT * FROM a WHERE EXISTS(SELECT * FROM xy WHERE y=i)
----
================================================================================
Initial expression
  Cost: 2271.17
================================================================================
  project
   ├── columns: k:1!null i:2 f:3 s:4 j:5
   ├── key: (1)
   ├── fd: (1)-->(2-5), (3,4)~~>(1,2,5)
   └── select
        ├── columns: k:1!null i:2 f:3 s:4 j:5 a.crdb_internal_mvcc_timestamp:6 a.tableoid:7
        ├── key: (1)
        ├── fd: (1)-->(2-7), (3,4)~~>(1,2,5-7)
        ├── scan a
        │    ├── columns: k:1!null i:2 f:3 s:4 j:5 a.crdb_internal_mvcc_timestamp:6 a.tableoid:7
        │    ├── key: (1)
        │    └── fd: (1)-->(2-7), (3,4)~~>(1,2,5-7)
        └── filters
             └── exists [outer=(2), correlated-subquery]
                  └── project
                       ├── columns: x:8!null y:9!null
                       ├── outer: (2)
                       ├── key: (8)
                       ├── fd: ()-->(9)
                       └── select
                            ├── columns: x:8!null y:9!null xy.crdb_internal_mvcc_timestamp:10 xy.tableoid:11
                            ├── outer: (2)
                            ├── key: (8)
                            ├── fd: ()-->(9), (8)-->(10,11)
                            ├── scan xy
                            │    ├── columns: x:8!null y:9 xy.crdb_internal_mvcc_timestamp:10 xy.tableoid:11
                            │    ├── key: (8)
                            │    └── fd: (8)-->(9-11)
                            └── filters
                                 └── y:9 = i:2 [outer=(2,9), constraints=(/2: (/NULL - ]; /9: (/NULL - ]), fd=(2)==(9), (9)==(2)]
================================================================================
PruneSelectCols
  Cost: 2250.97
================================================================================
   project
    ├── columns: k:1!null i:2 f:3 s:4 j:5
    ├── key: (1)
    ├── fd: (1)-->(2-5), (3,4)~~>(1,2,5)
    └── select
         ├── columns: k:1!null i:2 f:3 s:4 j:5 a.crdb_internal_mvcc_timestamp:6 a.tableoid:7
         ├── key: (1)
         ├── fd: (1)-->(2-7), (3,4)~~>(1,2,5-7)
         ├── scan a
         │    ├── columns: k:1!null i:2 f:3 s:4 j:5 a.crdb_internal_mvcc_timestamp:6 a.tableoid:7
         │    ├── key: (1)
         │    └── fd: (1)-->(2-7), (3,4)~~>(1,2,5-7)
         └── filters
              └── exists [outer=(2), correlated-subquery]
                   └── project
                        ├── columns: x:8!null y:9!null
                        ├── outer: (2)
                        ├── key: (8)
                        ├── fd: ()-->(9)
                        └── select
  -                          ├── columns: x:8!null y:9!null xy.crdb_internal_mvcc_timestamp:10 xy.tableoid:11
  +                          ├── columns: x:8!null y:9!null
                             ├── outer: (2)
                             ├── key: (8)
  -                          ├── fd: ()-->(9), (8)-->(10,11)
  +                          ├── fd: ()-->(9)
                             ├── scan xy
  -                          │    ├── columns: x:8!null y:9 xy.crdb_internal_mvcc_timestamp:10 xy.tableoid:11
  +                          │    ├── columns: x:8!null y:9
                             │    ├── key: (8)
  -                          │    └── fd: (8)-->(9-11)
  +                          │    └── fd: (8)-->(9)
                             └── filters
                                  └── y:9 = i:2 [outer=(2,9), constraints=(/2: (/NULL - ]; /9: (/NULL - ]), fd=(2)==(9), (9)==(2)]
================================================================================
EliminateProject
  Cost: 2241.05
================================================================================
   project
    ├── columns: k:1!null i:2 f:3 s:4 j:5
    ├── key: (1)
    ├── fd: (1)-->(2-5), (3,4)~~>(1,2,5)
    └── select
         ├── columns: k:1!null i:2 f:3 s:4 j:5 a.crdb_internal_mvcc_timestamp:6 a.tableoid:7
         ├── key: (1)
         ├── fd: (1)-->(2-7), (3,4)~~>(1,2,5-7)
         ├── scan a
         │    ├── columns: k:1!null i:2 f:3 s:4 j:5 a.crdb_internal_mvcc_timestamp:6 a.tableoid:7
         │    ├── key: (1)
         │    └── fd: (1)-->(2-7), (3,4)~~>(1,2,5-7)
         └── filters
              └── exists [outer=(2), correlated-subquery]
  -                └── project
  +                └── select
                        ├── columns: x:8!null y:9!null
                        ├── outer: (2)
                        ├── key: (8)
                        ├── fd: ()-->(9)
  -                     └── select
  -                          ├── columns: x:8!null y:9!null
  -                          ├── outer: (2)
  -                          ├── key: (8)
  -                          ├── fd: ()-->(9)
  -                          ├── scan xy
  -                          │    ├── columns: x:8!null y:9
  -                          │    ├── key: (8)
  -                          │    └── fd: (8)-->(9)
  -                          └── filters
  -                               └── y:9 = i:2 [outer=(2,9), constraints=(/2: (/NULL - ]; /9: (/NULL - ]), fd=(2)==(9), (9)==(2)]
  +                     ├── scan xy
  +                     │    ├── columns: x:8!null y:9
  +                     │    ├── key: (8)
  +                     │    └── fd: (8)-->(9)
  +                     └── filters
  +                          └── y:9 = i:2 [outer=(2,9), constraints=(/2: (/NULL - ]; /9: (/NULL - ]), fd=(2)==(9), (9)==(2)]
================================================================================
HoistSelectExists
  Cost: 12177.70
================================================================================
   project
    ├── columns: k:1!null i:2 f:3 s:4 j:5
    ├── key: (1)
    ├── fd: (1)-->(2-5), (3,4)~~>(1,2,5)
    └── select
         ├── columns: k:1!null i:2 f:3 s:4 j:5 a.crdb_internal_mvcc_timestamp:6 a.tableoid:7
         ├── key: (1)
         ├── fd: (1)-->(2-7), (3,4)~~>(1,2,5-7)
  -      ├── scan a
  +      ├── semi-join-apply
         │    ├── columns: k:1!null i:2 f:3 s:4 j:5 a.crdb_internal_mvcc_timestamp:6 a.tableoid:7
         │    ├── key: (1)
  -      │    └── fd: (1)-->(2-7), (3,4)~~>(1,2,5-7)
  -      └── filters
  -           └── exists [outer=(2), correlated-subquery]
  -                └── select
  -                     ├── columns: x:8!null y:9!null
  -                     ├── outer: (2)
  -                     ├── key: (8)
  -                     ├── fd: ()-->(9)
  -                     ├── scan xy
  -                     │    ├── columns: x:8!null y:9
  -                     │    ├── key: (8)
  -                     │    └── fd: (8)-->(9)
  -                     └── filters
  -                          └── y:9 = i:2 [outer=(2,9), constraints=(/2: (/NULL - ]; /9: (/NULL - ]), fd=(2)==(9), (9)==(2)]
  +      │    ├── fd: (1)-->(2-7), (3,4)~~>(1,2,5-7)
  +      │    ├── scan a
  +      │    │    ├── columns: k:1!null i:2 f:3 s:4 j:5 a.crdb_internal_mvcc_timestamp:6 a.tableoid:7
  +      │    │    ├── key: (1)
  +      │    │    └── fd: (1)-->(2-7), (3,4)~~>(1,2,5-7)
  +      │    ├── select
  +      │    │    ├── columns: x:8!null y:9!null
  +      │    │    ├── outer: (2)
  +      │    │    ├── key: (8)
  +      │    │    ├── fd: ()-->(9)
  +      │    │    ├── scan xy
  +      │    │    │    ├── columns: x:8!null y:9
  +      │    │    │    ├── key: (8)
  +      │    │    │    └── fd: (8)-->(9)
  +      │    │    └── filters
  +      │    │         └── y:9 = i:2 [outer=(2,9), constraints=(/2: (/NULL - ]; /9: (/NULL - ]), fd=(2)==(9), (9)==(2)]
  +      │    └── filters (true)
  +      └── filters (true)
================================================================================
TryDecorrelateSelect
  Cost: 2367.65
================================================================================
   project
  - ├── columns: k:1!null i:2 f:3 s:4 j:5
  + ├── columns: k:1!null i:2!null f:3 s:4 j:5
    ├── key: (1)
    ├── fd: (1)-->(2-5), (3,4)~~>(1,2,5)
    └── select
  -      ├── columns: k:1!null i:2 f:3 s:4 j:5 a.crdb_internal_mvcc_timestamp:6 a.tableoid:7
  +      ├── columns: k:1!null i:2!null f:3 s:4 j:5 a.crdb_internal_mvcc_timestamp:6 a.tableoid:7
         ├── key: (1)
         ├── fd: (1)-->(2-7), (3,4)~~>(1,2,5-7)
         ├── semi-join-apply
  -      │    ├── columns: k:1!null i:2 f:3 s:4 j:5 a.crdb_internal_mvcc_timestamp:6 a.tableoid:7
  +      │    ├── columns: k:1!null i:2!null f:3 s:4 j:5 a.crdb_internal_mvcc_timestamp:6 a.tableoid:7
         │    ├── key: (1)
         │    ├── fd: (1)-->(2-7), (3,4)~~>(1,2,5-7)
         │    ├── scan a
         │    │    ├── columns: k:1!null i:2 f:3 s:4 j:5 a.crdb_internal_mvcc_timestamp:6 a.tableoid:7
         │    │    ├── key: (1)
         │    │    └── fd: (1)-->(2-7), (3,4)~~>(1,2,5-7)
  -      │    ├── select
  -      │    │    ├── columns: x:8!null y:9!null
  -      │    │    ├── outer: (2)
  +      │    ├── scan xy
  +      │    │    ├── columns: x:8!null y:9
         │    │    ├── key: (8)
  -      │    │    ├── fd: ()-->(9)
  -      │    │    ├── scan xy
  -      │    │    │    ├── columns: x:8!null y:9
  -      │    │    │    ├── key: (8)
  -      │    │    │    └── fd: (8)-->(9)
  -      │    │    └── filters
  -      │    │         └── y:9 = i:2 [outer=(2,9), constraints=(/2: (/NULL - ]; /9: (/NULL - ]), fd=(2)==(9), (9)==(2)]
  -      │    └── filters (true)
  +      │    │    └── fd: (8)-->(9)
  +      │    └── filters
  +      │         └── y:9 = i:2 [outer=(2,9), constraints=(/2: (/NULL - ]; /9: (/NULL - ]), fd=(2)==(9), (9)==(2)]
         └── filters (true)
================================================================================
DecorrelateJoin
  Cost: 2365.86
================================================================================
   project
  - ├── columns: k:1!null i:2!null f:3 s:4 j:5
  + ├── columns: k:1!null i:2 f:3 s:4 j:5
    ├── key: (1)
    ├── fd: (1)-->(2-5), (3,4)~~>(1,2,5)
    └── select
  -      ├── columns: k:1!null i:2!null f:3 s:4 j:5 a.crdb_internal_mvcc_timestamp:6 a.tableoid:7
  +      ├── columns: k:1!null i:2 f:3 s:4 j:5 a.crdb_internal_mvcc_timestamp:6 a.tableoid:7
         ├── key: (1)
         ├── fd: (1)-->(2-7), (3,4)~~>(1,2,5-7)
  -      ├── semi-join-apply
  -      │    ├── columns: k:1!null i:2!null f:3 s:4 j:5 a.crdb_internal_mvcc_timestamp:6 a.tableoid:7
  +      ├── semi-join (hash)
  +      │    ├── columns: k:1!null i:2 f:3 s:4 j:5 a.crdb_internal_mvcc_timestamp:6 a.tableoid:7
         │    ├── key: (1)
         │    ├── fd: (1)-->(2-7), (3,4)~~>(1,2,5-7)
         │    ├── scan a
         │    │    ├── columns: k:1!null i:2 f:3 s:4 j:5 a.crdb_internal_mvcc_timestamp:6 a.tableoid:7
         │    │    ├── key: (1)
         │    │    └── fd: (1)-->(2-7), (3,4)~~>(1,2,5-7)
         │    ├── scan xy
         │    │    ├── columns: x:8!null y:9
         │    │    ├── key: (8)
         │    │    └── fd: (8)-->(9)
         │    └── filters
         │         └── y:9 = i:2 [outer=(2,9), constraints=(/2: (/NULL - ]; /9: (/NULL - ]), fd=(2)==(9), (9)==(2)]
         └── filters (true)
================================================================================
PruneSemiAntiJoinRightCols
  Cost: 2355.76
================================================================================
   project
    ├── columns: k:1!null i:2 f:3 s:4 j:5
    ├── key: (1)
    ├── fd: (1)-->(2-5), (3,4)~~>(1,2,5)
    └── select
         ├── columns: k:1!null i:2 f:3 s:4 j:5 a.crdb_internal_mvcc_timestamp:6 a.tableoid:7
         ├── key: (1)
         ├── fd: (1)-->(2-7), (3,4)~~>(1,2,5-7)
         ├── semi-join (hash)
         │    ├── columns: k:1!null i:2 f:3 s:4 j:5 a.crdb_internal_mvcc_timestamp:6 a.tableoid:7
         │    ├── key: (1)
         │    ├── fd: (1)-->(2-7), (3,4)~~>(1,2,5-7)
         │    ├── scan a
         │    │    ├── columns: k:1!null i:2 f:3 s:4 j:5 a.crdb_internal_mvcc_timestamp:6 a.tableoid:7
         │    │    ├── key: (1)
         │    │    └── fd: (1)-->(2-7), (3,4)~~>(1,2,5-7)
         │    ├── scan xy
  -      │    │    ├── columns: x:8!null y:9
  -      │    │    ├── key: (8)
  -      │    │    └── fd: (8)-->(9)
  +      │    │    └── columns: y:9
         │    └── filters
         │         └── y:9 = i:2 [outer=(2,9), constraints=(/2: (/NULL - ]; /9: (/NULL - ]), fd=(2)==(9), (9)==(2)]
         └── filters (true)
================================================================================
EliminateSelect
  Cost: 2345.74
================================================================================
   project
    ├── columns: k:1!null i:2 f:3 s:4 j:5
    ├── key: (1)
    ├── fd: (1)-->(2-5), (3,4)~~>(1,2,5)
  - └── select
  + └── semi-join (hash)
         ├── columns: k:1!null i:2 f:3 s:4 j:5 a.crdb_internal_mvcc_timestamp:6 a.tableoid:7
         ├── key: (1)
         ├── fd: (1)-->(2-7), (3,4)~~>(1,2,5-7)
  -      ├── semi-join (hash)
  +      ├── scan a
         │    ├── columns: k:1!null i:2 f:3 s:4 j:5 a.crdb_internal_mvcc_timestamp:6 a.tableoid:7
         │    ├── key: (1)
  -      │    ├── fd: (1)-->(2-7), (3,4)~~>(1,2,5-7)
  -      │    ├── scan a
  -      │    │    ├── columns: k:1!null i:2 f:3 s:4 j:5 a.crdb_internal_mvcc_timestamp:6 a.tableoid:7
  -      │    │    ├── key: (1)
  -      │    │    └── fd: (1)-->(2-7), (3,4)~~>(1,2,5-7)
  -      │    ├── scan xy
  -      │    │    └── columns: y:9
  -      │    └── filters
  -      │         └── y:9 = i:2 [outer=(2,9), constraints=(/2: (/NULL - ]; /9: (/NULL - ]), fd=(2)==(9), (9)==(2)]
  -      └── filters (true)
  +      │    └── fd: (1)-->(2-7), (3,4)~~>(1,2,5-7)
  +      ├── scan xy
  +      │    └── columns: y:9
  +      └── filters
  +           └── y:9 = i:2 [outer=(2,9), constraints=(/2: (/NULL - ]; /9: (/NULL - ]), fd=(2)==(9), (9)==(2)]
================================================================================
PruneJoinLeftCols
  Cost: 2325.54
================================================================================
   project
    ├── columns: k:1!null i:2 f:3 s:4 j:5
    ├── key: (1)
    ├── fd: (1)-->(2-5), (3,4)~~>(1,2,5)
    └── semi-join (hash)
  -      ├── columns: k:1!null i:2 f:3 s:4 j:5 a.crdb_internal_mvcc_timestamp:6 a.tableoid:7
  +      ├── columns: k:1!null i:2 f:3 s:4 j:5
         ├── key: (1)
  -      ├── fd: (1)-->(2-7), (3,4)~~>(1,2,5-7)
  +      ├── fd: (1)-->(2-5), (3,4)~~>(1,2,5)
         ├── scan a
  -      │    ├── columns: k:1!null i:2 f:3 s:4 j:5 a.crdb_internal_mvcc_timestamp:6 a.tableoid:7
  +      │    ├── columns: k:1!null i:2 f:3 s:4 j:5
         │    ├── key: (1)
  -      │    └── fd: (1)-->(2-7), (3,4)~~>(1,2,5-7)
  +      │    └── fd: (1)-->(2-5), (3,4)~~>(1,2,5)
         ├── scan xy
         │    └── columns: y:9
         └── filters
              └── y:9 = i:2 [outer=(2,9), constraints=(/2: (/NULL - ]; /9: (/NULL - ]), fd=(2)==(9), (9)==(2)]
================================================================================
EliminateProject
  Cost: 2315.52
================================================================================
  -project
  +semi-join (hash)
    ├── columns: k:1!null i:2 f:3 s:4 j:5
    ├── key: (1)
    ├── fd: (1)-->(2-5), (3,4)~~>(1,2,5)
  - └── semi-join (hash)
  -      ├── columns: k:1!null i:2 f:3 s:4 j:5
  -      ├── key: (1)
  -      ├── fd: (1)-->(2-5), (3,4)~~>(1,2,5)
  -      ├── scan a
  -      │    ├── columns: k:1!null i:2 f:3 s:4 j:5
  -      │    ├── key: (1)
  -      │    └── fd: (1)-->(2-5), (3,4)~~>(1,2,5)
  -      ├── scan xy
  -      │    └── columns: y:9
  -      └── filters
  -           └── y:9 = i:2 [outer=(2,9), constraints=(/2: (/NULL - ]; /9: (/NULL - ]), fd=(2)==(9), (9)==(2)]
  + ├── scan a
  + │    ├── columns: k:1!null i:2 f:3 s:4 j:5
  + │    ├── key: (1)
  + │    └── fd: (1)-->(2-5), (3,4)~~>(1,2,5)
  + ├── scan xy
  + │    └── columns: y:9
  + └── filters
  +      └── y:9 = i:2 [outer=(2,9), constraints=(/2: (/NULL - ]; /9: (/NULL - ]), fd=(2)==(9), (9)==(2)]
--------------------------------------------------------------------------------
GenerateIndexScans (no changes)
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
GenerateIndexScans (no changes)
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
ReorderJoins (no changes)
--------------------------------------------------------------------------------
================================================================================
CommuteSemiJoin
  Cost: 2242.46
================================================================================
  -semi-join (hash)
  +project
    ├── columns: k:1!null i:2 f:3 s:4 j:5
    ├── key: (1)
    ├── fd: (1)-->(2-5), (3,4)~~>(1,2,5)
  - ├── scan a
  - │    ├── columns: k:1!null i:2 f:3 s:4 j:5
  - │    ├── key: (1)
  - │    └── fd: (1)-->(2-5), (3,4)~~>(1,2,5)
  - ├── scan xy
  - │    └── columns: y:9
  - └── filters
  -      └── y:9 = i:2 [outer=(2,9), constraints=(/2: (/NULL - ]; /9: (/NULL - ]), fd=(2)==(9), (9)==(2)]
  + └── inner-join (hash)
  +      ├── columns: k:1!null i:2!null f:3 s:4 j:5 y:9!null
  +      ├── multiplicity: left-rows(zero-or-one), right-rows(zero-or-more)
  +      ├── key: (1)
  +      ├── fd: (1)-->(2-5), (3,4)~~>(1,2,5), (2)==(9), (9)==(2)
  +      ├── scan a
  +      │    ├── columns: k:1!null i:2 f:3 s:4 j:5
  +      │    ├── key: (1)
  +      │    └── fd: (1)-->(2-5), (3,4)~~>(1,2,5)
  +      ├── distinct-on
  +      │    ├── columns: y:9
  +      │    ├── grouping columns: y:9
  +      │    ├── key: (9)
  +      │    └── scan xy
  +      │         └── columns: y:9
  +      └── filters
  +           └── y:9 = i:2 [outer=(2,9), constraints=(/2: (/NULL - ]; /9: (/NULL - ]), fd=(2)==(9), (9)==(2)]
--------------------------------------------------------------------------------
GenerateMergeJoins (no changes)
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
GenerateLookupJoins (no changes)
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
GenerateStreamingGroupBy (no changes)
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
ReorderJoins (higher cost)
--------------------------------------------------------------------------------
   project
    ├── columns: k:1!null i:2 f:3 s:4 j:5
    ├── key: (1)
    ├── fd: (1)-->(2-5), (3,4)~~>(1,2,5)
    └── inner-join (hash)
         ├── columns: k:1!null i:2!null f:3 s:4 j:5 y:9!null
  -      ├── multiplicity: left-rows(zero-or-one), right-rows(zero-or-more)
  +      ├── multiplicity: left-rows(zero-or-more), right-rows(zero-or-one)
         ├── key: (1)
         ├── fd: (1)-->(2-5), (3,4)~~>(1,2,5), (2)==(9), (9)==(2)
  -      ├── scan a
  -      │    ├── columns: k:1!null i:2 f:3 s:4 j:5
  -      │    ├── key: (1)
  -      │    └── fd: (1)-->(2-5), (3,4)~~>(1,2,5)
         ├── distinct-on
         │    ├── columns: y:9
         │    ├── grouping columns: y:9
         │    ├── key: (9)
         │    └── scan xy
         │         └── columns: y:9
  +      ├── scan a
  +      │    ├── columns: k:1!null i:2 f:3 s:4 j:5
  +      │    ├── key: (1)
  +      │    └── fd: (1)-->(2-5), (3,4)~~>(1,2,5)
         └── filters
              └── y:9 = i:2 [outer=(2,9), constraints=(/2: (/NULL - ]; /9: (/NULL - ]), fd=(2)==(9), (9)==(2)]
--------------------------------------------------------------------------------
GenerateMergeJoins (no changes)
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
GenerateMergeJoins (no changes)
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
GenerateLookupJoins (no changes)
--------------------------------------------------------------------------------
================================================================================
Final best expression
  Cost: 2242.46
================================================================================
  project
   ├── columns: k:1!null i:2 f:3 s:4 j:5
   ├── key: (1)
   ├── fd: (1)-->(2-5), (3,4)~~>(1,2,5)
   └── inner-join (hash)
        ├── columns: k:1!null i:2!null f:3 s:4 j:5 y:9!null
        ├── multiplicity: left-rows(zero-or-one), right-rows(zero-or-more)
        ├── key: (1)
        ├── fd: (1)-->(2-5), (3,4)~~>(1,2,5), (2)==(9), (9)==(2)
        ├── scan a
        │    ├── columns: k:1!null i:2 f:3 s:4 j:5
        │    ├── key: (1)
        │    └── fd: (1)-->(2-5), (3,4)~~>(1,2,5)
        ├── distinct-on
        │    ├── columns: y:9
        │    ├── grouping columns: y:9
        │    ├── key: (9)
        │    └── scan xy
        │         └── columns: y:9
        └── filters
             └── y:9 = i:2 [outer=(2,9), constraints=(/2: (/NULL - ]; /9: (/NULL - ]), fd=(2)==(9), (9)==(2)]

# Decorrelation pattern using ANY function.
optsteps
SELECT 5=ANY(SELECT i FROM a WHERE k=x) AS r FROM xy
----
================================================================================
Initial expression
  Cost: 2267.90
================================================================================
  project
   ├── columns: r:12
   ├── scan xy
   │    ├── columns: x:1!null y:2 xy.crdb_internal_mvcc_timestamp:3 xy.tableoid:4
   │    ├── key: (1)
   │    └── fd: (1)-->(2-4)
   └── projections
        └── any: eq [as=r:12, outer=(1), correlated-subquery]
             ├── project
             │    ├── columns: i:6
             │    ├── outer: (1)
             │    ├── cardinality: [0 - 1]
             │    ├── key: ()
             │    ├── fd: ()-->(6)
             │    └── select
             │         ├── columns: k:5!null i:6 f:7 s:8 j:9 a.crdb_internal_mvcc_timestamp:10 a.tableoid:11
             │         ├── outer: (1)
             │         ├── cardinality: [0 - 1]
             │         ├── key: ()
             │         ├── fd: ()-->(5-11)
             │         ├── scan a
             │         │    ├── columns: k:5!null i:6 f:7 s:8 j:9 a.crdb_internal_mvcc_timestamp:10 a.tableoid:11
             │         │    ├── key: (5)
             │         │    └── fd: (5)-->(6-11), (7,8)~~>(5,6,9-11)
             │         └── filters
             │              └── k:5 = x:1 [outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ]), fd=(1)==(5), (5)==(1)]
             └── 5
================================================================================
PruneSelectCols
  Cost: 2217.40
================================================================================
   project
    ├── columns: r:12
    ├── scan xy
    │    ├── columns: x:1!null y:2 xy.crdb_internal_mvcc_timestamp:3 xy.tableoid:4
    │    ├── key: (1)
    │    └── fd: (1)-->(2-4)
    └── projections
         └── any: eq [as=r:12, outer=(1), correlated-subquery]
              ├── project
              │    ├── columns: i:6
              │    ├── outer: (1)
              │    ├── cardinality: [0 - 1]
              │    ├── key: ()
              │    ├── fd: ()-->(6)
              │    └── select
  -           │         ├── columns: k:5!null i:6 f:7 s:8 j:9 a.crdb_internal_mvcc_timestamp:10 a.tableoid:11
  +           │         ├── columns: k:5!null i:6
              │         ├── outer: (1)
              │         ├── cardinality: [0 - 1]
              │         ├── key: ()
  -           │         ├── fd: ()-->(5-11)
  +           │         ├── fd: ()-->(5,6)
              │         ├── scan a
  -           │         │    ├── columns: k:5!null i:6 f:7 s:8 j:9 a.crdb_internal_mvcc_timestamp:10 a.tableoid:11
  +           │         │    ├── columns: k:5!null i:6
              │         │    ├── key: (5)
  -           │         │    └── fd: (5)-->(6-11), (7,8)~~>(5,6,9-11)
  +           │         │    └── fd: (5)-->(6)
              │         └── filters
              │              └── k:5 = x:1 [outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ]), fd=(1)==(5), (5)==(1)]
              └── 5
================================================================================
PruneScanCols
  Cost: 2187.10
================================================================================
   project
    ├── columns: r:12
    ├── scan xy
  - │    ├── columns: x:1!null y:2 xy.crdb_internal_mvcc_timestamp:3 xy.tableoid:4
  - │    ├── key: (1)
  - │    └── fd: (1)-->(2-4)
  + │    ├── columns: x:1!null
  + │    └── key: (1)
    └── projections
         └── any: eq [as=r:12, outer=(1), correlated-subquery]
              ├── project
              │    ├── columns: i:6
              │    ├── outer: (1)
              │    ├── cardinality: [0 - 1]
              │    ├── key: ()
              │    ├── fd: ()-->(6)
              │    └── select
              │         ├── columns: k:5!null i:6
              │         ├── outer: (1)
              │         ├── cardinality: [0 - 1]
              │         ├── key: ()
              │         ├── fd: ()-->(5,6)
              │         ├── scan a
              │         │    ├── columns: k:5!null i:6
              │         │    ├── key: (5)
              │         │    └── fd: (5)-->(6)
              │         └── filters
              │              └── k:5 = x:1 [outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ]), fd=(1)==(5), (5)==(1)]
              └── 5
================================================================================
HoistProjectSubquery
  Cost: 2209.75
================================================================================
   project
    ├── columns: r:12
  - ├── scan xy
  - │    ├── columns: x:1!null
  - │    └── key: (1)
  + ├── inner-join-apply
  + │    ├── columns: x:1!null case:15
  + │    ├── key: (1)
  + │    ├── fd: (1)-->(15)
  + │    ├── scan xy
  + │    │    ├── columns: x:1!null
  + │    │    └── key: (1)
  + │    ├── project
  + │    │    ├── columns: case:15
  + │    │    ├── outer: (1)
  + │    │    ├── cardinality: [1 - 1]
  + │    │    ├── key: ()
  + │    │    ├── fd: ()-->(15)
  + │    │    ├── scalar-group-by
  + │    │    │    ├── columns: bool_or:14
  + │    │    │    ├── outer: (1)
  + │    │    │    ├── cardinality: [1 - 1]
  + │    │    │    ├── key: ()
  + │    │    │    ├── fd: ()-->(14)
  + │    │    │    ├── project
  + │    │    │    │    ├── columns: notnull:13!null
  + │    │    │    │    ├── outer: (1)
  + │    │    │    │    ├── cardinality: [0 - 1]
  + │    │    │    │    ├── key: ()
  + │    │    │    │    ├── fd: ()-->(13)
  + │    │    │    │    ├── select
  + │    │    │    │    │    ├── columns: i:6
  + │    │    │    │    │    ├── outer: (1)
  + │    │    │    │    │    ├── cardinality: [0 - 1]
  + │    │    │    │    │    ├── key: ()
  + │    │    │    │    │    ├── fd: ()-->(6)
  + │    │    │    │    │    ├── project
  + │    │    │    │    │    │    ├── columns: i:6
  + │    │    │    │    │    │    ├── outer: (1)
  + │    │    │    │    │    │    ├── cardinality: [0 - 1]
  + │    │    │    │    │    │    ├── key: ()
  + │    │    │    │    │    │    ├── fd: ()-->(6)
  + │    │    │    │    │    │    └── select
  + │    │    │    │    │    │         ├── columns: k:5!null i:6
  + │    │    │    │    │    │         ├── outer: (1)
  + │    │    │    │    │    │         ├── cardinality: [0 - 1]
  + │    │    │    │    │    │         ├── key: ()
  + │    │    │    │    │    │         ├── fd: ()-->(5,6)
  + │    │    │    │    │    │         ├── scan a
  + │    │    │    │    │    │         │    ├── columns: k:5!null i:6
  + │    │    │    │    │    │         │    ├── key: (5)
  + │    │    │    │    │    │         │    └── fd: (5)-->(6)
  + │    │    │    │    │    │         └── filters
  + │    │    │    │    │    │              └── k:5 = x:1 [outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ]), fd=(1)==(5), (5)==(1)]
  + │    │    │    │    │    └── filters
  + │    │    │    │    │         └── (5 = i:6) IS NOT false [outer=(6)]
  + │    │    │    │    └── projections
  + │    │    │    │         └── i:6 IS NOT NULL [as=notnull:13, outer=(6)]
  + │    │    │    └── aggregations
  + │    │    │         └── bool-or [as=bool_or:14, outer=(13)]
  + │    │    │              └── notnull:13
  + │    │    └── projections
  + │    │         └── CASE WHEN bool_or:14 AND (5 IS NOT NULL) THEN true WHEN bool_or:14 IS NULL THEN false ELSE CAST(NULL AS BOOL) END [as=case:15, outer=(14)]
  + │    └── filters (true)
    └── projections
  -      └── any: eq [as=r:12, outer=(1), correlated-subquery]
  -           ├── project
  -           │    ├── columns: i:6
  -           │    ├── outer: (1)
  -           │    ├── cardinality: [0 - 1]
  -           │    ├── key: ()
  -           │    ├── fd: ()-->(6)
  -           │    └── select
  -           │         ├── columns: k:5!null i:6
  -           │         ├── outer: (1)
  -           │         ├── cardinality: [0 - 1]
  -           │         ├── key: ()
  -           │         ├── fd: ()-->(5,6)
  -           │         ├── scan a
  -           │         │    ├── columns: k:5!null i:6
  -           │         │    ├── key: (5)
  -           │         │    └── fd: (5)-->(6)
  -           │         └── filters
  -           │              └── k:5 = x:1 [outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ]), fd=(1)==(5), (5)==(1)]
  -           └── 5
  +      └── case:15 [as=r:12, outer=(15)]
================================================================================
FoldNonNullIsNotNull
  Cost: 2209.75
================================================================================
   project
    ├── columns: r:12
    ├── inner-join-apply
    │    ├── columns: x:1!null case:15
    │    ├── key: (1)
    │    ├── fd: (1)-->(15)
    │    ├── scan xy
    │    │    ├── columns: x:1!null
    │    │    └── key: (1)
    │    ├── project
    │    │    ├── columns: case:15
    │    │    ├── outer: (1)
    │    │    ├── cardinality: [1 - 1]
    │    │    ├── key: ()
    │    │    ├── fd: ()-->(15)
    │    │    ├── scalar-group-by
    │    │    │    ├── columns: bool_or:14
    │    │    │    ├── outer: (1)
    │    │    │    ├── cardinality: [1 - 1]
    │    │    │    ├── key: ()
    │    │    │    ├── fd: ()-->(14)
    │    │    │    ├── project
    │    │    │    │    ├── columns: notnull:13!null
    │    │    │    │    ├── outer: (1)
    │    │    │    │    ├── cardinality: [0 - 1]
    │    │    │    │    ├── key: ()
    │    │    │    │    ├── fd: ()-->(13)
    │    │    │    │    ├── select
    │    │    │    │    │    ├── columns: i:6
    │    │    │    │    │    ├── outer: (1)
    │    │    │    │    │    ├── cardinality: [0 - 1]
    │    │    │    │    │    ├── key: ()
    │    │    │    │    │    ├── fd: ()-->(6)
    │    │    │    │    │    ├── project
    │    │    │    │    │    │    ├── columns: i:6
    │    │    │    │    │    │    ├── outer: (1)
    │    │    │    │    │    │    ├── cardinality: [0 - 1]
    │    │    │    │    │    │    ├── key: ()
    │    │    │    │    │    │    ├── fd: ()-->(6)
    │    │    │    │    │    │    └── select
    │    │    │    │    │    │         ├── columns: k:5!null i:6
    │    │    │    │    │    │         ├── outer: (1)
    │    │    │    │    │    │         ├── cardinality: [0 - 1]
    │    │    │    │    │    │         ├── key: ()
    │    │    │    │    │    │         ├── fd: ()-->(5,6)
    │    │    │    │    │    │         ├── scan a
    │    │    │    │    │    │         │    ├── columns: k:5!null i:6
    │    │    │    │    │    │         │    ├── key: (5)
    │    │    │    │    │    │         │    └── fd: (5)-->(6)
    │    │    │    │    │    │         └── filters
    │    │    │    │    │    │              └── k:5 = x:1 [outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ]), fd=(1)==(5), (5)==(1)]
    │    │    │    │    │    └── filters
    │    │    │    │    │         └── (5 = i:6) IS NOT false [outer=(6)]
    │    │    │    │    └── projections
    │    │    │    │         └── i:6 IS NOT NULL [as=notnull:13, outer=(6)]
    │    │    │    └── aggregations
    │    │    │         └── bool-or [as=bool_or:14, outer=(13)]
    │    │    │              └── notnull:13
    │    │    └── projections
  - │    │         └── CASE WHEN bool_or:14 AND (5 IS NOT NULL) THEN true WHEN bool_or:14 IS NULL THEN false ELSE CAST(NULL AS BOOL) END [as=case:15, outer=(14)]
  + │    │         └── CASE WHEN bool_or:14 AND true THEN true WHEN bool_or:14 IS NULL THEN false ELSE CAST(NULL AS BOOL) END [as=case:15, outer=(14)]
    │    └── filters (true)
    └── projections
         └── case:15 [as=r:12, outer=(15)]
================================================================================
CommuteVar
  Cost: 2209.75
================================================================================
   project
    ├── columns: r:12
    ├── inner-join-apply
    │    ├── columns: x:1!null case:15
    │    ├── key: (1)
    │    ├── fd: (1)-->(15)
    │    ├── scan xy
    │    │    ├── columns: x:1!null
    │    │    └── key: (1)
    │    ├── project
    │    │    ├── columns: case:15
    │    │    ├── outer: (1)
    │    │    ├── cardinality: [1 - 1]
    │    │    ├── key: ()
    │    │    ├── fd: ()-->(15)
    │    │    ├── scalar-group-by
    │    │    │    ├── columns: bool_or:14
    │    │    │    ├── outer: (1)
    │    │    │    ├── cardinality: [1 - 1]
    │    │    │    ├── key: ()
    │    │    │    ├── fd: ()-->(14)
    │    │    │    ├── project
    │    │    │    │    ├── columns: notnull:13!null
    │    │    │    │    ├── outer: (1)
    │    │    │    │    ├── cardinality: [0 - 1]
    │    │    │    │    ├── key: ()
    │    │    │    │    ├── fd: ()-->(13)
    │    │    │    │    ├── select
    │    │    │    │    │    ├── columns: i:6
    │    │    │    │    │    ├── outer: (1)
    │    │    │    │    │    ├── cardinality: [0 - 1]
    │    │    │    │    │    ├── key: ()
    │    │    │    │    │    ├── fd: ()-->(6)
    │    │    │    │    │    ├── project
    │    │    │    │    │    │    ├── columns: i:6
    │    │    │    │    │    │    ├── outer: (1)
    │    │    │    │    │    │    ├── cardinality: [0 - 1]
    │    │    │    │    │    │    ├── key: ()
    │    │    │    │    │    │    ├── fd: ()-->(6)
    │    │    │    │    │    │    └── select
    │    │    │    │    │    │         ├── columns: k:5!null i:6
    │    │    │    │    │    │         ├── outer: (1)
    │    │    │    │    │    │         ├── cardinality: [0 - 1]
    │    │    │    │    │    │         ├── key: ()
    │    │    │    │    │    │         ├── fd: ()-->(5,6)
    │    │    │    │    │    │         ├── scan a
    │    │    │    │    │    │         │    ├── columns: k:5!null i:6
    │    │    │    │    │    │         │    ├── key: (5)
    │    │    │    │    │    │         │    └── fd: (5)-->(6)
    │    │    │    │    │    │         └── filters
    │    │    │    │    │    │              └── k:5 = x:1 [outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ]), fd=(1)==(5), (5)==(1)]
    │    │    │    │    │    └── filters
  - │    │    │    │    │         └── (5 = i:6) IS NOT false [outer=(6)]
  + │    │    │    │    │         └── (i:6 = 5) IS NOT false [outer=(6)]
    │    │    │    │    └── projections
    │    │    │    │         └── i:6 IS NOT NULL [as=notnull:13, outer=(6)]
    │    │    │    └── aggregations
    │    │    │         └── bool-or [as=bool_or:14, outer=(13)]
    │    │    │              └── notnull:13
    │    │    └── projections
    │    │         └── CASE WHEN bool_or:14 AND true THEN true WHEN bool_or:14 IS NULL THEN false ELSE CAST(NULL AS BOOL) END [as=case:15, outer=(14)]
    │    └── filters (true)
    └── projections
         └── case:15 [as=r:12, outer=(15)]
================================================================================
PushSelectIntoProject
  Cost: 2209.75
================================================================================
   project
    ├── columns: r:12
    ├── inner-join-apply
    │    ├── columns: x:1!null case:15
    │    ├── key: (1)
    │    ├── fd: (1)-->(15)
    │    ├── scan xy
    │    │    ├── columns: x:1!null
    │    │    └── key: (1)
    │    ├── project
    │    │    ├── columns: case:15
    │    │    ├── outer: (1)
    │    │    ├── cardinality: [1 - 1]
    │    │    ├── key: ()
    │    │    ├── fd: ()-->(15)
    │    │    ├── scalar-group-by
    │    │    │    ├── columns: bool_or:14
    │    │    │    ├── outer: (1)
    │    │    │    ├── cardinality: [1 - 1]
    │    │    │    ├── key: ()
    │    │    │    ├── fd: ()-->(14)
    │    │    │    ├── project
    │    │    │    │    ├── columns: notnull:13!null
    │    │    │    │    ├── outer: (1)
    │    │    │    │    ├── cardinality: [0 - 1]
    │    │    │    │    ├── key: ()
    │    │    │    │    ├── fd: ()-->(13)
    │    │    │    │    ├── select
    │    │    │    │    │    ├── columns: i:6
    │    │    │    │    │    ├── outer: (1)
    │    │    │    │    │    ├── cardinality: [0 - 1]
    │    │    │    │    │    ├── key: ()
    │    │    │    │    │    ├── fd: ()-->(6)
    │    │    │    │    │    ├── project
    │    │    │    │    │    │    ├── columns: i:6
    │    │    │    │    │    │    ├── outer: (1)
    │    │    │    │    │    │    ├── cardinality: [0 - 1]
    │    │    │    │    │    │    ├── key: ()
    │    │    │    │    │    │    ├── fd: ()-->(6)
    │    │    │    │    │    │    └── select
    │    │    │    │    │    │         ├── columns: k:5!null i:6
    │    │    │    │    │    │         ├── outer: (1)
    │    │    │    │    │    │         ├── cardinality: [0 - 1]
    │    │    │    │    │    │         ├── key: ()
    │    │    │    │    │    │         ├── fd: ()-->(5,6)
  - │    │    │    │    │    │         ├── scan a
  + │    │    │    │    │    │         ├── select
    │    │    │    │    │    │         │    ├── columns: k:5!null i:6
  - │    │    │    │    │    │         │    ├── key: (5)
  - │    │    │    │    │    │         │    └── fd: (5)-->(6)
  + │    │    │    │    │    │         │    ├── outer: (1)
  + │    │    │    │    │    │         │    ├── cardinality: [0 - 1]
  + │    │    │    │    │    │         │    ├── key: ()
  + │    │    │    │    │    │         │    ├── fd: ()-->(5,6)
  + │    │    │    │    │    │         │    ├── scan a
  + │    │    │    │    │    │         │    │    ├── columns: k:5!null i:6
  + │    │    │    │    │    │         │    │    ├── key: (5)
  + │    │    │    │    │    │         │    │    └── fd: (5)-->(6)
  + │    │    │    │    │    │         │    └── filters
  + │    │    │    │    │    │         │         └── k:5 = x:1 [outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ]), fd=(1)==(5), (5)==(1)]
    │    │    │    │    │    │         └── filters
  - │    │    │    │    │    │              └── k:5 = x:1 [outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ]), fd=(1)==(5), (5)==(1)]
  - │    │    │    │    │    └── filters
  - │    │    │    │    │         └── (i:6 = 5) IS NOT false [outer=(6)]
  + │    │    │    │    │    │              └── (i:6 = 5) IS NOT false [outer=(6)]
  + │    │    │    │    │    └── filters (true)
    │    │    │    │    └── projections
    │    │    │    │         └── i:6 IS NOT NULL [as=notnull:13, outer=(6)]
    │    │    │    └── aggregations
    │    │    │         └── bool-or [as=bool_or:14, outer=(13)]
    │    │    │              └── notnull:13
    │    │    └── projections
    │    │         └── CASE WHEN bool_or:14 AND true THEN true WHEN bool_or:14 IS NULL THEN false ELSE CAST(NULL AS BOOL) END [as=case:15, outer=(14)]
    │    └── filters (true)
    └── projections
         └── case:15 [as=r:12, outer=(15)]
================================================================================
MergeSelects
  Cost: 2209.77
================================================================================
   project
    ├── columns: r:12
    ├── inner-join-apply
    │    ├── columns: x:1!null case:15
    │    ├── key: (1)
    │    ├── fd: (1)-->(15)
    │    ├── scan xy
    │    │    ├── columns: x:1!null
    │    │    └── key: (1)
    │    ├── project
    │    │    ├── columns: case:15
    │    │    ├── outer: (1)
    │    │    ├── cardinality: [1 - 1]
    │    │    ├── key: ()
    │    │    ├── fd: ()-->(15)
    │    │    ├── scalar-group-by
    │    │    │    ├── columns: bool_or:14
    │    │    │    ├── outer: (1)
    │    │    │    ├── cardinality: [1 - 1]
    │    │    │    ├── key: ()
    │    │    │    ├── fd: ()-->(14)
    │    │    │    ├── project
    │    │    │    │    ├── columns: notnull:13!null
    │    │    │    │    ├── outer: (1)
    │    │    │    │    ├── cardinality: [0 - 1]
    │    │    │    │    ├── key: ()
    │    │    │    │    ├── fd: ()-->(13)
    │    │    │    │    ├── select
    │    │    │    │    │    ├── columns: i:6
    │    │    │    │    │    ├── outer: (1)
    │    │    │    │    │    ├── cardinality: [0 - 1]
    │    │    │    │    │    ├── key: ()
    │    │    │    │    │    ├── fd: ()-->(6)
    │    │    │    │    │    ├── project
    │    │    │    │    │    │    ├── columns: i:6
    │    │    │    │    │    │    ├── outer: (1)
    │    │    │    │    │    │    ├── cardinality: [0 - 1]
    │    │    │    │    │    │    ├── key: ()
    │    │    │    │    │    │    ├── fd: ()-->(6)
    │    │    │    │    │    │    └── select
    │    │    │    │    │    │         ├── columns: k:5!null i:6
    │    │    │    │    │    │         ├── outer: (1)
    │    │    │    │    │    │         ├── cardinality: [0 - 1]
    │    │    │    │    │    │         ├── key: ()
    │    │    │    │    │    │         ├── fd: ()-->(5,6)
  - │    │    │    │    │    │         ├── select
  + │    │    │    │    │    │         ├── scan a
    │    │    │    │    │    │         │    ├── columns: k:5!null i:6
  - │    │    │    │    │    │         │    ├── outer: (1)
  - │    │    │    │    │    │         │    ├── cardinality: [0 - 1]
  - │    │    │    │    │    │         │    ├── key: ()
  - │    │    │    │    │    │         │    ├── fd: ()-->(5,6)
  - │    │    │    │    │    │         │    ├── scan a
  - │    │    │    │    │    │         │    │    ├── columns: k:5!null i:6
  - │    │    │    │    │    │         │    │    ├── key: (5)
  - │    │    │    │    │    │         │    │    └── fd: (5)-->(6)
  - │    │    │    │    │    │         │    └── filters
  - │    │    │    │    │    │         │         └── k:5 = x:1 [outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ]), fd=(1)==(5), (5)==(1)]
  + │    │    │    │    │    │         │    ├── key: (5)
  + │    │    │    │    │    │         │    └── fd: (5)-->(6)
    │    │    │    │    │    │         └── filters
  + │    │    │    │    │    │              ├── k:5 = x:1 [outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ]), fd=(1)==(5), (5)==(1)]
    │    │    │    │    │    │              └── (i:6 = 5) IS NOT false [outer=(6)]
    │    │    │    │    │    └── filters (true)
    │    │    │    │    └── projections
    │    │    │    │         └── i:6 IS NOT NULL [as=notnull:13, outer=(6)]
    │    │    │    └── aggregations
    │    │    │         └── bool-or [as=bool_or:14, outer=(13)]
    │    │    │              └── notnull:13
    │    │    └── projections
    │    │         └── CASE WHEN bool_or:14 AND true THEN true WHEN bool_or:14 IS NULL THEN false ELSE CAST(NULL AS BOOL) END [as=case:15, outer=(14)]
    │    └── filters (true)
    └── projections
         └── case:15 [as=r:12, outer=(15)]
================================================================================
EliminateSelect
  Cost: 2209.75
================================================================================
   project
    ├── columns: r:12
    ├── inner-join-apply
    │    ├── columns: x:1!null case:15
    │    ├── key: (1)
    │    ├── fd: (1)-->(15)
    │    ├── scan xy
    │    │    ├── columns: x:1!null
    │    │    └── key: (1)
    │    ├── project
    │    │    ├── columns: case:15
    │    │    ├── outer: (1)
    │    │    ├── cardinality: [1 - 1]
    │    │    ├── key: ()
    │    │    ├── fd: ()-->(15)
    │    │    ├── scalar-group-by
    │    │    │    ├── columns: bool_or:14
    │    │    │    ├── outer: (1)
    │    │    │    ├── cardinality: [1 - 1]
    │    │    │    ├── key: ()
    │    │    │    ├── fd: ()-->(14)
    │    │    │    ├── project
    │    │    │    │    ├── columns: notnull:13!null
    │    │    │    │    ├── outer: (1)
    │    │    │    │    ├── cardinality: [0 - 1]
    │    │    │    │    ├── key: ()
    │    │    │    │    ├── fd: ()-->(13)
  - │    │    │    │    ├── select
  + │    │    │    │    ├── project
    │    │    │    │    │    ├── columns: i:6
    │    │    │    │    │    ├── outer: (1)
    │    │    │    │    │    ├── cardinality: [0 - 1]
    │    │    │    │    │    ├── key: ()
    │    │    │    │    │    ├── fd: ()-->(6)
  - │    │    │    │    │    ├── project
  - │    │    │    │    │    │    ├── columns: i:6
  - │    │    │    │    │    │    ├── outer: (1)
  - │    │    │    │    │    │    ├── cardinality: [0 - 1]
  - │    │    │    │    │    │    ├── key: ()
  - │    │    │    │    │    │    ├── fd: ()-->(6)
  - │    │    │    │    │    │    └── select
  - │    │    │    │    │    │         ├── columns: k:5!null i:6
  - │    │    │    │    │    │         ├── outer: (1)
  - │    │    │    │    │    │         ├── cardinality: [0 - 1]
  - │    │    │    │    │    │         ├── key: ()
  - │    │    │    │    │    │         ├── fd: ()-->(5,6)
  - │    │    │    │    │    │         ├── scan a
  - │    │    │    │    │    │         │    ├── columns: k:5!null i:6
  - │    │    │    │    │    │         │    ├── key: (5)
  - │    │    │    │    │    │         │    └── fd: (5)-->(6)
  - │    │    │    │    │    │         └── filters
  - │    │    │    │    │    │              ├── k:5 = x:1 [outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ]), fd=(1)==(5), (5)==(1)]
  - │    │    │    │    │    │              └── (i:6 = 5) IS NOT false [outer=(6)]
  - │    │    │    │    │    └── filters (true)
  + │    │    │    │    │    └── select
  + │    │    │    │    │         ├── columns: k:5!null i:6
  + │    │    │    │    │         ├── outer: (1)
  + │    │    │    │    │         ├── cardinality: [0 - 1]
  + │    │    │    │    │         ├── key: ()
  + │    │    │    │    │         ├── fd: ()-->(5,6)
  + │    │    │    │    │         ├── scan a
  + │    │    │    │    │         │    ├── columns: k:5!null i:6
  + │    │    │    │    │         │    ├── key: (5)
  + │    │    │    │    │         │    └── fd: (5)-->(6)
  + │    │    │    │    │         └── filters
  + │    │    │    │    │              ├── k:5 = x:1 [outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ]), fd=(1)==(5), (5)==(1)]
  + │    │    │    │    │              └── (i:6 = 5) IS NOT false [outer=(6)]
    │    │    │    │    └── projections
    │    │    │    │         └── i:6 IS NOT NULL [as=notnull:13, outer=(6)]
    │    │    │    └── aggregations
    │    │    │         └── bool-or [as=bool_or:14, outer=(13)]
    │    │    │              └── notnull:13
    │    │    └── projections
    │    │         └── CASE WHEN bool_or:14 AND true THEN true WHEN bool_or:14 IS NULL THEN false ELSE CAST(NULL AS BOOL) END [as=case:15, outer=(14)]
    │    └── filters (true)
    └── projections
         └── case:15 [as=r:12, outer=(15)]
================================================================================
MergeProjects
  Cost: 2209.73
================================================================================
   project
    ├── columns: r:12
    ├── inner-join-apply
    │    ├── columns: x:1!null case:15
    │    ├── key: (1)
    │    ├── fd: (1)-->(15)
    │    ├── scan xy
    │    │    ├── columns: x:1!null
    │    │    └── key: (1)
    │    ├── project
    │    │    ├── columns: case:15
    │    │    ├── outer: (1)
    │    │    ├── cardinality: [1 - 1]
    │    │    ├── key: ()
    │    │    ├── fd: ()-->(15)
    │    │    ├── scalar-group-by
    │    │    │    ├── columns: bool_or:14
    │    │    │    ├── outer: (1)
    │    │    │    ├── cardinality: [1 - 1]
    │    │    │    ├── key: ()
    │    │    │    ├── fd: ()-->(14)
    │    │    │    ├── project
    │    │    │    │    ├── columns: notnull:13!null
    │    │    │    │    ├── outer: (1)
    │    │    │    │    ├── cardinality: [0 - 1]
    │    │    │    │    ├── key: ()
    │    │    │    │    ├── fd: ()-->(13)
  - │    │    │    │    ├── project
  - │    │    │    │    │    ├── columns: i:6
  + │    │    │    │    ├── select
  + │    │    │    │    │    ├── columns: k:5!null i:6
    │    │    │    │    │    ├── outer: (1)
    │    │    │    │    │    ├── cardinality: [0 - 1]
    │    │    │    │    │    ├── key: ()
  - │    │    │    │    │    ├── fd: ()-->(6)
  - │    │    │    │    │    └── select
  - │    │    │    │    │         ├── columns: k:5!null i:6
  - │    │    │    │    │         ├── outer: (1)
  - │    │    │    │    │         ├── cardinality: [0 - 1]
  - │    │    │    │    │         ├── key: ()
  - │    │    │    │    │         ├── fd: ()-->(5,6)
  - │    │    │    │    │         ├── scan a
  - │    │    │    │    │         │    ├── columns: k:5!null i:6
  - │    │    │    │    │         │    ├── key: (5)
  - │    │    │    │    │         │    └── fd: (5)-->(6)
  - │    │    │    │    │         └── filters
  - │    │    │    │    │              ├── k:5 = x:1 [outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ]), fd=(1)==(5), (5)==(1)]
  - │    │    │    │    │              └── (i:6 = 5) IS NOT false [outer=(6)]
  + │    │    │    │    │    ├── fd: ()-->(5,6)
  + │    │    │    │    │    ├── scan a
  + │    │    │    │    │    │    ├── columns: k:5!null i:6
  + │    │    │    │    │    │    ├── key: (5)
  + │    │    │    │    │    │    └── fd: (5)-->(6)
  + │    │    │    │    │    └── filters
  + │    │    │    │    │         ├── k:5 = x:1 [outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ]), fd=(1)==(5), (5)==(1)]
  + │    │    │    │    │         └── (i:6 = 5) IS NOT false [outer=(6)]
    │    │    │    │    └── projections
    │    │    │    │         └── i:6 IS NOT NULL [as=notnull:13, outer=(6)]
    │    │    │    └── aggregations
    │    │    │         └── bool-or [as=bool_or:14, outer=(13)]
    │    │    │              └── notnull:13
    │    │    └── projections
    │    │         └── CASE WHEN bool_or:14 AND true THEN true WHEN bool_or:14 IS NULL THEN false ELSE CAST(NULL AS BOOL) END [as=case:15, outer=(14)]
    │    └── filters (true)
    └── projections
         └── case:15 [as=r:12, outer=(15)]
================================================================================
SimplifyAndTrue
  Cost: 2209.73
================================================================================
   project
    ├── columns: r:12
    ├── inner-join-apply
    │    ├── columns: x:1!null case:15
    │    ├── key: (1)
    │    ├── fd: (1)-->(15)
    │    ├── scan xy
    │    │    ├── columns: x:1!null
    │    │    └── key: (1)
    │    ├── project
    │    │    ├── columns: case:15
    │    │    ├── outer: (1)
    │    │    ├── cardinality: [1 - 1]
    │    │    ├── key: ()
    │    │    ├── fd: ()-->(15)
    │    │    ├── scalar-group-by
    │    │    │    ├── columns: bool_or:14
    │    │    │    ├── outer: (1)
    │    │    │    ├── cardinality: [1 - 1]
    │    │    │    ├── key: ()
    │    │    │    ├── fd: ()-->(14)
    │    │    │    ├── project
    │    │    │    │    ├── columns: notnull:13!null
    │    │    │    │    ├── outer: (1)
    │    │    │    │    ├── cardinality: [0 - 1]
    │    │    │    │    ├── key: ()
    │    │    │    │    ├── fd: ()-->(13)
    │    │    │    │    ├── select
    │    │    │    │    │    ├── columns: k:5!null i:6
    │    │    │    │    │    ├── outer: (1)
    │    │    │    │    │    ├── cardinality: [0 - 1]
    │    │    │    │    │    ├── key: ()
    │    │    │    │    │    ├── fd: ()-->(5,6)
    │    │    │    │    │    ├── scan a
    │    │    │    │    │    │    ├── columns: k:5!null i:6
    │    │    │    │    │    │    ├── key: (5)
    │    │    │    │    │    │    └── fd: (5)-->(6)
    │    │    │    │    │    └── filters
    │    │    │    │    │         ├── k:5 = x:1 [outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ]), fd=(1)==(5), (5)==(1)]
    │    │    │    │    │         └── (i:6 = 5) IS NOT false [outer=(6)]
    │    │    │    │    └── projections
    │    │    │    │         └── i:6 IS NOT NULL [as=notnull:13, outer=(6)]
    │    │    │    └── aggregations
    │    │    │         └── bool-or [as=bool_or:14, outer=(13)]
    │    │    │              └── notnull:13
    │    │    └── projections
  - │    │         └── CASE WHEN bool_or:14 AND true THEN true WHEN bool_or:14 IS NULL THEN false ELSE CAST(NULL AS BOOL) END [as=case:15, outer=(14)]
  + │    │         └── CASE WHEN bool_or:14 THEN true WHEN bool_or:14 IS NULL THEN false ELSE CAST(NULL AS BOOL) END [as=case:15, outer=(14)]
    │    └── filters (true)
    └── projections
         └── case:15 [as=r:12, outer=(15)]
================================================================================
TryDecorrelateProject
  Cost: 2239.74
================================================================================
   project
    ├── columns: r:12
  - ├── inner-join-apply
  + ├── select
    │    ├── columns: x:1!null case:15
    │    ├── key: (1)
    │    ├── fd: (1)-->(15)
  - │    ├── scan xy
  - │    │    ├── columns: x:1!null
  - │    │    └── key: (1)
    │    ├── project
  - │    │    ├── columns: case:15
  - │    │    ├── outer: (1)
  - │    │    ├── cardinality: [1 - 1]
  - │    │    ├── key: ()
  - │    │    ├── fd: ()-->(15)
  - │    │    ├── scalar-group-by
  - │    │    │    ├── columns: bool_or:14
  - │    │    │    ├── outer: (1)
  - │    │    │    ├── cardinality: [1 - 1]
  - │    │    │    ├── key: ()
  - │    │    │    ├── fd: ()-->(14)
  - │    │    │    ├── project
  - │    │    │    │    ├── columns: notnull:13!null
  + │    │    ├── columns: case:15 x:1!null
  + │    │    ├── key: (1)
  + │    │    ├── fd: (1)-->(15)
  + │    │    ├── inner-join-apply
  + │    │    │    ├── columns: x:1!null bool_or:14
  + │    │    │    ├── key: (1)
  + │    │    │    ├── fd: (1)-->(14)
  + │    │    │    ├── scan xy
  + │    │    │    │    ├── columns: x:1!null
  + │    │    │    │    └── key: (1)
  + │    │    │    ├── scalar-group-by
  + │    │    │    │    ├── columns: bool_or:14
    │    │    │    │    ├── outer: (1)
  - │    │    │    │    ├── cardinality: [0 - 1]
  + │    │    │    │    ├── cardinality: [1 - 1]
    │    │    │    │    ├── key: ()
  - │    │    │    │    ├── fd: ()-->(13)
  - │    │    │    │    ├── select
  - │    │    │    │    │    ├── columns: k:5!null i:6
  + │    │    │    │    ├── fd: ()-->(14)
  + │    │    │    │    ├── project
  + │    │    │    │    │    ├── columns: notnull:13!null
    │    │    │    │    │    ├── outer: (1)
    │    │    │    │    │    ├── cardinality: [0 - 1]
    │    │    │    │    │    ├── key: ()
  - │    │    │    │    │    ├── fd: ()-->(5,6)
  - │    │    │    │    │    ├── scan a
  + │    │    │    │    │    ├── fd: ()-->(13)
  + │    │    │    │    │    ├── select
    │    │    │    │    │    │    ├── columns: k:5!null i:6
  - │    │    │    │    │    │    ├── key: (5)
  - │    │    │    │    │    │    └── fd: (5)-->(6)
  - │    │    │    │    │    └── filters
  - │    │    │    │    │         ├── k:5 = x:1 [outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ]), fd=(1)==(5), (5)==(1)]
  - │    │    │    │    │         └── (i:6 = 5) IS NOT false [outer=(6)]
  - │    │    │    │    └── projections
  - │    │    │    │         └── i:6 IS NOT NULL [as=notnull:13, outer=(6)]
  - │    │    │    └── aggregations
  - │    │    │         └── bool-or [as=bool_or:14, outer=(13)]
  - │    │    │              └── notnull:13
  + │    │    │    │    │    │    ├── outer: (1)
  + │    │    │    │    │    │    ├── cardinality: [0 - 1]
  + │    │    │    │    │    │    ├── key: ()
  + │    │    │    │    │    │    ├── fd: ()-->(5,6)
  + │    │    │    │    │    │    ├── scan a
  + │    │    │    │    │    │    │    ├── columns: k:5!null i:6
  + │    │    │    │    │    │    │    ├── key: (5)
  + │    │    │    │    │    │    │    └── fd: (5)-->(6)
  + │    │    │    │    │    │    └── filters
  + │    │    │    │    │    │         ├── k:5 = x:1 [outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ]), fd=(1)==(5), (5)==(1)]
  + │    │    │    │    │    │         └── (i:6 = 5) IS NOT false [outer=(6)]
  + │    │    │    │    │    └── projections
  + │    │    │    │    │         └── i:6 IS NOT NULL [as=notnull:13, outer=(6)]
  + │    │    │    │    └── aggregations
  + │    │    │    │         └── bool-or [as=bool_or:14, outer=(13)]
  + │    │    │    │              └── notnull:13
  + │    │    │    └── filters (true)
    │    │    └── projections
    │    │         └── CASE WHEN bool_or:14 THEN true WHEN bool_or:14 IS NULL THEN false ELSE CAST(NULL AS BOOL) END [as=case:15, outer=(14)]
    │    └── filters (true)
    └── projections
         └── case:15 [as=r:12, outer=(15)]
================================================================================
TryDecorrelateScalarGroupBy
  Cost: 2299.91
================================================================================
   project
    ├── columns: r:12
    ├── select
    │    ├── columns: x:1!null case:15
    │    ├── key: (1)
    │    ├── fd: (1)-->(15)
    │    ├── project
    │    │    ├── columns: case:15 x:1!null
    │    │    ├── key: (1)
    │    │    ├── fd: (1)-->(15)
  - │    │    ├── inner-join-apply
  + │    │    ├── select
    │    │    │    ├── columns: x:1!null bool_or:14
    │    │    │    ├── key: (1)
    │    │    │    ├── fd: (1)-->(14)
  - │    │    │    ├── scan xy
  - │    │    │    │    ├── columns: x:1!null
  - │    │    │    │    └── key: (1)
  - │    │    │    ├── scalar-group-by
  - │    │    │    │    ├── columns: bool_or:14
  - │    │    │    │    ├── outer: (1)
  - │    │    │    │    ├── cardinality: [1 - 1]
  - │    │    │    │    ├── key: ()
  - │    │    │    │    ├── fd: ()-->(14)
  - │    │    │    │    ├── project
  - │    │    │    │    │    ├── columns: notnull:13!null
  - │    │    │    │    │    ├── outer: (1)
  - │    │    │    │    │    ├── cardinality: [0 - 1]
  - │    │    │    │    │    ├── key: ()
  - │    │    │    │    │    ├── fd: ()-->(13)
  - │    │    │    │    │    ├── select
  - │    │    │    │    │    │    ├── columns: k:5!null i:6
  - │    │    │    │    │    │    ├── outer: (1)
  - │    │    │    │    │    │    ├── cardinality: [0 - 1]
  - │    │    │    │    │    │    ├── key: ()
  - │    │    │    │    │    │    ├── fd: ()-->(5,6)
  - │    │    │    │    │    │    ├── scan a
  - │    │    │    │    │    │    │    ├── columns: k:5!null i:6
  - │    │    │    │    │    │    │    ├── key: (5)
  - │    │    │    │    │    │    │    └── fd: (5)-->(6)
  - │    │    │    │    │    │    └── filters
  - │    │    │    │    │    │         ├── k:5 = x:1 [outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ]), fd=(1)==(5), (5)==(1)]
  - │    │    │    │    │    │         └── (i:6 = 5) IS NOT false [outer=(6)]
  - │    │    │    │    │    └── projections
  - │    │    │    │    │         └── i:6 IS NOT NULL [as=notnull:13, outer=(6)]
  - │    │    │    │    └── aggregations
  - │    │    │    │         └── bool-or [as=bool_or:14, outer=(13)]
  - │    │    │    │              └── notnull:13
  + │    │    │    ├── project
  + │    │    │    │    ├── columns: x:1!null bool_or:14
  + │    │    │    │    ├── key: (1)
  + │    │    │    │    ├── fd: (1)-->(14)
  + │    │    │    │    └── group-by (hash)
  + │    │    │    │         ├── columns: x:1!null bool_or:14
  + │    │    │    │         ├── grouping columns: x:1!null
  + │    │    │    │         ├── key: (1)
  + │    │    │    │         ├── fd: (1)-->(14)
  + │    │    │    │         ├── left-join-apply
  + │    │    │    │         │    ├── columns: x:1!null notnull:13
  + │    │    │    │         │    ├── key: (1)
  + │    │    │    │         │    ├── fd: (1)-->(13)
  + │    │    │    │         │    ├── scan xy
  + │    │    │    │         │    │    ├── columns: x:1!null
  + │    │    │    │         │    │    └── key: (1)
  + │    │    │    │         │    ├── project
  + │    │    │    │         │    │    ├── columns: notnull:13!null
  + │    │    │    │         │    │    ├── outer: (1)
  + │    │    │    │         │    │    ├── cardinality: [0 - 1]
  + │    │    │    │         │    │    ├── key: ()
  + │    │    │    │         │    │    ├── fd: ()-->(13)
  + │    │    │    │         │    │    ├── select
  + │    │    │    │         │    │    │    ├── columns: k:5!null i:6
  + │    │    │    │         │    │    │    ├── outer: (1)
  + │    │    │    │         │    │    │    ├── cardinality: [0 - 1]
  + │    │    │    │         │    │    │    ├── key: ()
  + │    │    │    │         │    │    │    ├── fd: ()-->(5,6)
  + │    │    │    │         │    │    │    ├── scan a
  + │    │    │    │         │    │    │    │    ├── columns: k:5!null i:6
  + │    │    │    │         │    │    │    │    ├── key: (5)
  + │    │    │    │         │    │    │    │    └── fd: (5)-->(6)
  + │    │    │    │         │    │    │    └── filters
  + │    │    │    │         │    │    │         ├── k:5 = x:1 [outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ]), fd=(1)==(5), (5)==(1)]
  + │    │    │    │         │    │    │         └── (i:6 = 5) IS NOT false [outer=(6)]
  + │    │    │    │         │    │    └── projections
  + │    │    │    │         │    │         └── i:6 IS NOT NULL [as=notnull:13, outer=(6)]
  + │    │    │    │         │    └── filters (true)
  + │    │    │    │         └── aggregations
  + │    │    │    │              └── bool-or [as=bool_or:14, outer=(13)]
  + │    │    │    │                   └── notnull:13
    │    │    │    └── filters (true)
    │    │    └── projections
    │    │         └── CASE WHEN bool_or:14 THEN true WHEN bool_or:14 IS NULL THEN false ELSE CAST(NULL AS BOOL) END [as=case:15, outer=(14)]
    │    └── filters (true)
    └── projections
         └── case:15 [as=r:12, outer=(15)]
================================================================================
TryDecorrelateProjectSelect
  Cost: 2337.53
================================================================================
   project
    ├── columns: r:12
    ├── select
    │    ├── columns: x:1!null case:15
    │    ├── key: (1)
    │    ├── fd: (1)-->(15)
    │    ├── project
    │    │    ├── columns: case:15 x:1!null
    │    │    ├── key: (1)
    │    │    ├── fd: (1)-->(15)
    │    │    ├── select
    │    │    │    ├── columns: x:1!null bool_or:14
    │    │    │    ├── key: (1)
    │    │    │    ├── fd: (1)-->(14)
    │    │    │    ├── project
    │    │    │    │    ├── columns: x:1!null bool_or:14
    │    │    │    │    ├── key: (1)
    │    │    │    │    ├── fd: (1)-->(14)
    │    │    │    │    └── group-by (hash)
    │    │    │    │         ├── columns: x:1!null bool_or:14
    │    │    │    │         ├── grouping columns: x:1!null
    │    │    │    │         ├── key: (1)
    │    │    │    │         ├── fd: (1)-->(14)
  - │    │    │    │         ├── left-join-apply
  + │    │    │    │         ├── project
    │    │    │    │         │    ├── columns: x:1!null notnull:13
    │    │    │    │         │    ├── key: (1)
    │    │    │    │         │    ├── fd: (1)-->(13)
  - │    │    │    │         │    ├── scan xy
  - │    │    │    │         │    │    ├── columns: x:1!null
  - │    │    │    │         │    │    └── key: (1)
  - │    │    │    │         │    ├── project
  - │    │    │    │         │    │    ├── columns: notnull:13!null
  - │    │    │    │         │    │    ├── outer: (1)
  - │    │    │    │         │    │    ├── cardinality: [0 - 1]
  - │    │    │    │         │    │    ├── key: ()
  - │    │    │    │         │    │    ├── fd: ()-->(13)
  - │    │    │    │         │    │    ├── select
  - │    │    │    │         │    │    │    ├── columns: k:5!null i:6
  - │    │    │    │         │    │    │    ├── outer: (1)
  - │    │    │    │         │    │    │    ├── cardinality: [0 - 1]
  - │    │    │    │         │    │    │    ├── key: ()
  - │    │    │    │         │    │    │    ├── fd: ()-->(5,6)
  - │    │    │    │         │    │    │    ├── scan a
  - │    │    │    │         │    │    │    │    ├── columns: k:5!null i:6
  - │    │    │    │         │    │    │    │    ├── key: (5)
  - │    │    │    │         │    │    │    │    └── fd: (5)-->(6)
  - │    │    │    │         │    │    │    └── filters
  - │    │    │    │         │    │    │         ├── k:5 = x:1 [outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ]), fd=(1)==(5), (5)==(1)]
  - │    │    │    │         │    │    │         └── (i:6 = 5) IS NOT false [outer=(6)]
  - │    │    │    │         │    │    └── projections
  - │    │    │    │         │    │         └── i:6 IS NOT NULL [as=notnull:13, outer=(6)]
  - │    │    │    │         │    └── filters (true)
  + │    │    │    │         │    └── left-join-apply
  + │    │    │    │         │         ├── columns: x:1!null k:5 i:6 notnull:13
  + │    │    │    │         │         ├── key: (1)
  + │    │    │    │         │         ├── fd: (1)-->(5,6,13)
  + │    │    │    │         │         ├── scan xy
  + │    │    │    │         │         │    ├── columns: x:1!null
  + │    │    │    │         │         │    └── key: (1)
  + │    │    │    │         │         ├── project
  + │    │    │    │         │         │    ├── columns: notnull:13!null k:5!null i:6
  + │    │    │    │         │         │    ├── key: (5)
  + │    │    │    │         │         │    ├── fd: (5)-->(6), (6)-->(13)
  + │    │    │    │         │         │    ├── scan a
  + │    │    │    │         │         │    │    ├── columns: k:5!null i:6
  + │    │    │    │         │         │    │    ├── key: (5)
  + │    │    │    │         │         │    │    └── fd: (5)-->(6)
  + │    │    │    │         │         │    └── projections
  + │    │    │    │         │         │         └── i:6 IS NOT NULL [as=notnull:13, outer=(6)]
  + │    │    │    │         │         └── filters
  + │    │    │    │         │              ├── k:5 = x:1 [outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ]), fd=(1)==(5), (5)==(1)]
  + │    │    │    │         │              └── (i:6 = 5) IS NOT false [outer=(6)]
    │    │    │    │         └── aggregations
    │    │    │    │              └── bool-or [as=bool_or:14, outer=(13)]
    │    │    │    │                   └── notnull:13
    │    │    │    └── filters (true)
    │    │    └── projections
    │    │         └── CASE WHEN bool_or:14 THEN true WHEN bool_or:14 IS NULL THEN false ELSE CAST(NULL AS BOOL) END [as=case:15, outer=(14)]
    │    └── filters (true)
    └── projections
         └── case:15 [as=r:12, outer=(15)]
================================================================================
DecorrelateJoin
  Cost: 2337.53
================================================================================
   project
    ├── columns: r:12
    ├── select
    │    ├── columns: x:1!null case:15
    │    ├── key: (1)
    │    ├── fd: (1)-->(15)
    │    ├── project
    │    │    ├── columns: case:15 x:1!null
    │    │    ├── key: (1)
    │    │    ├── fd: (1)-->(15)
    │    │    ├── select
    │    │    │    ├── columns: x:1!null bool_or:14
    │    │    │    ├── key: (1)
    │    │    │    ├── fd: (1)-->(14)
    │    │    │    ├── project
    │    │    │    │    ├── columns: x:1!null bool_or:14
    │    │    │    │    ├── key: (1)
    │    │    │    │    ├── fd: (1)-->(14)
    │    │    │    │    └── group-by (hash)
    │    │    │    │         ├── columns: x:1!null bool_or:14
    │    │    │    │         ├── grouping columns: x:1!null
    │    │    │    │         ├── key: (1)
    │    │    │    │         ├── fd: (1)-->(14)
    │    │    │    │         ├── project
    │    │    │    │         │    ├── columns: x:1!null notnull:13
    │    │    │    │         │    ├── key: (1)
    │    │    │    │         │    ├── fd: (1)-->(13)
  - │    │    │    │         │    └── left-join-apply
  + │    │    │    │         │    └── left-join (hash)
    │    │    │    │         │         ├── columns: x:1!null k:5 i:6 notnull:13
  + │    │    │    │         │         ├── multiplicity: left-rows(exactly-one), right-rows(zero-or-one)
    │    │    │    │         │         ├── key: (1)
  - │    │    │    │         │         ├── fd: (1)-->(5,6,13)
  + │    │    │    │         │         ├── fd: (5)-->(6), (6)~~>(13), (1)-->(5,6,13)
    │    │    │    │         │         ├── scan xy
    │    │    │    │         │         │    ├── columns: x:1!null
    │    │    │    │         │         │    └── key: (1)
    │    │    │    │         │         ├── project
    │    │    │    │         │         │    ├── columns: notnull:13!null k:5!null i:6
    │    │    │    │         │         │    ├── key: (5)
    │    │    │    │         │         │    ├── fd: (5)-->(6), (6)-->(13)
    │    │    │    │         │         │    ├── scan a
    │    │    │    │         │         │    │    ├── columns: k:5!null i:6
    │    │    │    │         │         │    │    ├── key: (5)
    │    │    │    │         │         │    │    └── fd: (5)-->(6)
    │    │    │    │         │         │    └── projections
    │    │    │    │         │         │         └── i:6 IS NOT NULL [as=notnull:13, outer=(6)]
    │    │    │    │         │         └── filters
    │    │    │    │         │              ├── k:5 = x:1 [outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ]), fd=(1)==(5), (5)==(1)]
    │    │    │    │         │              └── (i:6 = 5) IS NOT false [outer=(6)]
    │    │    │    │         └── aggregations
    │    │    │    │              └── bool-or [as=bool_or:14, outer=(13)]
    │    │    │    │                   └── notnull:13
    │    │    │    └── filters (true)
    │    │    └── projections
    │    │         └── CASE WHEN bool_or:14 THEN true WHEN bool_or:14 IS NULL THEN false ELSE CAST(NULL AS BOOL) END [as=case:15, outer=(14)]
    │    └── filters (true)
    └── projections
         └── case:15 [as=r:12, outer=(15)]
================================================================================
PushFilterIntoJoinRight
  Cost: 2335.75
================================================================================
   project
    ├── columns: r:12
    ├── select
    │    ├── columns: x:1!null case:15
    │    ├── key: (1)
    │    ├── fd: (1)-->(15)
    │    ├── project
    │    │    ├── columns: case:15 x:1!null
    │    │    ├── key: (1)
    │    │    ├── fd: (1)-->(15)
    │    │    ├── select
    │    │    │    ├── columns: x:1!null bool_or:14
    │    │    │    ├── key: (1)
    │    │    │    ├── fd: (1)-->(14)
    │    │    │    ├── project
    │    │    │    │    ├── columns: x:1!null bool_or:14
    │    │    │    │    ├── key: (1)
    │    │    │    │    ├── fd: (1)-->(14)
    │    │    │    │    └── group-by (hash)
    │    │    │    │         ├── columns: x:1!null bool_or:14
    │    │    │    │         ├── grouping columns: x:1!null
    │    │    │    │         ├── key: (1)
    │    │    │    │         ├── fd: (1)-->(14)
    │    │    │    │         ├── project
    │    │    │    │         │    ├── columns: x:1!null notnull:13
    │    │    │    │         │    ├── key: (1)
    │    │    │    │         │    ├── fd: (1)-->(13)
    │    │    │    │         │    └── left-join (hash)
    │    │    │    │         │         ├── columns: x:1!null k:5 i:6 notnull:13
    │    │    │    │         │         ├── multiplicity: left-rows(exactly-one), right-rows(zero-or-one)
    │    │    │    │         │         ├── key: (1)
    │    │    │    │         │         ├── fd: (5)-->(6), (6)~~>(13), (1)-->(5,6,13)
    │    │    │    │         │         ├── scan xy
    │    │    │    │         │         │    ├── columns: x:1!null
    │    │    │    │         │         │    └── key: (1)
  - │    │    │    │         │         ├── project
  - │    │    │    │         │         │    ├── columns: notnull:13!null k:5!null i:6
  + │    │    │    │         │         ├── select
  + │    │    │    │         │         │    ├── columns: k:5!null i:6 notnull:13!null
    │    │    │    │         │         │    ├── key: (5)
    │    │    │    │         │         │    ├── fd: (5)-->(6), (6)-->(13)
  - │    │    │    │         │         │    ├── scan a
  - │    │    │    │         │         │    │    ├── columns: k:5!null i:6
  + │    │    │    │         │         │    ├── project
  + │    │    │    │         │         │    │    ├── columns: notnull:13!null k:5!null i:6
    │    │    │    │         │         │    │    ├── key: (5)
  - │    │    │    │         │         │    │    └── fd: (5)-->(6)
  - │    │    │    │         │         │    └── projections
  - │    │    │    │         │         │         └── i:6 IS NOT NULL [as=notnull:13, outer=(6)]
  + │    │    │    │         │         │    │    ├── fd: (5)-->(6), (6)-->(13)
  + │    │    │    │         │         │    │    ├── scan a
  + │    │    │    │         │         │    │    │    ├── columns: k:5!null i:6
  + │    │    │    │         │         │    │    │    ├── key: (5)
  + │    │    │    │         │         │    │    │    └── fd: (5)-->(6)
  + │    │    │    │         │         │    │    └── projections
  + │    │    │    │         │         │    │         └── i:6 IS NOT NULL [as=notnull:13, outer=(6)]
  + │    │    │    │         │         │    └── filters
  + │    │    │    │         │         │         └── (i:6 = 5) IS NOT false [outer=(6)]
    │    │    │    │         │         └── filters
  - │    │    │    │         │              ├── k:5 = x:1 [outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ]), fd=(1)==(5), (5)==(1)]
  - │    │    │    │         │              └── (i:6 = 5) IS NOT false [outer=(6)]
  + │    │    │    │         │              └── k:5 = x:1 [outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ]), fd=(1)==(5), (5)==(1)]
    │    │    │    │         └── aggregations
    │    │    │    │              └── bool-or [as=bool_or:14, outer=(13)]
    │    │    │    │                   └── notnull:13
    │    │    │    └── filters (true)
    │    │    └── projections
    │    │         └── CASE WHEN bool_or:14 THEN true WHEN bool_or:14 IS NULL THEN false ELSE CAST(NULL AS BOOL) END [as=case:15, outer=(14)]
    │    └── filters (true)
    └── projections
         └── case:15 [as=r:12, outer=(15)]
================================================================================
PushSelectIntoProject
  Cost: 2325.77
================================================================================
   project
    ├── columns: r:12
    ├── select
    │    ├── columns: x:1!null case:15
    │    ├── key: (1)
    │    ├── fd: (1)-->(15)
    │    ├── project
    │    │    ├── columns: case:15 x:1!null
    │    │    ├── key: (1)
    │    │    ├── fd: (1)-->(15)
    │    │    ├── select
    │    │    │    ├── columns: x:1!null bool_or:14
    │    │    │    ├── key: (1)
    │    │    │    ├── fd: (1)-->(14)
    │    │    │    ├── project
    │    │    │    │    ├── columns: x:1!null bool_or:14
    │    │    │    │    ├── key: (1)
    │    │    │    │    ├── fd: (1)-->(14)
    │    │    │    │    └── group-by (hash)
    │    │    │    │         ├── columns: x:1!null bool_or:14
    │    │    │    │         ├── grouping columns: x:1!null
    │    │    │    │         ├── key: (1)
    │    │    │    │         ├── fd: (1)-->(14)
    │    │    │    │         ├── project
    │    │    │    │         │    ├── columns: x:1!null notnull:13
    │    │    │    │         │    ├── key: (1)
    │    │    │    │         │    ├── fd: (1)-->(13)
    │    │    │    │         │    └── left-join (hash)
    │    │    │    │         │         ├── columns: x:1!null k:5 i:6 notnull:13
    │    │    │    │         │         ├── multiplicity: left-rows(exactly-one), right-rows(zero-or-one)
    │    │    │    │         │         ├── key: (1)
    │    │    │    │         │         ├── fd: (5)-->(6), (6)~~>(13), (1)-->(5,6,13)
    │    │    │    │         │         ├── scan xy
    │    │    │    │         │         │    ├── columns: x:1!null
    │    │    │    │         │         │    └── key: (1)
    │    │    │    │         │         ├── select
    │    │    │    │         │         │    ├── columns: k:5!null i:6 notnull:13!null
    │    │    │    │         │         │    ├── key: (5)
    │    │    │    │         │         │    ├── fd: (5)-->(6), (6)-->(13)
    │    │    │    │         │         │    ├── project
    │    │    │    │         │         │    │    ├── columns: notnull:13!null k:5!null i:6
    │    │    │    │         │         │    │    ├── key: (5)
    │    │    │    │         │         │    │    ├── fd: (5)-->(6), (6)-->(13)
  - │    │    │    │         │         │    │    ├── scan a
  + │    │    │    │         │         │    │    ├── select
    │    │    │    │         │         │    │    │    ├── columns: k:5!null i:6
    │    │    │    │         │         │    │    │    ├── key: (5)
  - │    │    │    │         │         │    │    │    └── fd: (5)-->(6)
  + │    │    │    │         │         │    │    │    ├── fd: (5)-->(6)
  + │    │    │    │         │         │    │    │    ├── scan a
  + │    │    │    │         │         │    │    │    │    ├── columns: k:5!null i:6
  + │    │    │    │         │         │    │    │    │    ├── key: (5)
  + │    │    │    │         │         │    │    │    │    └── fd: (5)-->(6)
  + │    │    │    │         │         │    │    │    └── filters
  + │    │    │    │         │         │    │    │         └── (i:6 = 5) IS NOT false [outer=(6)]
    │    │    │    │         │         │    │    └── projections
    │    │    │    │         │         │    │         └── i:6 IS NOT NULL [as=notnull:13, outer=(6)]
  - │    │    │    │         │         │    └── filters
  - │    │    │    │         │         │         └── (i:6 = 5) IS NOT false [outer=(6)]
  + │    │    │    │         │         │    └── filters (true)
    │    │    │    │         │         └── filters
    │    │    │    │         │              └── k:5 = x:1 [outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ]), fd=(1)==(5), (5)==(1)]
    │    │    │    │         └── aggregations
    │    │    │    │              └── bool-or [as=bool_or:14, outer=(13)]
    │    │    │    │                   └── notnull:13
    │    │    │    └── filters (true)
    │    │    └── projections
    │    │         └── CASE WHEN bool_or:14 THEN true WHEN bool_or:14 IS NULL THEN false ELSE CAST(NULL AS BOOL) END [as=case:15, outer=(14)]
    │    └── filters (true)
    └── projections
         └── case:15 [as=r:12, outer=(15)]
================================================================================
EliminateSelect
  Cost: 2322.42
================================================================================
   project
    ├── columns: r:12
    ├── select
    │    ├── columns: x:1!null case:15
    │    ├── key: (1)
    │    ├── fd: (1)-->(15)
    │    ├── project
    │    │    ├── columns: case:15 x:1!null
    │    │    ├── key: (1)
    │    │    ├── fd: (1)-->(15)
    │    │    ├── select
    │    │    │    ├── columns: x:1!null bool_or:14
    │    │    │    ├── key: (1)
    │    │    │    ├── fd: (1)-->(14)
    │    │    │    ├── project
    │    │    │    │    ├── columns: x:1!null bool_or:14
    │    │    │    │    ├── key: (1)
    │    │    │    │    ├── fd: (1)-->(14)
    │    │    │    │    └── group-by (hash)
    │    │    │    │         ├── columns: x:1!null bool_or:14
    │    │    │    │         ├── grouping columns: x:1!null
    │    │    │    │         ├── key: (1)
    │    │    │    │         ├── fd: (1)-->(14)
    │    │    │    │         ├── project
    │    │    │    │         │    ├── columns: x:1!null notnull:13
    │    │    │    │         │    ├── key: (1)
    │    │    │    │         │    ├── fd: (1)-->(13)
    │    │    │    │         │    └── left-join (hash)
    │    │    │    │         │         ├── columns: x:1!null k:5 i:6 notnull:13
    │    │    │    │         │         ├── multiplicity: left-rows(exactly-one), right-rows(zero-or-one)
    │    │    │    │         │         ├── key: (1)
    │    │    │    │         │         ├── fd: (5)-->(6), (6)~~>(13), (1)-->(5,6,13)
    │    │    │    │         │         ├── scan xy
    │    │    │    │         │         │    ├── columns: x:1!null
    │    │    │    │         │         │    └── key: (1)
  - │    │    │    │         │         ├── select
  - │    │    │    │         │         │    ├── columns: k:5!null i:6 notnull:13!null
  + │    │    │    │         │         ├── project
  + │    │    │    │         │         │    ├── columns: notnull:13!null k:5!null i:6
    │    │    │    │         │         │    ├── key: (5)
    │    │    │    │         │         │    ├── fd: (5)-->(6), (6)-->(13)
  - │    │    │    │         │         │    ├── project
  - │    │    │    │         │         │    │    ├── columns: notnull:13!null k:5!null i:6
  + │    │    │    │         │         │    ├── select
  + │    │    │    │         │         │    │    ├── columns: k:5!null i:6
    │    │    │    │         │         │    │    ├── key: (5)
  - │    │    │    │         │         │    │    ├── fd: (5)-->(6), (6)-->(13)
  - │    │    │    │         │         │    │    ├── select
  + │    │    │    │         │         │    │    ├── fd: (5)-->(6)
  + │    │    │    │         │         │    │    ├── scan a
    │    │    │    │         │         │    │    │    ├── columns: k:5!null i:6
    │    │    │    │         │         │    │    │    ├── key: (5)
  - │    │    │    │         │         │    │    │    ├── fd: (5)-->(6)
  - │    │    │    │         │         │    │    │    ├── scan a
  - │    │    │    │         │         │    │    │    │    ├── columns: k:5!null i:6
  - │    │    │    │         │         │    │    │    │    ├── key: (5)
  - │    │    │    │         │         │    │    │    │    └── fd: (5)-->(6)
  - │    │    │    │         │         │    │    │    └── filters
  - │    │    │    │         │         │    │    │         └── (i:6 = 5) IS NOT false [outer=(6)]
  - │    │    │    │         │         │    │    └── projections
  - │    │    │    │         │         │    │         └── i:6 IS NOT NULL [as=notnull:13, outer=(6)]
  - │    │    │    │         │         │    └── filters (true)
  + │    │    │    │         │         │    │    │    └── fd: (5)-->(6)
  + │    │    │    │         │         │    │    └── filters
  + │    │    │    │         │         │    │         └── (i:6 = 5) IS NOT false [outer=(6)]
  + │    │    │    │         │         │    └── projections
  + │    │    │    │         │         │         └── i:6 IS NOT NULL [as=notnull:13, outer=(6)]
    │    │    │    │         │         └── filters
    │    │    │    │         │              └── k:5 = x:1 [outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ]), fd=(1)==(5), (5)==(1)]
    │    │    │    │         └── aggregations
    │    │    │    │              └── bool-or [as=bool_or:14, outer=(13)]
    │    │    │    │                   └── notnull:13
    │    │    │    └── filters (true)
    │    │    └── projections
    │    │         └── CASE WHEN bool_or:14 THEN true WHEN bool_or:14 IS NULL THEN false ELSE CAST(NULL AS BOOL) END [as=case:15, outer=(14)]
    │    └── filters (true)
    └── projections
         └── case:15 [as=r:12, outer=(15)]
================================================================================
PruneJoinRightCols
  Cost: 2322.42
================================================================================
   project
    ├── columns: r:12
    ├── select
    │    ├── columns: x:1!null case:15
    │    ├── key: (1)
    │    ├── fd: (1)-->(15)
    │    ├── project
    │    │    ├── columns: case:15 x:1!null
    │    │    ├── key: (1)
    │    │    ├── fd: (1)-->(15)
    │    │    ├── select
    │    │    │    ├── columns: x:1!null bool_or:14
    │    │    │    ├── key: (1)
    │    │    │    ├── fd: (1)-->(14)
    │    │    │    ├── project
    │    │    │    │    ├── columns: x:1!null bool_or:14
    │    │    │    │    ├── key: (1)
    │    │    │    │    ├── fd: (1)-->(14)
    │    │    │    │    └── group-by (hash)
    │    │    │    │         ├── columns: x:1!null bool_or:14
    │    │    │    │         ├── grouping columns: x:1!null
    │    │    │    │         ├── key: (1)
    │    │    │    │         ├── fd: (1)-->(14)
    │    │    │    │         ├── project
    │    │    │    │         │    ├── columns: x:1!null notnull:13
    │    │    │    │         │    ├── key: (1)
    │    │    │    │         │    ├── fd: (1)-->(13)
    │    │    │    │         │    └── left-join (hash)
  - │    │    │    │         │         ├── columns: x:1!null k:5 i:6 notnull:13
  + │    │    │    │         │         ├── columns: x:1!null k:5 notnull:13
    │    │    │    │         │         ├── multiplicity: left-rows(exactly-one), right-rows(zero-or-one)
    │    │    │    │         │         ├── key: (1)
  - │    │    │    │         │         ├── fd: (5)-->(6), (6)~~>(13), (1)-->(5,6,13)
  + │    │    │    │         │         ├── fd: (5)-->(13), (1)-->(5,13)
    │    │    │    │         │         ├── scan xy
    │    │    │    │         │         │    ├── columns: x:1!null
    │    │    │    │         │         │    └── key: (1)
    │    │    │    │         │         ├── project
  - │    │    │    │         │         │    ├── columns: notnull:13!null k:5!null i:6
  + │    │    │    │         │         │    ├── columns: notnull:13!null k:5!null
    │    │    │    │         │         │    ├── key: (5)
  - │    │    │    │         │         │    ├── fd: (5)-->(6), (6)-->(13)
  + │    │    │    │         │         │    ├── fd: (5)-->(13)
    │    │    │    │         │         │    ├── select
    │    │    │    │         │         │    │    ├── columns: k:5!null i:6
    │    │    │    │         │         │    │    ├── key: (5)
    │    │    │    │         │         │    │    ├── fd: (5)-->(6)
    │    │    │    │         │         │    │    ├── scan a
    │    │    │    │         │         │    │    │    ├── columns: k:5!null i:6
    │    │    │    │         │         │    │    │    ├── key: (5)
    │    │    │    │         │         │    │    │    └── fd: (5)-->(6)
    │    │    │    │         │         │    │    └── filters
    │    │    │    │         │         │    │         └── (i:6 = 5) IS NOT false [outer=(6)]
    │    │    │    │         │         │    └── projections
    │    │    │    │         │         │         └── i:6 IS NOT NULL [as=notnull:13, outer=(6)]
    │    │    │    │         │         └── filters
    │    │    │    │         │              └── k:5 = x:1 [outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ]), fd=(1)==(5), (5)==(1)]
    │    │    │    │         └── aggregations
    │    │    │    │              └── bool-or [as=bool_or:14, outer=(13)]
    │    │    │    │                   └── notnull:13
    │    │    │    └── filters (true)
    │    │    └── projections
    │    │         └── CASE WHEN bool_or:14 THEN true WHEN bool_or:14 IS NULL THEN false ELSE CAST(NULL AS BOOL) END [as=case:15, outer=(14)]
    │    └── filters (true)
    └── projections
         └── case:15 [as=r:12, outer=(15)]
================================================================================
EliminateGroupByProject
  Cost: 2312.40
================================================================================
   project
    ├── columns: r:12
    ├── select
    │    ├── columns: x:1!null case:15
    │    ├── key: (1)
    │    ├── fd: (1)-->(15)
    │    ├── project
    │    │    ├── columns: case:15 x:1!null
    │    │    ├── key: (1)
    │    │    ├── fd: (1)-->(15)
    │    │    ├── select
    │    │    │    ├── columns: x:1!null bool_or:14
    │    │    │    ├── key: (1)
    │    │    │    ├── fd: (1)-->(14)
    │    │    │    ├── project
    │    │    │    │    ├── columns: x:1!null bool_or:14
    │    │    │    │    ├── key: (1)
    │    │    │    │    ├── fd: (1)-->(14)
    │    │    │    │    └── group-by (hash)
    │    │    │    │         ├── columns: x:1!null bool_or:14
    │    │    │    │         ├── grouping columns: x:1!null
    │    │    │    │         ├── key: (1)
    │    │    │    │         ├── fd: (1)-->(14)
  - │    │    │    │         ├── project
  - │    │    │    │         │    ├── columns: x:1!null notnull:13
  + │    │    │    │         ├── left-join (hash)
  + │    │    │    │         │    ├── columns: x:1!null k:5 notnull:13
  + │    │    │    │         │    ├── multiplicity: left-rows(exactly-one), right-rows(zero-or-one)
    │    │    │    │         │    ├── key: (1)
  - │    │    │    │         │    ├── fd: (1)-->(13)
  - │    │    │    │         │    └── left-join (hash)
  - │    │    │    │         │         ├── columns: x:1!null k:5 notnull:13
  - │    │    │    │         │         ├── multiplicity: left-rows(exactly-one), right-rows(zero-or-one)
  - │    │    │    │         │         ├── key: (1)
  - │    │    │    │         │         ├── fd: (5)-->(13), (1)-->(5,13)
  - │    │    │    │         │         ├── scan xy
  - │    │    │    │         │         │    ├── columns: x:1!null
  - │    │    │    │         │         │    └── key: (1)
  - │    │    │    │         │         ├── project
  - │    │    │    │         │         │    ├── columns: notnull:13!null k:5!null
  - │    │    │    │         │         │    ├── key: (5)
  - │    │    │    │         │         │    ├── fd: (5)-->(13)
  - │    │    │    │         │         │    ├── select
  - │    │    │    │         │         │    │    ├── columns: k:5!null i:6
  - │    │    │    │         │         │    │    ├── key: (5)
  - │    │    │    │         │         │    │    ├── fd: (5)-->(6)
  - │    │    │    │         │         │    │    ├── scan a
  - │    │    │    │         │         │    │    │    ├── columns: k:5!null i:6
  - │    │    │    │         │         │    │    │    ├── key: (5)
  - │    │    │    │         │         │    │    │    └── fd: (5)-->(6)
  - │    │    │    │         │         │    │    └── filters
  - │    │    │    │         │         │    │         └── (i:6 = 5) IS NOT false [outer=(6)]
  - │    │    │    │         │         │    └── projections
  - │    │    │    │         │         │         └── i:6 IS NOT NULL [as=notnull:13, outer=(6)]
  - │    │    │    │         │         └── filters
  - │    │    │    │         │              └── k:5 = x:1 [outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ]), fd=(1)==(5), (5)==(1)]
  + │    │    │    │         │    ├── fd: (5)-->(13), (1)-->(5,13)
  + │    │    │    │         │    ├── scan xy
  + │    │    │    │         │    │    ├── columns: x:1!null
  + │    │    │    │         │    │    └── key: (1)
  + │    │    │    │         │    ├── project
  + │    │    │    │         │    │    ├── columns: notnull:13!null k:5!null
  + │    │    │    │         │    │    ├── key: (5)
  + │    │    │    │         │    │    ├── fd: (5)-->(13)
  + │    │    │    │         │    │    ├── select
  + │    │    │    │         │    │    │    ├── columns: k:5!null i:6
  + │    │    │    │         │    │    │    ├── key: (5)
  + │    │    │    │         │    │    │    ├── fd: (5)-->(6)
  + │    │    │    │         │    │    │    ├── scan a
  + │    │    │    │         │    │    │    │    ├── columns: k:5!null i:6
  + │    │    │    │         │    │    │    │    ├── key: (5)
  + │    │    │    │         │    │    │    │    └── fd: (5)-->(6)
  + │    │    │    │         │    │    │    └── filters
  + │    │    │    │         │    │    │         └── (i:6 = 5) IS NOT false [outer=(6)]
  + │    │    │    │         │    │    └── projections
  + │    │    │    │         │    │         └── i:6 IS NOT NULL [as=notnull:13, outer=(6)]
  + │    │    │    │         │    └── filters
  + │    │    │    │         │         └── k:5 = x:1 [outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ]), fd=(1)==(5), (5)==(1)]
    │    │    │    │         └── aggregations
    │    │    │    │              └── bool-or [as=bool_or:14, outer=(13)]
    │    │    │    │                   └── notnull:13
    │    │    │    └── filters (true)
    │    │    └── projections
    │    │         └── CASE WHEN bool_or:14 THEN true WHEN bool_or:14 IS NULL THEN false ELSE CAST(NULL AS BOOL) END [as=case:15, outer=(14)]
    │    └── filters (true)
    └── projections
         └── case:15 [as=r:12, outer=(15)]
================================================================================
EliminateProject
  Cost: 2302.38
================================================================================
   project
    ├── columns: r:12
    ├── select
    │    ├── columns: x:1!null case:15
    │    ├── key: (1)
    │    ├── fd: (1)-->(15)
    │    ├── project
    │    │    ├── columns: case:15 x:1!null
    │    │    ├── key: (1)
    │    │    ├── fd: (1)-->(15)
    │    │    ├── select
    │    │    │    ├── columns: x:1!null bool_or:14
    │    │    │    ├── key: (1)
    │    │    │    ├── fd: (1)-->(14)
  - │    │    │    ├── project
  + │    │    │    ├── group-by (hash)
    │    │    │    │    ├── columns: x:1!null bool_or:14
  + │    │    │    │    ├── grouping columns: x:1!null
    │    │    │    │    ├── key: (1)
    │    │    │    │    ├── fd: (1)-->(14)
  - │    │    │    │    └── group-by (hash)
  - │    │    │    │         ├── columns: x:1!null bool_or:14
  - │    │    │    │         ├── grouping columns: x:1!null
  - │    │    │    │         ├── key: (1)
  - │    │    │    │         ├── fd: (1)-->(14)
  - │    │    │    │         ├── left-join (hash)
  - │    │    │    │         │    ├── columns: x:1!null k:5 notnull:13
  - │    │    │    │         │    ├── multiplicity: left-rows(exactly-one), right-rows(zero-or-one)
  - │    │    │    │         │    ├── key: (1)
  - │    │    │    │         │    ├── fd: (5)-->(13), (1)-->(5,13)
  - │    │    │    │         │    ├── scan xy
  - │    │    │    │         │    │    ├── columns: x:1!null
  - │    │    │    │         │    │    └── key: (1)
  - │    │    │    │         │    ├── project
  - │    │    │    │         │    │    ├── columns: notnull:13!null k:5!null
  - │    │    │    │         │    │    ├── key: (5)
  - │    │    │    │         │    │    ├── fd: (5)-->(13)
  - │    │    │    │         │    │    ├── select
  - │    │    │    │         │    │    │    ├── columns: k:5!null i:6
  - │    │    │    │         │    │    │    ├── key: (5)
  - │    │    │    │         │    │    │    ├── fd: (5)-->(6)
  - │    │    │    │         │    │    │    ├── scan a
  - │    │    │    │         │    │    │    │    ├── columns: k:5!null i:6
  - │    │    │    │         │    │    │    │    ├── key: (5)
  - │    │    │    │         │    │    │    │    └── fd: (5)-->(6)
  - │    │    │    │         │    │    │    └── filters
  - │    │    │    │         │    │    │         └── (i:6 = 5) IS NOT false [outer=(6)]
  - │    │    │    │         │    │    └── projections
  - │    │    │    │         │    │         └── i:6 IS NOT NULL [as=notnull:13, outer=(6)]
  - │    │    │    │         │    └── filters
  - │    │    │    │         │         └── k:5 = x:1 [outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ]), fd=(1)==(5), (5)==(1)]
  - │    │    │    │         └── aggregations
  - │    │    │    │              └── bool-or [as=bool_or:14, outer=(13)]
  - │    │    │    │                   └── notnull:13
  + │    │    │    │    ├── left-join (hash)
  + │    │    │    │    │    ├── columns: x:1!null k:5 notnull:13
  + │    │    │    │    │    ├── multiplicity: left-rows(exactly-one), right-rows(zero-or-one)
  + │    │    │    │    │    ├── key: (1)
  + │    │    │    │    │    ├── fd: (5)-->(13), (1)-->(5,13)
  + │    │    │    │    │    ├── scan xy
  + │    │    │    │    │    │    ├── columns: x:1!null
  + │    │    │    │    │    │    └── key: (1)
  + │    │    │    │    │    ├── project
  + │    │    │    │    │    │    ├── columns: notnull:13!null k:5!null
  + │    │    │    │    │    │    ├── key: (5)
  + │    │    │    │    │    │    ├── fd: (5)-->(13)
  + │    │    │    │    │    │    ├── select
  + │    │    │    │    │    │    │    ├── columns: k:5!null i:6
  + │    │    │    │    │    │    │    ├── key: (5)
  + │    │    │    │    │    │    │    ├── fd: (5)-->(6)
  + │    │    │    │    │    │    │    ├── scan a
  + │    │    │    │    │    │    │    │    ├── columns: k:5!null i:6
  + │    │    │    │    │    │    │    │    ├── key: (5)
  + │    │    │    │    │    │    │    │    └── fd: (5)-->(6)
  + │    │    │    │    │    │    │    └── filters
  + │    │    │    │    │    │    │         └── (i:6 = 5) IS NOT false [outer=(6)]
  + │    │    │    │    │    │    └── projections
  + │    │    │    │    │    │         └── i:6 IS NOT NULL [as=notnull:13, outer=(6)]
  + │    │    │    │    │    └── filters
  + │    │    │    │    │         └── k:5 = x:1 [outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ]), fd=(1)==(5), (5)==(1)]
  + │    │    │    │    └── aggregations
  + │    │    │    │         └── bool-or [as=bool_or:14, outer=(13)]
  + │    │    │    │              └── notnull:13
    │    │    │    └── filters (true)
    │    │    └── projections
    │    │         └── CASE WHEN bool_or:14 THEN true WHEN bool_or:14 IS NULL THEN false ELSE CAST(NULL AS BOOL) END [as=case:15, outer=(14)]
    │    └── filters (true)
    └── projections
         └── case:15 [as=r:12, outer=(15)]
================================================================================
EliminateSelect
  Cost: 2292.36
================================================================================
   project
    ├── columns: r:12
    ├── select
    │    ├── columns: x:1!null case:15
    │    ├── key: (1)
    │    ├── fd: (1)-->(15)
    │    ├── project
    │    │    ├── columns: case:15 x:1!null
    │    │    ├── key: (1)
    │    │    ├── fd: (1)-->(15)
  - │    │    ├── select
  + │    │    ├── group-by (hash)
    │    │    │    ├── columns: x:1!null bool_or:14
  + │    │    │    ├── grouping columns: x:1!null
    │    │    │    ├── key: (1)
    │    │    │    ├── fd: (1)-->(14)
  - │    │    │    ├── group-by (hash)
  - │    │    │    │    ├── columns: x:1!null bool_or:14
  - │    │    │    │    ├── grouping columns: x:1!null
  + │    │    │    ├── left-join (hash)
  + │    │    │    │    ├── columns: x:1!null k:5 notnull:13
  + │    │    │    │    ├── multiplicity: left-rows(exactly-one), right-rows(zero-or-one)
    │    │    │    │    ├── key: (1)
  - │    │    │    │    ├── fd: (1)-->(14)
  - │    │    │    │    ├── left-join (hash)
  - │    │    │    │    │    ├── columns: x:1!null k:5 notnull:13
  - │    │    │    │    │    ├── multiplicity: left-rows(exactly-one), right-rows(zero-or-one)
  - │    │    │    │    │    ├── key: (1)
  - │    │    │    │    │    ├── fd: (5)-->(13), (1)-->(5,13)
  - │    │    │    │    │    ├── scan xy
  - │    │    │    │    │    │    ├── columns: x:1!null
  - │    │    │    │    │    │    └── key: (1)
  - │    │    │    │    │    ├── project
  - │    │    │    │    │    │    ├── columns: notnull:13!null k:5!null
  + │    │    │    │    ├── fd: (5)-->(13), (1)-->(5,13)
  + │    │    │    │    ├── scan xy
  + │    │    │    │    │    ├── columns: x:1!null
  + │    │    │    │    │    └── key: (1)
  + │    │    │    │    ├── project
  + │    │    │    │    │    ├── columns: notnull:13!null k:5!null
  + │    │    │    │    │    ├── key: (5)
  + │    │    │    │    │    ├── fd: (5)-->(13)
  + │    │    │    │    │    ├── select
  + │    │    │    │    │    │    ├── columns: k:5!null i:6
    │    │    │    │    │    │    ├── key: (5)
  - │    │    │    │    │    │    ├── fd: (5)-->(13)
  - │    │    │    │    │    │    ├── select
  + │    │    │    │    │    │    ├── fd: (5)-->(6)
  + │    │    │    │    │    │    ├── scan a
    │    │    │    │    │    │    │    ├── columns: k:5!null i:6
    │    │    │    │    │    │    │    ├── key: (5)
  - │    │    │    │    │    │    │    ├── fd: (5)-->(6)
  - │    │    │    │    │    │    │    ├── scan a
  - │    │    │    │    │    │    │    │    ├── columns: k:5!null i:6
  - │    │    │    │    │    │    │    │    ├── key: (5)
  - │    │    │    │    │    │    │    │    └── fd: (5)-->(6)
  - │    │    │    │    │    │    │    └── filters
  - │    │    │    │    │    │    │         └── (i:6 = 5) IS NOT false [outer=(6)]
  - │    │    │    │    │    │    └── projections
  - │    │    │    │    │    │         └── i:6 IS NOT NULL [as=notnull:13, outer=(6)]
  - │    │    │    │    │    └── filters
  - │    │    │    │    │         └── k:5 = x:1 [outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ]), fd=(1)==(5), (5)==(1)]
  - │    │    │    │    └── aggregations
  - │    │    │    │         └── bool-or [as=bool_or:14, outer=(13)]
  - │    │    │    │              └── notnull:13
  - │    │    │    └── filters (true)
  + │    │    │    │    │    │    │    └── fd: (5)-->(6)
  + │    │    │    │    │    │    └── filters
  + │    │    │    │    │    │         └── (i:6 = 5) IS NOT false [outer=(6)]
  + │    │    │    │    │    └── projections
  + │    │    │    │    │         └── i:6 IS NOT NULL [as=notnull:13, outer=(6)]
  + │    │    │    │    └── filters
  + │    │    │    │         └── k:5 = x:1 [outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ]), fd=(1)==(5), (5)==(1)]
  + │    │    │    └── aggregations
  + │    │    │         └── bool-or [as=bool_or:14, outer=(13)]
  + │    │    │              └── notnull:13
    │    │    └── projections
    │    │         └── CASE WHEN bool_or:14 THEN true WHEN bool_or:14 IS NULL THEN false ELSE CAST(NULL AS BOOL) END [as=case:15, outer=(14)]
    │    └── filters (true)
    └── projections
         └── case:15 [as=r:12, outer=(15)]
================================================================================
EliminateSelect
  Cost: 2282.34
================================================================================
   project
    ├── columns: r:12
  - ├── select
  - │    ├── columns: x:1!null case:15
  + ├── project
  + │    ├── columns: case:15 x:1!null
    │    ├── key: (1)
    │    ├── fd: (1)-->(15)
  - │    ├── project
  - │    │    ├── columns: case:15 x:1!null
  + │    ├── group-by (hash)
  + │    │    ├── columns: x:1!null bool_or:14
  + │    │    ├── grouping columns: x:1!null
    │    │    ├── key: (1)
  - │    │    ├── fd: (1)-->(15)
  - │    │    ├── group-by (hash)
  - │    │    │    ├── columns: x:1!null bool_or:14
  - │    │    │    ├── grouping columns: x:1!null
  + │    │    ├── fd: (1)-->(14)
  + │    │    ├── left-join (hash)
  + │    │    │    ├── columns: x:1!null k:5 notnull:13
  + │    │    │    ├── multiplicity: left-rows(exactly-one), right-rows(zero-or-one)
    │    │    │    ├── key: (1)
  - │    │    │    ├── fd: (1)-->(14)
  - │    │    │    ├── left-join (hash)
  - │    │    │    │    ├── columns: x:1!null k:5 notnull:13
  - │    │    │    │    ├── multiplicity: left-rows(exactly-one), right-rows(zero-or-one)
  - │    │    │    │    ├── key: (1)
  - │    │    │    │    ├── fd: (5)-->(13), (1)-->(5,13)
  - │    │    │    │    ├── scan xy
  - │    │    │    │    │    ├── columns: x:1!null
  - │    │    │    │    │    └── key: (1)
  - │    │    │    │    ├── project
  - │    │    │    │    │    ├── columns: notnull:13!null k:5!null
  + │    │    │    ├── fd: (5)-->(13), (1)-->(5,13)
  + │    │    │    ├── scan xy
  + │    │    │    │    ├── columns: x:1!null
  + │    │    │    │    └── key: (1)
  + │    │    │    ├── project
  + │    │    │    │    ├── columns: notnull:13!null k:5!null
  + │    │    │    │    ├── key: (5)
  + │    │    │    │    ├── fd: (5)-->(13)
  + │    │    │    │    ├── select
  + │    │    │    │    │    ├── columns: k:5!null i:6
    │    │    │    │    │    ├── key: (5)
  - │    │    │    │    │    ├── fd: (5)-->(13)
  - │    │    │    │    │    ├── select
  + │    │    │    │    │    ├── fd: (5)-->(6)
  + │    │    │    │    │    ├── scan a
    │    │    │    │    │    │    ├── columns: k:5!null i:6
    │    │    │    │    │    │    ├── key: (5)
  - │    │    │    │    │    │    ├── fd: (5)-->(6)
  - │    │    │    │    │    │    ├── scan a
  - │    │    │    │    │    │    │    ├── columns: k:5!null i:6
  - │    │    │    │    │    │    │    ├── key: (5)
  - │    │    │    │    │    │    │    └── fd: (5)-->(6)
  - │    │    │    │    │    │    └── filters
  - │    │    │    │    │    │         └── (i:6 = 5) IS NOT false [outer=(6)]
  - │    │    │    │    │    └── projections
  - │    │    │    │    │         └── i:6 IS NOT NULL [as=notnull:13, outer=(6)]
  - │    │    │    │    └── filters
  - │    │    │    │         └── k:5 = x:1 [outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ]), fd=(1)==(5), (5)==(1)]
  - │    │    │    └── aggregations
  - │    │    │         └── bool-or [as=bool_or:14, outer=(13)]
  - │    │    │              └── notnull:13
  - │    │    └── projections
  - │    │         └── CASE WHEN bool_or:14 THEN true WHEN bool_or:14 IS NULL THEN false ELSE CAST(NULL AS BOOL) END [as=case:15, outer=(14)]
  - │    └── filters (true)
  + │    │    │    │    │    │    └── fd: (5)-->(6)
  + │    │    │    │    │    └── filters
  + │    │    │    │    │         └── (i:6 = 5) IS NOT false [outer=(6)]
  + │    │    │    │    └── projections
  + │    │    │    │         └── i:6 IS NOT NULL [as=notnull:13, outer=(6)]
  + │    │    │    └── filters
  + │    │    │         └── k:5 = x:1 [outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ]), fd=(1)==(5), (5)==(1)]
  + │    │    └── aggregations
  + │    │         └── bool-or [as=bool_or:14, outer=(13)]
  + │    │              └── notnull:13
  + │    └── projections
  + │         └── CASE WHEN bool_or:14 THEN true WHEN bool_or:14 IS NULL THEN false ELSE CAST(NULL AS BOOL) END [as=case:15, outer=(14)]
    └── projections
         └── case:15 [as=r:12, outer=(15)]
================================================================================
PruneProjectCols
  Cost: 2282.34
================================================================================
   project
    ├── columns: r:12
    ├── project
  - │    ├── columns: case:15 x:1!null
  - │    ├── key: (1)
  - │    ├── fd: (1)-->(15)
  + │    ├── columns: case:15
    │    ├── group-by (hash)
    │    │    ├── columns: x:1!null bool_or:14
    │    │    ├── grouping columns: x:1!null
    │    │    ├── key: (1)
    │    │    ├── fd: (1)-->(14)
    │    │    ├── left-join (hash)
    │    │    │    ├── columns: x:1!null k:5 notnull:13
    │    │    │    ├── multiplicity: left-rows(exactly-one), right-rows(zero-or-one)
    │    │    │    ├── key: (1)
    │    │    │    ├── fd: (5)-->(13), (1)-->(5,13)
    │    │    │    ├── scan xy
    │    │    │    │    ├── columns: x:1!null
    │    │    │    │    └── key: (1)
    │    │    │    ├── project
    │    │    │    │    ├── columns: notnull:13!null k:5!null
    │    │    │    │    ├── key: (5)
    │    │    │    │    ├── fd: (5)-->(13)
    │    │    │    │    ├── select
    │    │    │    │    │    ├── columns: k:5!null i:6
    │    │    │    │    │    ├── key: (5)
    │    │    │    │    │    ├── fd: (5)-->(6)
    │    │    │    │    │    ├── scan a
    │    │    │    │    │    │    ├── columns: k:5!null i:6
    │    │    │    │    │    │    ├── key: (5)
    │    │    │    │    │    │    └── fd: (5)-->(6)
    │    │    │    │    │    └── filters
    │    │    │    │    │         └── (i:6 = 5) IS NOT false [outer=(6)]
    │    │    │    │    └── projections
    │    │    │    │         └── i:6 IS NOT NULL [as=notnull:13, outer=(6)]
    │    │    │    └── filters
    │    │    │         └── k:5 = x:1 [outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ]), fd=(1)==(5), (5)==(1)]
    │    │    └── aggregations
    │    │         └── bool-or [as=bool_or:14, outer=(13)]
    │    │              └── notnull:13
    │    └── projections
    │         └── CASE WHEN bool_or:14 THEN true WHEN bool_or:14 IS NULL THEN false ELSE CAST(NULL AS BOOL) END [as=case:15, outer=(14)]
    └── projections
         └── case:15 [as=r:12, outer=(15)]
================================================================================
InlineProjectInProject
  Cost: 2262.32
================================================================================
   project
    ├── columns: r:12
  - ├── project
  - │    ├── columns: case:15
  - │    ├── group-by (hash)
  - │    │    ├── columns: x:1!null bool_or:14
  - │    │    ├── grouping columns: x:1!null
  + ├── group-by (hash)
  + │    ├── columns: x:1!null bool_or:14
  + │    ├── grouping columns: x:1!null
  + │    ├── key: (1)
  + │    ├── fd: (1)-->(14)
  + │    ├── left-join (hash)
  + │    │    ├── columns: x:1!null k:5 notnull:13
  + │    │    ├── multiplicity: left-rows(exactly-one), right-rows(zero-or-one)
    │    │    ├── key: (1)
  - │    │    ├── fd: (1)-->(14)
  - │    │    ├── left-join (hash)
  - │    │    │    ├── columns: x:1!null k:5 notnull:13
  - │    │    │    ├── multiplicity: left-rows(exactly-one), right-rows(zero-or-one)
  - │    │    │    ├── key: (1)
  - │    │    │    ├── fd: (5)-->(13), (1)-->(5,13)
  - │    │    │    ├── scan xy
  - │    │    │    │    ├── columns: x:1!null
  - │    │    │    │    └── key: (1)
  - │    │    │    ├── project
  - │    │    │    │    ├── columns: notnull:13!null k:5!null
  + │    │    ├── fd: (5)-->(13), (1)-->(5,13)
  + │    │    ├── scan xy
  + │    │    │    ├── columns: x:1!null
  + │    │    │    └── key: (1)
  + │    │    ├── project
  + │    │    │    ├── columns: notnull:13!null k:5!null
  + │    │    │    ├── key: (5)
  + │    │    │    ├── fd: (5)-->(13)
  + │    │    │    ├── select
  + │    │    │    │    ├── columns: k:5!null i:6
    │    │    │    │    ├── key: (5)
  - │    │    │    │    ├── fd: (5)-->(13)
  - │    │    │    │    ├── select
  + │    │    │    │    ├── fd: (5)-->(6)
  + │    │    │    │    ├── scan a
    │    │    │    │    │    ├── columns: k:5!null i:6
    │    │    │    │    │    ├── key: (5)
  - │    │    │    │    │    ├── fd: (5)-->(6)
  - │    │    │    │    │    ├── scan a
  - │    │    │    │    │    │    ├── columns: k:5!null i:6
  - │    │    │    │    │    │    ├── key: (5)
  - │    │    │    │    │    │    └── fd: (5)-->(6)
  - │    │    │    │    │    └── filters
  - │    │    │    │    │         └── (i:6 = 5) IS NOT false [outer=(6)]
  - │    │    │    │    └── projections
  - │    │    │    │         └── i:6 IS NOT NULL [as=notnull:13, outer=(6)]
  - │    │    │    └── filters
  - │    │    │         └── k:5 = x:1 [outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ]), fd=(1)==(5), (5)==(1)]
  - │    │    └── aggregations
  - │    │         └── bool-or [as=bool_or:14, outer=(13)]
  - │    │              └── notnull:13
  - │    └── projections
  - │         └── CASE WHEN bool_or:14 THEN true WHEN bool_or:14 IS NULL THEN false ELSE CAST(NULL AS BOOL) END [as=case:15, outer=(14)]
  + │    │    │    │    │    └── fd: (5)-->(6)
  + │    │    │    │    └── filters
  + │    │    │    │         └── (i:6 = 5) IS NOT false [outer=(6)]
  + │    │    │    └── projections
  + │    │    │         └── i:6 IS NOT NULL [as=notnull:13, outer=(6)]
  + │    │    └── filters
  + │    │         └── k:5 = x:1 [outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ]), fd=(1)==(5), (5)==(1)]
  + │    └── aggregations
  + │         └── bool-or [as=bool_or:14, outer=(13)]
  + │              └── notnull:13
    └── projections
  -      └── case:15 [as=r:12, outer=(15)]
  +      └── CASE WHEN bool_or:14 THEN true WHEN bool_or:14 IS NULL THEN false ELSE CAST(NULL AS BOOL) END [as=r:12, outer=(14)]
--------------------------------------------------------------------------------
GenerateIndexScans (no changes)
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
GenerateIndexScans (no changes)
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
GeneratePartialIndexScans (no changes)
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
GenerateConstrainedScans (no changes)
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
GenerateZigzagJoins (no changes)
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
ReorderJoins (no changes)
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
CommuteLeftJoin (higher cost)
--------------------------------------------------------------------------------
   project
    ├── columns: r:12
    ├── group-by (hash)
    │    ├── columns: x:1!null bool_or:14
    │    ├── grouping columns: x:1!null
    │    ├── key: (1)
    │    ├── fd: (1)-->(14)
  - │    ├── left-join (hash)
  + │    ├── right-join (hash)
    │    │    ├── columns: x:1!null k:5 notnull:13
  - │    │    ├── multiplicity: left-rows(exactly-one), right-rows(zero-or-one)
    │    │    ├── key: (1)
    │    │    ├── fd: (5)-->(13), (1)-->(5,13)
  - │    │    ├── scan xy
  - │    │    │    ├── columns: x:1!null
  - │    │    │    └── key: (1)
    │    │    ├── project
    │    │    │    ├── columns: notnull:13!null k:5!null
    │    │    │    ├── key: (5)
    │    │    │    ├── fd: (5)-->(13)
    │    │    │    ├── select
    │    │    │    │    ├── columns: k:5!null i:6
    │    │    │    │    ├── key: (5)
    │    │    │    │    ├── fd: (5)-->(6)
    │    │    │    │    ├── scan a
    │    │    │    │    │    ├── columns: k:5!null i:6
    │    │    │    │    │    ├── key: (5)
    │    │    │    │    │    └── fd: (5)-->(6)
    │    │    │    │    └── filters
    │    │    │    │         └── (i:6 = 5) IS NOT false [outer=(6)]
    │    │    │    └── projections
    │    │    │         └── i:6 IS NOT NULL [as=notnull:13, outer=(6)]
  + │    │    ├── scan xy
  + │    │    │    ├── columns: x:1!null
  + │    │    │    └── key: (1)
    │    │    └── filters
    │    │         └── k:5 = x:1 [outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ]), fd=(1)==(5), (5)==(1)]
    │    └── aggregations
    │         └── bool-or [as=bool_or:14, outer=(13)]
    │              └── notnull:13
    └── projections
         └── CASE WHEN bool_or:14 THEN true WHEN bool_or:14 IS NULL THEN false ELSE CAST(NULL AS BOOL) END [as=r:12, outer=(14)]
================================================================================
GenerateMergeJoins
  Cost: 2256.64
================================================================================
   project
    ├── columns: r:12
    ├── group-by (hash)
    │    ├── columns: x:1!null bool_or:14
    │    ├── grouping columns: x:1!null
    │    ├── key: (1)
    │    ├── fd: (1)-->(14)
  - │    ├── left-join (hash)
  + │    ├── left-join (merge)
    │    │    ├── columns: x:1!null k:5 notnull:13
  - │    │    ├── multiplicity: left-rows(exactly-one), right-rows(zero-or-one)
  + │    │    ├── left ordering: +1
  + │    │    ├── right ordering: +5
    │    │    ├── key: (1)
    │    │    ├── fd: (5)-->(13), (1)-->(5,13)
    │    │    ├── scan xy
    │    │    │    ├── columns: x:1!null
  - │    │    │    └── key: (1)
  + │    │    │    ├── key: (1)
  + │    │    │    └── ordering: +1
    │    │    ├── project
    │    │    │    ├── columns: notnull:13!null k:5!null
    │    │    │    ├── key: (5)
    │    │    │    ├── fd: (5)-->(13)
  + │    │    │    ├── ordering: +5
    │    │    │    ├── select
    │    │    │    │    ├── columns: k:5!null i:6
    │    │    │    │    ├── key: (5)
    │    │    │    │    ├── fd: (5)-->(6)
  + │    │    │    │    ├── ordering: +5
    │    │    │    │    ├── scan a
    │    │    │    │    │    ├── columns: k:5!null i:6
    │    │    │    │    │    ├── key: (5)
  - │    │    │    │    │    └── fd: (5)-->(6)
  + │    │    │    │    │    ├── fd: (5)-->(6)
  + │    │    │    │    │    └── ordering: +5
    │    │    │    │    └── filters
    │    │    │    │         └── (i:6 = 5) IS NOT false [outer=(6)]
    │    │    │    └── projections
    │    │    │         └── i:6 IS NOT NULL [as=notnull:13, outer=(6)]
  - │    │    └── filters
  - │    │         └── k:5 = x:1 [outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ]), fd=(1)==(5), (5)==(1)]
  + │    │    └── filters (true)
    │    └── aggregations
    │         └── bool-or [as=bool_or:14, outer=(13)]
    │              └── notnull:13
    └── projections
         └── CASE WHEN bool_or:14 THEN true WHEN bool_or:14 IS NULL THEN false ELSE CAST(NULL AS BOOL) END [as=r:12, outer=(14)]
--------------------------------------------------------------------------------
HoistProjectFromLeftJoin (higher cost)
--------------------------------------------------------------------------------
   project
    ├── columns: r:12
    ├── group-by (hash)
    │    ├── columns: x:1!null bool_or:14
    │    ├── grouping columns: x:1!null
    │    ├── key: (1)
    │    ├── fd: (1)-->(14)
  - │    ├── left-join (merge)
  - │    │    ├── columns: x:1!null k:5 notnull:13
  - │    │    ├── left ordering: +1
  - │    │    ├── right ordering: +5
  + │    ├── project
  + │    │    ├── columns: notnull:13 x:1!null k:5
    │    │    ├── key: (1)
    │    │    ├── fd: (5)-->(13), (1)-->(5,13)
  - │    │    ├── scan xy
  - │    │    │    ├── columns: x:1!null
  + │    │    ├── left-join (hash)
  + │    │    │    ├── columns: x:1!null k:5 i:6
  + │    │    │    ├── multiplicity: left-rows(exactly-one), right-rows(zero-or-one)
    │    │    │    ├── key: (1)
  - │    │    │    └── ordering: +1
  - │    │    ├── project
  - │    │    │    ├── columns: notnull:13!null k:5!null
  - │    │    │    ├── key: (5)
  - │    │    │    ├── fd: (5)-->(13)
  - │    │    │    ├── ordering: +5
  + │    │    │    ├── fd: (5)-->(6), (1)-->(5,6)
  + │    │    │    ├── scan xy
  + │    │    │    │    ├── columns: x:1!null
  + │    │    │    │    └── key: (1)
    │    │    │    ├── select
    │    │    │    │    ├── columns: k:5!null i:6
    │    │    │    │    ├── key: (5)
    │    │    │    │    ├── fd: (5)-->(6)
  - │    │    │    │    ├── ordering: +5
    │    │    │    │    ├── scan a
    │    │    │    │    │    ├── columns: k:5!null i:6
    │    │    │    │    │    ├── key: (5)
  - │    │    │    │    │    ├── fd: (5)-->(6)
  - │    │    │    │    │    └── ordering: +5
  + │    │    │    │    │    └── fd: (5)-->(6)
    │    │    │    │    └── filters
    │    │    │    │         └── (i:6 = 5) IS NOT false [outer=(6)]
  - │    │    │    └── projections
  - │    │    │         └── i:6 IS NOT NULL [as=notnull:13, outer=(6)]
  - │    │    └── filters (true)
  + │    │    │    └── filters
  + │    │    │         └── k:5 = x:1 [outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ]), fd=(1)==(5), (5)==(1)]
  + │    │    └── projections
  + │    │         └── CASE k:5 IS NULL WHEN true THEN CAST(NULL AS BOOL) ELSE i:6 IS NOT NULL END [as=notnull:13, outer=(5,6)]
    │    └── aggregations
    │         └── bool-or [as=bool_or:14, outer=(13)]
    │              └── notnull:13
    └── projections
         └── CASE WHEN bool_or:14 THEN true WHEN bool_or:14 IS NULL THEN false ELSE CAST(NULL AS BOOL) END [as=r:12, outer=(14)]
--------------------------------------------------------------------------------
ReorderJoins (no changes)
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
CommuteLeftJoin (higher cost)
--------------------------------------------------------------------------------
   project
    ├── columns: r:12
    ├── group-by (hash)
    │    ├── columns: x:1!null bool_or:14
    │    ├── grouping columns: x:1!null
    │    ├── key: (1)
    │    ├── fd: (1)-->(14)
    │    ├── project
    │    │    ├── columns: notnull:13 x:1!null k:5
    │    │    ├── key: (1)
    │    │    ├── fd: (5)-->(13), (1)-->(5,13)
  - │    │    ├── left-join (hash)
  + │    │    ├── right-join (hash)
    │    │    │    ├── columns: x:1!null k:5 i:6
  - │    │    │    ├── multiplicity: left-rows(exactly-one), right-rows(zero-or-one)
    │    │    │    ├── key: (1)
    │    │    │    ├── fd: (5)-->(6), (1)-->(5,6)
  - │    │    │    ├── scan xy
  - │    │    │    │    ├── columns: x:1!null
  - │    │    │    │    └── key: (1)
    │    │    │    ├── select
    │    │    │    │    ├── columns: k:5!null i:6
    │    │    │    │    ├── key: (5)
    │    │    │    │    ├── fd: (5)-->(6)
    │    │    │    │    ├── scan a
    │    │    │    │    │    ├── columns: k:5!null i:6
    │    │    │    │    │    ├── key: (5)
    │    │    │    │    │    └── fd: (5)-->(6)
    │    │    │    │    └── filters
    │    │    │    │         └── (i:6 = 5) IS NOT false [outer=(6)]
  + │    │    │    ├── scan xy
  + │    │    │    │    ├── columns: x:1!null
  + │    │    │    │    └── key: (1)
    │    │    │    └── filters
    │    │    │         └── k:5 = x:1 [outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ]), fd=(1)==(5), (5)==(1)]
    │    │    └── projections
    │    │         └── CASE k:5 IS NULL WHEN true THEN CAST(NULL AS BOOL) ELSE i:6 IS NOT NULL END [as=notnull:13, outer=(5,6)]
    │    └── aggregations
    │         └── bool-or [as=bool_or:14, outer=(13)]
    │              └── notnull:13
    └── projections
         └── CASE WHEN bool_or:14 THEN true WHEN bool_or:14 IS NULL THEN false ELSE CAST(NULL AS BOOL) END [as=r:12, outer=(14)]
--------------------------------------------------------------------------------
GenerateMergeJoins (higher cost)
--------------------------------------------------------------------------------
   project
    ├── columns: r:12
    ├── group-by (hash)
    │    ├── columns: x:1!null bool_or:14
    │    ├── grouping columns: x:1!null
    │    ├── key: (1)
    │    ├── fd: (1)-->(14)
    │    ├── project
    │    │    ├── columns: notnull:13 x:1!null k:5
    │    │    ├── key: (1)
    │    │    ├── fd: (5)-->(13), (1)-->(5,13)
  - │    │    ├── right-join (hash)
  + │    │    ├── left-join (merge)
    │    │    │    ├── columns: x:1!null k:5 i:6
  + │    │    │    ├── left ordering: +1
  + │    │    │    ├── right ordering: +5
    │    │    │    ├── key: (1)
    │    │    │    ├── fd: (5)-->(6), (1)-->(5,6)
  + │    │    │    ├── scan xy
  + │    │    │    │    ├── columns: x:1!null
  + │    │    │    │    ├── key: (1)
  + │    │    │    │    └── ordering: +1
    │    │    │    ├── select
    │    │    │    │    ├── columns: k:5!null i:6
    │    │    │    │    ├── key: (5)
    │    │    │    │    ├── fd: (5)-->(6)
  + │    │    │    │    ├── ordering: +5
    │    │    │    │    ├── scan a
    │    │    │    │    │    ├── columns: k:5!null i:6
    │    │    │    │    │    ├── key: (5)
  - │    │    │    │    │    └── fd: (5)-->(6)
  + │    │    │    │    │    ├── fd: (5)-->(6)
  + │    │    │    │    │    └── ordering: +5
    │    │    │    │    └── filters
    │    │    │    │         └── (i:6 = 5) IS NOT false [outer=(6)]
  - │    │    │    ├── scan xy
  - │    │    │    │    ├── columns: x:1!null
  - │    │    │    │    └── key: (1)
  - │    │    │    └── filters
  - │    │    │         └── k:5 = x:1 [outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ]), fd=(1)==(5), (5)==(1)]
  + │    │    │    └── filters (true)
    │    │    └── projections
    │    │         └── CASE k:5 IS NULL WHEN true THEN CAST(NULL AS BOOL) ELSE i:6 IS NOT NULL END [as=notnull:13, outer=(5,6)]
    │    └── aggregations
    │         └── bool-or [as=bool_or:14, outer=(13)]
    │              └── notnull:13
    └── projections
         └── CASE WHEN bool_or:14 THEN true WHEN bool_or:14 IS NULL THEN false ELSE CAST(NULL AS BOOL) END [as=r:12, outer=(14)]
--------------------------------------------------------------------------------
GenerateLookupJoinsWithFilter (higher cost)
--------------------------------------------------------------------------------
   project
    ├── columns: r:12
    ├── group-by (hash)
    │    ├── columns: x:1!null bool_or:14
    │    ├── grouping columns: x:1!null
    │    ├── key: (1)
    │    ├── fd: (1)-->(14)
    │    ├── project
    │    │    ├── columns: notnull:13 x:1!null k:5
    │    │    ├── key: (1)
    │    │    ├── fd: (5)-->(13), (1)-->(5,13)
  - │    │    ├── left-join (merge)
  + │    │    ├── left-join (lookup a)
    │    │    │    ├── columns: x:1!null k:5 i:6
  - │    │    │    ├── left ordering: +1
  - │    │    │    ├── right ordering: +5
  + │    │    │    ├── key columns: [1] = [5]
  + │    │    │    ├── lookup columns are key
    │    │    │    ├── key: (1)
    │    │    │    ├── fd: (5)-->(6), (1)-->(5,6)
    │    │    │    ├── scan xy
    │    │    │    │    ├── columns: x:1!null
  - │    │    │    │    ├── key: (1)
  - │    │    │    │    └── ordering: +1
  - │    │    │    ├── select
  - │    │    │    │    ├── columns: k:5!null i:6
  - │    │    │    │    ├── key: (5)
  - │    │    │    │    ├── fd: (5)-->(6)
  - │    │    │    │    ├── ordering: +5
  - │    │    │    │    ├── scan a
  - │    │    │    │    │    ├── columns: k:5!null i:6
  - │    │    │    │    │    ├── key: (5)
  - │    │    │    │    │    ├── fd: (5)-->(6)
  - │    │    │    │    │    └── ordering: +5
  - │    │    │    │    └── filters
  - │    │    │    │         └── (i:6 = 5) IS NOT false [outer=(6)]
  - │    │    │    └── filters (true)
  + │    │    │    │    └── key: (1)
  + │    │    │    └── filters
  + │    │    │         └── (i:6 = 5) IS NOT false [outer=(6)]
    │    │    └── projections
    │    │         └── CASE k:5 IS NULL WHEN true THEN CAST(NULL AS BOOL) ELSE i:6 IS NOT NULL END [as=notnull:13, outer=(5,6)]
    │    └── aggregations
    │         └── bool-or [as=bool_or:14, outer=(13)]
    │              └── notnull:13
    └── projections
         └── CASE WHEN bool_or:14 THEN true WHEN bool_or:14 IS NULL THEN false ELSE CAST(NULL AS BOOL) END [as=r:12, outer=(14)]
--------------------------------------------------------------------------------
GenerateMergeJoins (higher cost)
--------------------------------------------------------------------------------
   project
    ├── columns: r:12
    ├── group-by (hash)
    │    ├── columns: x:1!null bool_or:14
    │    ├── grouping columns: x:1!null
    │    ├── key: (1)
    │    ├── fd: (1)-->(14)
    │    ├── project
    │    │    ├── columns: notnull:13 x:1!null k:5
    │    │    ├── key: (1)
    │    │    ├── fd: (5)-->(13), (1)-->(5,13)
  - │    │    ├── left-join (lookup a)
  + │    │    ├── right-join (merge)
    │    │    │    ├── columns: x:1!null k:5 i:6
  - │    │    │    ├── key columns: [1] = [5]
  - │    │    │    ├── lookup columns are key
  + │    │    │    ├── left ordering: +5
  + │    │    │    ├── right ordering: +1
    │    │    │    ├── key: (1)
    │    │    │    ├── fd: (5)-->(6), (1)-->(5,6)
  + │    │    │    ├── select
  + │    │    │    │    ├── columns: k:5!null i:6
  + │    │    │    │    ├── key: (5)
  + │    │    │    │    ├── fd: (5)-->(6)
  + │    │    │    │    ├── ordering: +5
  + │    │    │    │    ├── scan a
  + │    │    │    │    │    ├── columns: k:5!null i:6
  + │    │    │    │    │    ├── key: (5)
  + │    │    │    │    │    ├── fd: (5)-->(6)
  + │    │    │    │    │    └── ordering: +5
  + │    │    │    │    └── filters
  + │    │    │    │         └── (i:6 = 5) IS NOT false [outer=(6)]
    │    │    │    ├── scan xy
    │    │    │    │    ├── columns: x:1!null
  - │    │    │    │    └── key: (1)
  - │    │    │    └── filters
  - │    │    │         └── (i:6 = 5) IS NOT false [outer=(6)]
  + │    │    │    │    ├── key: (1)
  + │    │    │    │    └── ordering: +1
  + │    │    │    └── filters (true)
    │    │    └── projections
    │    │         └── CASE k:5 IS NULL WHEN true THEN CAST(NULL AS BOOL) ELSE i:6 IS NOT NULL END [as=notnull:13, outer=(5,6)]
    │    └── aggregations
    │         └── bool-or [as=bool_or:14, outer=(13)]
    │              └── notnull:13
    └── projections
         └── CASE WHEN bool_or:14 THEN true WHEN bool_or:14 IS NULL THEN false ELSE CAST(NULL AS BOOL) END [as=r:12, outer=(14)]
--------------------------------------------------------------------------------
GenerateMergeJoins (higher cost)
--------------------------------------------------------------------------------
   project
    ├── columns: r:12
    ├── group-by (hash)
    │    ├── columns: x:1!null bool_or:14
    │    ├── grouping columns: x:1!null
    │    ├── key: (1)
    │    ├── fd: (1)-->(14)
  - │    ├── project
  - │    │    ├── columns: notnull:13 x:1!null k:5
  + │    ├── right-join (merge)
  + │    │    ├── columns: x:1!null k:5 notnull:13
  + │    │    ├── left ordering: +5
  + │    │    ├── right ordering: +1
    │    │    ├── key: (1)
    │    │    ├── fd: (5)-->(13), (1)-->(5,13)
  - │    │    ├── right-join (merge)
  - │    │    │    ├── columns: x:1!null k:5 i:6
  - │    │    │    ├── left ordering: +5
  - │    │    │    ├── right ordering: +1
  - │    │    │    ├── key: (1)
  - │    │    │    ├── fd: (5)-->(6), (1)-->(5,6)
  + │    │    ├── project
  + │    │    │    ├── columns: notnull:13!null k:5!null
  + │    │    │    ├── key: (5)
  + │    │    │    ├── fd: (5)-->(13)
  + │    │    │    ├── ordering: +5
    │    │    │    ├── select
    │    │    │    │    ├── columns: k:5!null i:6
    │    │    │    │    ├── key: (5)
    │    │    │    │    ├── fd: (5)-->(6)
    │    │    │    │    ├── ordering: +5
    │    │    │    │    ├── scan a
    │    │    │    │    │    ├── columns: k:5!null i:6
    │    │    │    │    │    ├── key: (5)
    │    │    │    │    │    ├── fd: (5)-->(6)
    │    │    │    │    │    └── ordering: +5
    │    │    │    │    └── filters
    │    │    │    │         └── (i:6 = 5) IS NOT false [outer=(6)]
  - │    │    │    ├── scan xy
  - │    │    │    │    ├── columns: x:1!null
  - │    │    │    │    ├── key: (1)
  - │    │    │    │    └── ordering: +1
  - │    │    │    └── filters (true)
  - │    │    └── projections
  - │    │         └── CASE k:5 IS NULL WHEN true THEN CAST(NULL AS BOOL) ELSE i:6 IS NOT NULL END [as=notnull:13, outer=(5,6)]
  + │    │    │    └── projections
  + │    │    │         └── i:6 IS NOT NULL [as=notnull:13, outer=(6)]
  + │    │    ├── scan xy
  + │    │    │    ├── columns: x:1!null
  + │    │    │    ├── key: (1)
  + │    │    │    └── ordering: +1
  + │    │    └── filters (true)
    │    └── aggregations
    │         └── bool-or [as=bool_or:14, outer=(13)]
    │              └── notnull:13
    └── projections
         └── CASE WHEN bool_or:14 THEN true WHEN bool_or:14 IS NULL THEN false ELSE CAST(NULL AS BOOL) END [as=r:12, outer=(14)]
================================================================================
GenerateStreamingGroupBy
  Cost: 2246.49
================================================================================
   project
    ├── columns: r:12
  - ├── group-by (hash)
  + ├── group-by (streaming)
    │    ├── columns: x:1!null bool_or:14
    │    ├── grouping columns: x:1!null
  + │    ├── internal-ordering: +1
    │    ├── key: (1)
    │    ├── fd: (1)-->(14)
    │    ├── left-join (merge)
    │    │    ├── columns: x:1!null k:5 notnull:13
    │    │    ├── left ordering: +1
    │    │    ├── right ordering: +5
    │    │    ├── key: (1)
    │    │    ├── fd: (5)-->(13), (1)-->(5,13)
  + │    │    ├── ordering: +1
    │    │    ├── scan xy
    │    │    │    ├── columns: x:1!null
    │    │    │    ├── key: (1)
    │    │    │    └── ordering: +1
    │    │    ├── project
    │    │    │    ├── columns: notnull:13!null k:5!null
    │    │    │    ├── key: (5)
    │    │    │    ├── fd: (5)-->(13)
    │    │    │    ├── ordering: +5
    │    │    │    ├── select
    │    │    │    │    ├── columns: k:5!null i:6
    │    │    │    │    ├── key: (5)
    │    │    │    │    ├── fd: (5)-->(6)
    │    │    │    │    ├── ordering: +5
    │    │    │    │    ├── scan a
    │    │    │    │    │    ├── columns: k:5!null i:6
    │    │    │    │    │    ├── key: (5)
    │    │    │    │    │    ├── fd: (5)-->(6)
    │    │    │    │    │    └── ordering: +5
    │    │    │    │    └── filters
    │    │    │    │         └── (i:6 = 5) IS NOT false [outer=(6)]
    │    │    │    └── projections
    │    │    │         └── i:6 IS NOT NULL [as=notnull:13, outer=(6)]
    │    │    └── filters (true)
    │    └── aggregations
    │         └── bool-or [as=bool_or:14, outer=(13)]
    │              └── notnull:13
    └── projections
         └── CASE WHEN bool_or:14 THEN true WHEN bool_or:14 IS NULL THEN false ELSE CAST(NULL AS BOOL) END [as=r:12, outer=(14)]
================================================================================
Final best expression
  Cost: 2246.49
================================================================================
  project
   ├── columns: r:12
   ├── group-by (streaming)
   │    ├── columns: x:1!null bool_or:14
   │    ├── grouping columns: x:1!null
   │    ├── internal-ordering: +1
   │    ├── key: (1)
   │    ├── fd: (1)-->(14)
   │    ├── left-join (merge)
   │    │    ├── columns: x:1!null k:5 notnull:13
   │    │    ├── left ordering: +1
   │    │    ├── right ordering: +5
   │    │    ├── key: (1)
   │    │    ├── fd: (5)-->(13), (1)-->(5,13)
   │    │    ├── ordering: +1
   │    │    ├── scan xy
   │    │    │    ├── columns: x:1!null
   │    │    │    ├── key: (1)
   │    │    │    └── ordering: +1
   │    │    ├── project
   │    │    │    ├── columns: notnull:13!null k:5!null
   │    │    │    ├── key: (5)
   │    │    │    ├── fd: (5)-->(13)
   │    │    │    ├── ordering: +5
   │    │    │    ├── select
   │    │    │    │    ├── columns: k:5!null i:6
   │    │    │    │    ├── key: (5)
   │    │    │    │    ├── fd: (5)-->(6)
   │    │    │    │    ├── ordering: +5
   │    │    │    │    ├── scan a
   │    │    │    │    │    ├── columns: k:5!null i:6
   │    │    │    │    │    ├── key: (5)
   │    │    │    │    │    ├── fd: (5)-->(6)
   │    │    │    │    │    └── ordering: +5
   │    │    │    │    └── filters
   │    │    │    │         └── (i:6 = 5) IS NOT false [outer=(6)]
   │    │    │    └── projections
   │    │    │         └── i:6 IS NOT NULL [as=notnull:13, outer=(6)]
   │    │    └── filters (true)
   │    └── aggregations
   │         └── bool-or [as=bool_or:14, outer=(13)]
   │              └── notnull:13
   └── projections
        └── CASE WHEN bool_or:14 THEN true WHEN bool_or:14 IS NULL THEN false ELSE CAST(NULL AS BOOL) END [as=r:12, outer=(14)]
