vitess.io/vitess@v0.16.2/go/vt/vtgate/planbuilder/testdata/rails_cases.json (about) 1 [ 2 { 3 "comment": "Author5.joins(books: [{orders: :customer}, :supplier])", 4 "query": "select author5s.* from author5s join book6s on book6s.author5_id = author5s.id join book6s_order2s on book6s_order2s.book6_id = book6s.id join order2s on order2s.id = book6s_order2s.order2_id join customer2s on customer2s.id = order2s.customer2_id join supplier5s on supplier5s.id = book6s.supplier5_id", 5 "v3-plan": { 6 "QueryType": "SELECT", 7 "Original": "select author5s.* from author5s join book6s on book6s.author5_id = author5s.id join book6s_order2s on book6s_order2s.book6_id = book6s.id join order2s on order2s.id = book6s_order2s.order2_id join customer2s on customer2s.id = order2s.customer2_id join supplier5s on supplier5s.id = book6s.supplier5_id", 8 "Instructions": { 9 "OperatorType": "Join", 10 "Variant": "Join", 11 "JoinColumnIndexes": "L:0,L:1,L:2,L:3", 12 "JoinVars": { 13 "book6s_supplier5_id": 4 14 }, 15 "TableName": "author5s, book6s_book6s_order2s_order2s_customer2s_supplier5s", 16 "Inputs": [ 17 { 18 "OperatorType": "Join", 19 "Variant": "Join", 20 "JoinColumnIndexes": "L:0,L:1,L:2,L:3,L:4", 21 "JoinVars": { 22 "order2s_customer2_id": 5 23 }, 24 "TableName": "author5s, book6s_book6s_order2s_order2s_customer2s", 25 "Inputs": [ 26 { 27 "OperatorType": "Join", 28 "Variant": "Join", 29 "JoinColumnIndexes": "L:0,L:1,L:2,L:3,L:4,R:0", 30 "JoinVars": { 31 "book6s_order2s_order2_id": 5 32 }, 33 "TableName": "author5s, book6s_book6s_order2s_order2s", 34 "Inputs": [ 35 { 36 "OperatorType": "Join", 37 "Variant": "Join", 38 "JoinColumnIndexes": "L:0,L:1,L:2,L:3,L:4,R:0", 39 "JoinVars": { 40 "book6s_id": 5 41 }, 42 "TableName": "author5s, book6s_book6s_order2s", 43 "Inputs": [ 44 { 45 "OperatorType": "Route", 46 "Variant": "Scatter", 47 "Keyspace": { 48 "Name": "user", 49 "Sharded": true 50 }, 51 "FieldQuery": "select author5s.id, author5s.`name`, author5s.created_at, author5s.updated_at, book6s.supplier5_id, book6s.id from author5s join book6s on book6s.author5_id = author5s.id where 1 != 1", 52 "Query": "select author5s.id, author5s.`name`, author5s.created_at, author5s.updated_at, book6s.supplier5_id, book6s.id from author5s join book6s on book6s.author5_id = author5s.id", 53 "Table": "author5s, book6s" 54 }, 55 { 56 "OperatorType": "Route", 57 "Variant": "EqualUnique", 58 "Keyspace": { 59 "Name": "user", 60 "Sharded": true 61 }, 62 "FieldQuery": "select book6s_order2s.order2_id from book6s_order2s where 1 != 1", 63 "Query": "select book6s_order2s.order2_id from book6s_order2s where book6s_order2s.book6_id = :book6s_id", 64 "Table": "book6s_order2s", 65 "Values": [ 66 ":book6s_id" 67 ], 68 "Vindex": "binary_md5" 69 } 70 ] 71 }, 72 { 73 "OperatorType": "Route", 74 "Variant": "Scatter", 75 "Keyspace": { 76 "Name": "user", 77 "Sharded": true 78 }, 79 "FieldQuery": "select order2s.customer2_id from order2s where 1 != 1", 80 "Query": "select order2s.customer2_id from order2s where order2s.id = :book6s_order2s_order2_id", 81 "Table": "order2s" 82 } 83 ] 84 }, 85 { 86 "OperatorType": "Route", 87 "Variant": "EqualUnique", 88 "Keyspace": { 89 "Name": "user", 90 "Sharded": true 91 }, 92 "FieldQuery": "select 1 from customer2s where 1 != 1", 93 "Query": "select 1 from customer2s where customer2s.id = :order2s_customer2_id", 94 "Table": "customer2s", 95 "Values": [ 96 ":order2s_customer2_id" 97 ], 98 "Vindex": "binary_md5" 99 } 100 ] 101 }, 102 { 103 "OperatorType": "Route", 104 "Variant": "EqualUnique", 105 "Keyspace": { 106 "Name": "user", 107 "Sharded": true 108 }, 109 "FieldQuery": "select 1 from supplier5s where 1 != 1", 110 "Query": "select 1 from supplier5s where supplier5s.id = :book6s_supplier5_id", 111 "Table": "supplier5s", 112 "Values": [ 113 ":book6s_supplier5_id" 114 ], 115 "Vindex": "binary_md5" 116 } 117 ] 118 } 119 }, 120 "gen4-plan": { 121 "QueryType": "SELECT", 122 "Original": "select author5s.* from author5s join book6s on book6s.author5_id = author5s.id join book6s_order2s on book6s_order2s.book6_id = book6s.id join order2s on order2s.id = book6s_order2s.order2_id join customer2s on customer2s.id = order2s.customer2_id join supplier5s on supplier5s.id = book6s.supplier5_id", 123 "Instructions": { 124 "OperatorType": "Join", 125 "Variant": "Join", 126 "JoinColumnIndexes": "R:0,R:1,R:2,R:3", 127 "JoinVars": { 128 "order2s_id": 0 129 }, 130 "TableName": "customer2s, order2s_author5s, book6s_book6s_order2s_supplier5s", 131 "Inputs": [ 132 { 133 "OperatorType": "Route", 134 "Variant": "Scatter", 135 "Keyspace": { 136 "Name": "user", 137 "Sharded": true 138 }, 139 "FieldQuery": "select order2s.id from order2s, customer2s where 1 != 1", 140 "Query": "select order2s.id from order2s, customer2s where customer2s.id = order2s.customer2_id", 141 "Table": "customer2s, order2s" 142 }, 143 { 144 "OperatorType": "Join", 145 "Variant": "Join", 146 "JoinColumnIndexes": "L:1,L:2,L:3,L:4", 147 "JoinVars": { 148 "book6s_supplier5_id": 0 149 }, 150 "TableName": "author5s, book6s_book6s_order2s_supplier5s", 151 "Inputs": [ 152 { 153 "OperatorType": "Join", 154 "Variant": "Join", 155 "JoinColumnIndexes": "L:1,L:2,L:3,L:4,L:5", 156 "JoinVars": { 157 "book6s_id": 0 158 }, 159 "TableName": "author5s, book6s_book6s_order2s", 160 "Inputs": [ 161 { 162 "OperatorType": "Route", 163 "Variant": "Scatter", 164 "Keyspace": { 165 "Name": "user", 166 "Sharded": true 167 }, 168 "FieldQuery": "select book6s.id, book6s.supplier5_id, author5s.id as id, author5s.`name` as `name`, author5s.created_at as created_at, author5s.updated_at as updated_at from author5s, book6s where 1 != 1", 169 "Query": "select book6s.id, book6s.supplier5_id, author5s.id as id, author5s.`name` as `name`, author5s.created_at as created_at, author5s.updated_at as updated_at from author5s, book6s where book6s.author5_id = author5s.id", 170 "Table": "author5s, book6s" 171 }, 172 { 173 "OperatorType": "Route", 174 "Variant": "EqualUnique", 175 "Keyspace": { 176 "Name": "user", 177 "Sharded": true 178 }, 179 "FieldQuery": "select 1 from book6s_order2s where 1 != 1", 180 "Query": "select 1 from book6s_order2s where book6s_order2s.book6_id = :book6s_id and book6s_order2s.order2_id = :order2s_id", 181 "Table": "book6s_order2s", 182 "Values": [ 183 ":book6s_id" 184 ], 185 "Vindex": "binary_md5" 186 } 187 ] 188 }, 189 { 190 "OperatorType": "Route", 191 "Variant": "EqualUnique", 192 "Keyspace": { 193 "Name": "user", 194 "Sharded": true 195 }, 196 "FieldQuery": "select 1 from supplier5s where 1 != 1", 197 "Query": "select 1 from supplier5s where supplier5s.id = :book6s_supplier5_id", 198 "Table": "supplier5s", 199 "Values": [ 200 ":book6s_supplier5_id" 201 ], 202 "Vindex": "binary_md5" 203 } 204 ] 205 } 206 ] 207 }, 208 "TablesUsed": [ 209 "user.author5s", 210 "user.book6s", 211 "user.book6s_order2s", 212 "user.customer2s", 213 "user.order2s", 214 "user.supplier5s" 215 ] 216 } 217 } 218 ]