| 1 |
source include/have_ndb.inc; |
| 2 |
|
| 3 |
create table t1 (a int primary key, |
| 4 |
b int, |
| 5 |
c int, |
| 6 |
key(c)) engine = ndb; |
| 7 |
|
| 8 |
--echo Insert a number of rows |
| 9 |
let $rows=100; |
| 10 |
let $i=$rows; |
| 11 |
|
| 12 |
--disable_query_log |
| 13 |
--disable_result_log |
| 14 |
while($i) |
| 15 |
{ |
| 16 |
--eval insert into t1 values ($i, $i, $i); |
| 17 |
--dec $i |
| 18 |
} |
| 19 |
--enable_result_log |
| 20 |
--enable_query_log |
| 21 |
|
| 22 |
--echo Define a statement that will use MRR to read |
| 23 |
|
| 24 |
let $q= select * from t1 where |
| 25 |
(c > 1 and c < 6) or |
| 26 |
(c > 20 and c < 30) or |
| 27 |
(c > 60 and c < 65) or |
| 28 |
(c > 70 and c < 73) or |
| 29 |
(c > 200 and c < 210) order by a; |
| 30 |
|
| 31 |
#--echo Show use of MRR |
| 32 |
#--eval explain format=json into @e $q |
| 33 |
#select json_extract(@e, "$.query_block.ordering_operation.table.using_MRR") as using_MRR; |
| 34 |
|
| 35 |
|
| 36 |
--echo Run a number of iterations to likely get query thread usage |
| 37 |
|
| 38 |
--disable_query_log |
| 39 |
--disable_result_log |
| 40 |
let $iter=50; |
| 41 |
while ($iter) |
| 42 |
{ |
| 43 |
--eval $q |
| 44 |
--dec $iter |
| 45 |
} |
| 46 |
--enable_result_log |
| 47 |
--enable_query_log |
| 48 |
|
| 49 |
--echo Cleanup |
| 50 |
|
| 51 |
drop table t1; |