|
| 1 | +drop table if exists t0,t1,t2,t3; |
| 2 | +create table t0 (a int) engine=myisam; |
| 3 | +INSERT INTO t0 VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); |
| 4 | +create table t1 (a int) engine=myisam; |
| 5 | +INSERT INTO t1 select * from t0; |
| 6 | +# Try a few basic selects to see that r_rows and r_filtered columns work |
| 7 | +analyze select * from t1; |
| 8 | +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra |
| 9 | +1 SIMPLE t1 ALL NULL NULL NULL NULL 10 10 100.00 100.00 |
| 10 | +analyze select * from t1 where a<5; |
| 11 | +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra |
| 12 | +1 SIMPLE t1 ALL NULL NULL NULL NULL 10 10 100.00 50.00 Using where |
| 13 | +analyze select * from t1 where a>100; |
| 14 | +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra |
| 15 | +1 SIMPLE t1 ALL NULL NULL NULL NULL 10 10 100.00 0.00 Using where |
| 16 | +# ANALYZE DELETE will delete rows: |
| 17 | +analyze delete from t1 where a in (2,3,4); |
| 18 | +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra |
| 19 | +1 SIMPLE t1 ALL NULL NULL NULL NULL 10 NULL 100.00 30.00 Using where |
| 20 | +select * from t1; |
| 21 | +a |
| 22 | +0 |
| 23 | +1 |
| 24 | +5 |
| 25 | +6 |
| 26 | +7 |
| 27 | +8 |
| 28 | +9 |
| 29 | +drop table t1; |
| 30 | +# ANALYZE UPDATE will make updates: |
| 31 | +create table t1(a int, b int); |
| 32 | +insert into t1 select a,a from t0; |
| 33 | +analyze update t1 set b=100+b where a in (6,7,8); |
| 34 | +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra |
| 35 | +1 SIMPLE t1 ALL NULL NULL NULL NULL 10 NULL 100.00 30.00 Using where |
| 36 | +select * from t1; |
| 37 | +a b |
| 38 | +0 0 |
| 39 | +1 1 |
| 40 | +2 2 |
| 41 | +3 3 |
| 42 | +4 4 |
| 43 | +5 5 |
| 44 | +6 106 |
| 45 | +7 107 |
| 46 | +8 108 |
| 47 | +9 9 |
| 48 | +drop table t1; |
| 49 | +drop table t0; |
0 commit comments