github.com/cockroachdb/cockroach@v20.2.0-alpha.1+incompatible/pkg/sql/opt/optgen/exprgen/testdata/fake (about) 1 expr 2 (FakeRel []) 3 ---- 4 fake-rel 5 ├── cardinality: [0 - 0] 6 ├── stats: [rows=0] 7 └── cost: 0.01 8 9 expr 10 (FakeRel 11 [ 12 (OutputCols [ (NewColumn "a" "int") (NewColumn "b" "int") (NewColumn "c" "int")] ) 13 (NotNullCols "a,b") 14 (Cardinality "-") 15 ] 16 ) 17 ---- 18 fake-rel 19 ├── columns: a:1(int!null) b:2(int!null) c:3(int) 20 ├── stats: [rows=0] 21 └── cost: 0.01 22 23 expr 24 (FakeRel 25 [ 26 (OutputCols [ (NewColumn "a" "int") (NewColumn "b" "int") (NewColumn "c" "int")] ) 27 (Cardinality "5 - 1000") 28 (Stats `[ 29 { 30 "columns": ["a"], 31 "distinct_count": 100, 32 "null_count": 0, 33 "row_count": 100, 34 "created_at": "2018-01-01 1:00:00.00000+00:00" 35 }, 36 { 37 "columns": ["b"], 38 "distinct_count": 20, 39 "null_count": 5, 40 "row_count": 100, 41 "created_at": "2018-01-01 1:00:00.00000+00:00" 42 } 43 ]`) 44 ] 45 ) 46 ---- 47 fake-rel 48 ├── columns: a:1(int) b:2(int) c:3(int) 49 ├── cardinality: [5 - 1000] 50 ├── stats: [rows=100, distinct(1)=100, null(1)=0, distinct(2)=20, null(2)=5] 51 └── cost: 0.01 52 53 # Verify that newer stats are preferred. 54 expr 55 (FakeRel 56 [ 57 (OutputCols [ (NewColumn "a" "int") (NewColumn "b" "int") (NewColumn "c" "int")] ) 58 (Cardinality "-") 59 (Stats `[ 60 { 61 "columns": ["a"], 62 "distinct_count": 100, 63 "null_count": 0, 64 "row_count": 100, 65 "created_at": "2018-01-01 1:00:00.00000+00:00" 66 }, 67 { 68 "columns": ["a"], 69 "distinct_count": 110, 70 "null_count": 0, 71 "row_count": 110, 72 "created_at": "2018-01-02 1:00:00.00000+00:00" 73 }, 74 { 75 "columns": ["b"], 76 "distinct_count": 20, 77 "null_count": 5, 78 "row_count": 100, 79 "created_at": "2018-01-01 1:00:00.00000+00:00" 80 }, 81 { 82 "columns": ["b"], 83 "distinct_count": 22, 84 "null_count": 5, 85 "row_count": 120, 86 "created_at": "2018-01-03 1:00:00.00000+00:00" 87 } 88 ]`) 89 ] 90 ) 91 ---- 92 fake-rel 93 ├── columns: a:1(int) b:2(int) c:3(int) 94 ├── stats: [rows=120, distinct(1)=110, null(1)=0, distinct(2)=22, null(2)=5] 95 └── cost: 0.01