| 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 |
id select_type table partitions type possible_keys key key_len ref rows filtered Extra |
| 11 |
1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 1 100.00 NULL |
| 12 |
Warnings: |
| 13 |
Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` |
| 14 |
EXPLAIN FORMAT=JSON SELECT * FROM t1; |
| 15 |
EXPLAIN |
| 16 |
{ |
| 17 |
"query_block": { |
| 18 |
"select_id": 1, |
| 19 |
"cost_info": { |
| 20 |
"query_cost": "0.35" |
| 21 |
}, |
| 22 |
"table": { |
| 23 |
"table_name": "t1", |
| 24 |
"access_type": "ALL", |
| 25 |
"rows_examined_per_scan": 1, |
| 26 |
"rows_produced_per_join": 1, |
| 27 |
"filtered": "100.00", |
| 28 |
"cost_info": { |
| 29 |
"read_cost": "0.25", |
| 30 |
"eval_cost": "0.10", |
| 31 |
"prefix_cost": "0.35", |
| 32 |
"data_read_per_join": "8" |
| 33 |
}, |
| 34 |
"used_columns": [ |
| 35 |
"a" |
| 36 |
] |
| 37 |
} |
| 38 |
} |
| 39 |
} |
| 40 |
Warnings: |
| 41 |
Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` |
| 42 |
ALTER TABLE t1 SECONDARY_LOAD; |
| 43 |
# After table is loaded, the secondary engine should be used. |
| 44 |
ANALYZE TABLE t1; |
| 45 |
Table Op Msg_type Msg_text |
| 46 |
test.t1 analyze status OK |
| 47 |
EXPLAIN SELECT * FROM t1; |
| 48 |
id select_type table partitions type possible_keys key key_len ref rows filtered Extra |
| 49 |
1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 1 100.00 Using secondary engine MOCK |
| 50 |
Warnings: |
| 51 |
Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` |
| 52 |
EXPLAIN FORMAT=JSON SELECT * FROM t1, t1 t2 WHERE t1.a = t2.a; |
| 53 |
EXPLAIN |
| 54 |
{ |
| 55 |
"query_block": { |
| 56 |
"select_id": 1, |
| 57 |
"cost_info": { |
| 58 |
"query_cost": "1.20" |
| 59 |
}, |
| 60 |
"nested_loop": [ |
| 61 |
{ |
| 62 |
"table": { |
| 63 |
"table_name": "t1", |
| 64 |
"access_type": "ALL", |
| 65 |
"rows_examined_per_scan": 1, |
| 66 |
"rows_produced_per_join": 1, |
| 67 |
"filtered": "100.00", |
| 68 |
"using_secondary_engine": "MOCK", |
| 69 |
"cost_info": { |
| 70 |
"read_cost": "0.50", |
| 71 |
"eval_cost": "0.10", |
| 72 |
"prefix_cost": "0.60", |
| 73 |
"data_read_per_join": "8" |
| 74 |
}, |
| 75 |
"used_columns": [ |
| 76 |
"a" |
| 77 |
] |
| 78 |
} |
| 79 |
}, |
| 80 |
{ |
| 81 |
"table": { |
| 82 |
"table_name": "t2", |
| 83 |
"access_type": "ALL", |
| 84 |
"rows_examined_per_scan": 1, |
| 85 |
"rows_produced_per_join": 1, |
| 86 |
"filtered": "100.00", |
| 87 |
"using_join_buffer": "hash join", |
| 88 |
"using_secondary_engine": "MOCK", |
| 89 |
"cost_info": { |
| 90 |
"read_cost": "0.50", |
| 91 |
"eval_cost": "0.10", |
| 92 |
"prefix_cost": "1.20", |
| 93 |
"data_read_per_join": "8" |
| 94 |
}, |
| 95 |
"used_columns": [ |
| 96 |
"a" |
| 97 |
], |
| 98 |
"attached_condition": "(`test`.`t2`.`a` = `test`.`t1`.`a`)" |
| 99 |
} |
| 100 |
} |
| 101 |
] |
| 102 |
} |
| 103 |
} |
| 104 |
Warnings: |
| 105 |
Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t2`.`a` AS `a` from `test`.`t1` join `test`.`t1` `t2` where (`test`.`t2`.`a` = `test`.`t1`.`a`) |
| 106 |
DROP TABLE t1; |