| 1 |
# |
| 2 |
# Bug#28556942: ADD USING SECONDARY ENGINE TO EXPLAIN |
| 3 |
# |
| 4 |
CREATE TABLE t1 (a INT) SECONDARY_ENGINE MOCK; |
| 5 |
# Before table is loaded, the secondary engine should not be used. |
| 6 |
ANALYZE TABLE t1; |
| 7 |
Table Op Msg_type Msg_text |
| 8 |
test.t1 analyze status OK |
| 9 |
EXPLAIN SELECT * FROM t1; |
| 10 |
EXPLAIN FORMAT=JSON SELECT * FROM t1; |
| 11 |
EXPLAIN |
| 12 |
{ |
| 13 |
"query": "/* select#1 */ select `test`.`t1`.`a` AS `a` from `test`.`t1`", |
| 14 |
"operation": "Table scan on t1", |
| 15 |
"table_name": "t1", |
| 16 |
"access_type": "table", |
| 17 |
"estimated_rows": 1.0, |
| 18 |
"estimated_total_cost": 0.25, |
| 19 |
"estimated_first_row_cost": 0.25 |
| 20 |
} |
| 21 |
ALTER TABLE t1 SECONDARY_LOAD; |
| 22 |
# After table is loaded, the secondary engine should be used. |
| 23 |
ANALYZE TABLE t1; |
| 24 |
Table Op Msg_type Msg_text |
| 25 |
test.t1 analyze status OK |
| 26 |
EXPLAIN SELECT * FROM t1; |
| 27 |
id select_type table partitions type possible_keys key key_len ref rows filtered Extra |
| 28 |
1 NONE NULL NULL NULL NULL NULL NULL NULL NULL NULL Using secondary engine MOCK. Use EXPLAIN FORMAT=TREE to show the plan. |
| 29 |
Warnings: |
| 30 |
Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` |
| 31 |
EXPLAIN FORMAT=JSON SELECT * FROM t1, t1 t2 WHERE t1.a = t2.a; |
| 32 |
EXPLAIN |
| 33 |
{ |
| 34 |
"query": "/* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t2`.`a` AS `a` from `test`.`t1` join `test`.`t1` `t2` where multiple equal(`test`.`t1`.`a`, `test`.`t2`.`a`)", |
| 35 |
"inputs": [ |
| 36 |
{ |
| 37 |
"operation": "Table scan on t1 in secondary engine MOCK", |
| 38 |
"table_name": "t1", |
| 39 |
"access_type": "table", |
| 40 |
"estimated_rows": 1.0, |
| 41 |
"secondary_engine": "MOCK", |
| 42 |
"estimated_total_cost": 0.5, |
| 43 |
"estimated_first_row_cost": 0.5 |
| 44 |
}, |
| 45 |
{ |
| 46 |
"heading": "Hash", |
| 47 |
"operation": "Table scan on t2 in secondary engine MOCK", |
| 48 |
"table_name": "t2", |
| 49 |
"access_type": "table", |
| 50 |
"estimated_rows": 1.0, |
| 51 |
"secondary_engine": "MOCK", |
| 52 |
"estimated_total_cost": 0.5, |
| 53 |
"estimated_first_row_cost": 0.5 |
| 54 |
} |
| 55 |
], |
| 56 |
"join_type": "inner join", |
| 57 |
"operation": "Inner hash join (t1.a = t2.a)", |
| 58 |
"access_type": "join", |
| 59 |
"estimated_rows": 0.10000000149011612, |
| 60 |
"hash_condition": [ |
| 61 |
"(t1.a = t2.a)" |
| 62 |
], |
| 63 |
"join_algorithm": "hash", |
| 64 |
"estimated_total_cost": 1.2070000001043084, |
| 65 |
"estimated_first_row_cost": 1.2070000001043084 |
| 66 |
} |
| 67 |
Warnings: |
| 68 |
Note 1003 Query is executed in secondary engine; the actual query plan may diverge from the printed one |
| 69 |
DROP TABLE t1; |