summaryrefslogtreecommitdiff
path: root/mysql-test/t/analyze_format_json.test
blob: 7f7ea3d806e1373bbffb5fcd9a1a50fc454bf1cb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#
#  Tests for "ANALYZE FORMAT=JSON $statement" syntax
#
--disable_warnings
drop table if exists t0,t1,t2,t3;
--enable_warnings

create table t0 (a int);
INSERT INTO t0 VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);

--echo # r_filtered=30%, because 3 rows match: 0,1,2
analyze format=json select * from t0 where a<3;

create table t1 (a int, b int, c int, key(a));
insert into t1 select A.a*10 + B.a, A.a*10 + B.a, A.a*10 + B.a from t0 A, t0 B;

analyze
select * from t0, t1 where t1.a=t0.a and t0.a > 9;
analyze format=json 
select * from t0, t1 where t1.a=t0.a and t0.a > 9;

analyze
select * from t0, t1 where t1.a=t0.a and t1.b<4;

analyze format=json
select * from t0, t1 where t1.a=t0.a and t1.b<4;

analyze 
select * from t1 tbl1, t1 tbl2 where tbl1.b<2 and tbl2.b>5;

analyze format=json
select * from t1 tbl1, t1 tbl2 where tbl1.b<20 and tbl2.b<60;

analyze format=json
select * from t1 tbl1, t1 tbl2 where tbl1.b<20 and tbl2.b<60 and tbl1.c > tbl2.c;

drop table t1;
drop table t0;