474
451
insert t1 select a+1, a+b from t1;
475
452
insert t1 select a+1, a+b from t1;
478
454
show status like 'Slow_queries';
479
455
select count(*) from t1 where a=7;
481
456
show status like 'Slow_queries';
482
457
select count(*) from t1 where b=13;
484
458
show status like 'Slow_queries';
485
459
select count(*) from t1 where b=13 union select count(*) from t1 where a=7;
487
460
show status like 'Slow_queries';
488
461
select count(*) from t1 where a=7 union select count(*) from t1 where b=13;
490
462
show status like 'Slow_queries';
491
463
# additional test for examined rows
493
465
select a from t1 where b not in (1,2,3) union select a from t1 where b not in (4,5,6);
495
466
show status like 'Slow_queries';
499
470
# Column 'name' cannot be null (error with union and left join) (bug #2508)
502
473
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
474
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);