474
472
insert t1 select a+1, a+b from t1;
475
473
insert t1 select a+1, a+b from t1;
478
475
show status like 'Slow_queries';
479
476
select count(*) from t1 where a=7;
481
477
show status like 'Slow_queries';
482
478
select count(*) from t1 where b=13;
484
479
show status like 'Slow_queries';
485
480
select count(*) from t1 where b=13 union select count(*) from t1 where a=7;
487
481
show status like 'Slow_queries';
488
482
select count(*) from t1 where a=7 union select count(*) from t1 where b=13;
490
483
show status like 'Slow_queries';
491
484
# additional test for examined rows
493
486
select a from t1 where b not in (1,2,3) union select a from t1 where b not in (4,5,6);
495
487
show status like 'Slow_queries';
499
491
# Column 'name' cannot be null (error with union and left join) (bug #2508)
502
494
insert into t1 ( RID,IID,nada,NAME,PHONE) values (1, 1, 'main', 'a', '111'), (2, 1, 'main', 'b', '222'), (3, 1, 'main', 'c', '333'), (4, 1, 'main', 'd', '444'), (5, 1, 'main', 'e', '555'), (6, 2, 'main', 'c', '333'), (7, 2, 'main', 'd', '454'), (8, 2, 'main', 'e', '555'), (9, 2, 'main', 'f', '666'), (10, 2, 'main', 'g', '777');
503
495
select A.NAME, A.PHONE, B.NAME, B.PHONE from t1 A left join t1 B on A.NAME = B.NAME and B.IID = 2 where A.IID = 1 and (A.PHONE <> B.PHONE or B.NAME is null) union select A.NAME, A.PHONE, B.NAME, B.PHONE from t1 B left join t1 A on B.NAME = A.NAME and A.IID = 1 where B.IID = 2 and (A.PHONE <> B.PHONE or A.NAME is null);