~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to tests/r/join_nested.result

  • Committer: Padraig O'Sullivan
  • Date: 2009-07-22 23:26:26 UTC
  • mto: (1039.5.43 replication)
  • mto: This revision was merged to the branch mainline in revision 1130.
  • Revision ID: osullivan.padraig@gmail.com-20090722232626-mu4khq7ho6dqcf7q
Created a simple filtered replicator that can filter by schema name or table
name.

Show diffs side-by-side

added added

removed removed

Lines of Context:
37
37
4       2
38
38
SELECT t3.a,t3.b,t4.a,t4.b
39
39
FROM t3,t4;
40
 
ERROR HY000: Implicit cartesian join attempted.
 
40
a       b       a       b
 
41
1       2       3       2
 
42
2       2       3       2
 
43
1       2       4       2
 
44
2       2       4       2
41
45
SELECT t2.a,t2.b,t3.a,t3.b,t4.a,t4.b
42
46
FROM t2
43
47
LEFT JOIN              
103
107
3       3
104
108
SELECT t3.a,t3.b,t4.a,t4.b,t5.a,t5.b
105
109
FROM t3,t4,t5;
106
 
ERROR HY000: Implicit cartesian join attempted.
 
110
a       b       a       b       a       b
 
111
1       2       3       2       3       1
 
112
2       2       3       2       3       1
 
113
1       2       4       2       3       1
 
114
2       2       4       2       3       1
 
115
1       2       3       2       2       2
 
116
2       2       3       2       2       2
 
117
1       2       4       2       2       2
 
118
2       2       4       2       2       2
 
119
1       2       3       2       3       3
 
120
2       2       3       2       3       3
 
121
1       2       4       2       3       3
 
122
2       2       4       2       3       3
107
123
SELECT t2.a,t2.b,t3.a,t3.b,t4.a,t4.b,t5.a,t5.b
108
124
FROM t2
109
125
LEFT JOIN              
192
208
1       1
193
209
2       2
194
210
SELECT t6.a,t6.b,t7.a,t7.b
195
 
FROM t6 CROSS JOIN t7;
 
211
FROM t6,t7;
196
212
a       b       a       b
197
213
3       2       1       1
198
214
3       2       2       2
 
215
6       2       1       1
 
216
6       2       2       2
199
217
6       1       1       1
200
218
6       1       2       2
201
 
6       2       1       1
202
 
6       2       2       2
203
219
SELECT t8.a,t8.b
204
220
FROM t8;
205
221
a       b
212
228
t8
213
229
ON t7.b=t8.b AND t6.b < 10;
214
230
id      select_type     table   type    possible_keys   key     key_len ref     rows    filtered        Extra
 
231
1       SIMPLE  t7      ALL     NULL    NULL    NULL    NULL    2       100.00  
215
232
1       SIMPLE  t6      ALL     NULL    NULL    NULL    NULL    3       100.00  Using join buffer
216
 
1       SIMPLE  t7      ALL     NULL    NULL    NULL    NULL    2       100.00  
217
233
1       SIMPLE  t8      ALL     NULL    NULL    NULL    NULL    2       100.00  
 
234
Warnings:
218
235
Note    1003    select `test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b` from `test`.`t6` join `test`.`t7` left join `test`.`t8` on(((`test`.`t7`.`b` = `test`.`t8`.`b`) and (`test`.`t6`.`b` < 10))) where 1
219
 
Warnings:
220
236
SELECT t6.a,t6.b,t7.a,t7.b,t8.a,t8.b
221
237
FROM (t6, t7)
222
238
LEFT JOIN 
345
361
WHERE t2.a > 3 AND
346
362
(t6.a < 6 OR t6.c IS NULL);
347
363
a       b       a       b       a       b       a       b       a       b       a       b       a       b
 
364
4       2       1       2       3       2       3       1       3       2       1       1       NULL    NULL
 
365
4       2       1       2       4       2       3       1       3       2       1       1       NULL    NULL
 
366
5       3       NULL    NULL    NULL    NULL    3       1       3       2       1       1       NULL    NULL
348
367
4       2       1       2       3       2       2       2       3       2       2       2       0       2
349
368
4       2       1       2       3       2       2       2       3       2       2       2       1       2
350
 
4       2       1       2       3       2       3       1       3       2       1       1       NULL    NULL
351
 
4       2       1       2       3       2       3       3       NULL    NULL    NULL    NULL    NULL    NULL
352
369
4       2       1       2       4       2       2       2       3       2       2       2       0       2
353
370
4       2       1       2       4       2       2       2       3       2       2       2       1       2
354
 
4       2       1       2       4       2       3       1       3       2       1       1       NULL    NULL
355
 
4       2       1       2       4       2       3       3       NULL    NULL    NULL    NULL    NULL    NULL
356
371
5       3       NULL    NULL    NULL    NULL    2       2       3       2       2       2       0       2
357
372
5       3       NULL    NULL    NULL    NULL    2       2       3       2       2       2       1       2
358
 
5       3       NULL    NULL    NULL    NULL    3       1       3       2       1       1       NULL    NULL
 
373
4       2       1       2       3       2       3       3       NULL    NULL    NULL    NULL    NULL    NULL
 
374
4       2       1       2       4       2       3       3       NULL    NULL    NULL    NULL    NULL    NULL
359
375
5       3       NULL    NULL    NULL    NULL    3       3       NULL    NULL    NULL    NULL    NULL    NULL
360
376
SELECT t1.a,t1.b
361
377
FROM t1;
628
644
1       SIMPLE  t3      ALL     NULL    NULL    NULL    NULL    2       100.00  Using where
629
645
1       SIMPLE  t4      ALL     NULL    NULL    NULL    NULL    2       100.00  Using where
630
646
1       SIMPLE  t5      ALL     NULL    NULL    NULL    NULL    3       100.00  Using where
 
647
1       SIMPLE  t7      ALL     NULL    NULL    NULL    NULL    2       100.00  Using where
631
648
1       SIMPLE  t6      ALL     NULL    NULL    NULL    NULL    3       100.00  Using where
632
 
1       SIMPLE  t7      ALL     NULL    NULL    NULL    NULL    2       100.00  Using where
633
649
1       SIMPLE  t8      ALL     NULL    NULL    NULL    NULL    2       100.00  Using where
634
650
1       SIMPLE  t9      ALL     NULL    NULL    NULL    NULL    3       100.00  Using where; Using join buffer
 
651
Warnings:
635
652
Note    1003    select `test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b`,`test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b`,`test`.`t9`.`a` AS `a`,`test`.`t9`.`b` AS `b` from `test`.`t0` join `test`.`t1` left join (`test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(((`test`.`t4`.`b` = `test`.`t2`.`b`) and (`test`.`t3`.`a` = 1))) join `test`.`t5` left join (`test`.`t6` join `test`.`t7` left join `test`.`t8` on(((`test`.`t8`.`b` = `test`.`t5`.`b`) and (`test`.`t6`.`b` < 10)))) on(((`test`.`t7`.`b` = `test`.`t5`.`b`) and (`test`.`t6`.`b` >= 2)))) on((((`test`.`t3`.`b` = 2) or isnull(`test`.`t3`.`c`)) and ((`test`.`t6`.`b` = 2) or isnull(`test`.`t6`.`c`)) and ((`test`.`t5`.`b` = `test`.`t0`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t6`.`c`) or isnull(`test`.`t8`.`c`)) and (`test`.`t1`.`a` <> 2))) join `test`.`t9` where ((`test`.`t9`.`a` = 1) and (`test`.`t1`.`b` = `test`.`t0`.`b`) and (`test`.`t0`.`a` = 1) and ((`test`.`t2`.`a` >= 4) or isnull(`test`.`t2`.`c`)) and ((`test`.`t3`.`a` < 5) or isnull(`test`.`t3`.`c`)) and ((`test`.`t4`.`b` = `test`.`t3`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t4`.`c`)) and ((`test`.`t5`.`a` >= 2) or isnull(`test`.`t5`.`c`)) and ((`test`.`t6`.`a` >= 4) or isnull(`test`.`t6`.`c`)) and ((`test`.`t7`.`a` <= 2) or isnull(`test`.`t7`.`c`)) and ((`test`.`t8`.`a` < 1) or isnull(`test`.`t8`.`c`)) and ((`test`.`t9`.`b` = `test`.`t8`.`b`) or isnull(`test`.`t8`.`c`)))
636
 
Warnings:
637
653
SELECT t9.a,t9.b
638
654
FROM t9;
639
655
a       b
727
743
WHERE t1.a <= 2;
728
744
a       b       a       b       a       b
729
745
1       3       3       3       NULL    NULL
 
746
2       2       3       3       NULL    NULL
730
747
1       3       4       2       1       2
731
748
1       3       4       2       2       2
732
 
1       3       5       3       NULL    NULL
733
 
2       2       3       3       NULL    NULL
734
749
2       2       4       2       1       2
735
750
2       2       4       2       2       2
 
751
1       3       5       3       NULL    NULL
736
752
2       2       5       3       NULL    NULL
737
753
SELECT t1.a,t1.b,t2.a,t2.b,t3.a,t3.b
738
754
FROM t1, t3 
742
758
WHERE t1.a <= 2;
743
759
a       b       a       b       a       b
744
760
1       3       3       3       NULL    NULL
 
761
2       2       3       3       NULL    NULL
745
762
1       3       4       2       1       2
746
763
1       3       4       2       2       2
747
 
1       3       5       3       NULL    NULL
748
 
2       2       3       3       NULL    NULL
749
764
2       2       4       2       1       2
750
765
2       2       4       2       2       2
 
766
1       3       5       3       NULL    NULL
751
767
2       2       5       3       NULL    NULL
752
768
SELECT t3.a,t3.b,t4.a,t4.b
753
 
FROM t3 CROSS JOIN t4;
 
769
FROM t3,t4;
754
770
a       b       a       b
755
771
1       2       3       2
756
772
2       2       3       2
774
790
WHERE t1.a <= 2;
775
791
a       b       a       b       a       b       a       b
776
792
1       3       3       3       NULL    NULL    NULL    NULL
 
793
2       2       3       3       NULL    NULL    NULL    NULL
777
794
1       3       4       2       1       2       3       2
778
795
1       3       4       2       1       2       4       2
779
 
1       3       5       3       NULL    NULL    NULL    NULL
780
 
2       2       3       3       NULL    NULL    NULL    NULL
781
796
2       2       4       2       1       2       3       2
782
797
2       2       4       2       1       2       4       2
 
798
1       3       5       3       NULL    NULL    NULL    NULL
783
799
2       2       5       3       NULL    NULL    NULL    NULL
784
800
SELECT t1.a,t1.b,t2.a,t2.b,t3.a,t3.b,t4.a,t4.b
785
801
FROM t1, (t3, t4) 
789
805
WHERE t1.a <= 2;
790
806
a       b       a       b       a       b       a       b
791
807
1       3       3       3       NULL    NULL    NULL    NULL
 
808
2       2       3       3       NULL    NULL    NULL    NULL
792
809
1       3       4       2       1       2       3       2
793
810
1       3       4       2       1       2       4       2
794
 
1       3       5       3       NULL    NULL    NULL    NULL
795
 
2       2       3       3       NULL    NULL    NULL    NULL
796
811
2       2       4       2       1       2       3       2
797
812
2       2       4       2       1       2       4       2
 
813
1       3       5       3       NULL    NULL    NULL    NULL
798
814
2       2       5       3       NULL    NULL    NULL    NULL
799
815
SELECT t1.a,t1.b,t2.a,t2.b,t3.a,t3.b,t4.a,t4.b
800
816
FROM t1, (t3, t4)
833
849
(t1,t2)
834
850
ON t3.a=1 AND t3.b=t2.b AND t2.b=t4.b;
835
851
id      select_type     table   type    possible_keys   key     key_len ref     rows    filtered        Extra
 
852
1       SIMPLE  t3      ALL     NULL    NULL    NULL    NULL    2       100.00  
 
853
1       SIMPLE  t4      ALL     NULL    NULL    NULL    NULL    2       100.00  Using join buffer
 
854
1       SIMPLE  t2      ref     idx_b   idx_b   5       test.t3.b       1       100.00  
836
855
1       SIMPLE  t1      ALL     NULL    NULL    NULL    NULL    3       100.00  
837
 
1       SIMPLE  t2      ref     idx_b   idx_b   5       test.t3.b       1       100.00  
838
 
1       SIMPLE  t3      ALL     NULL    NULL    NULL    NULL    2       100.00  
839
 
1       SIMPLE  t4      ALL     NULL    NULL    NULL    NULL    2       100.00  Using join buffer
 
856
Warnings:
840
857
Note    1003    select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b` from `test`.`t3` join `test`.`t4` left join (`test`.`t1` join `test`.`t2`) on(((`test`.`t3`.`a` = 1) and (`test`.`t3`.`b` = `test`.`t2`.`b`) and (`test`.`t2`.`b` = `test`.`t4`.`b`))) where 1
841
 
Warnings:
842
858
SELECT t2.a,t2.b,t3.a,t3.b,t4.a,t4.b
843
859
FROM (t3,t4)
844
860
LEFT JOIN              
895
911
1       SIMPLE  t3      ALL     NULL    NULL    NULL    NULL    2       100.00  Using where
896
912
1       SIMPLE  t4      ALL     NULL    NULL    NULL    NULL    2       100.00  Using where
897
913
1       SIMPLE  t5      ALL     NULL    NULL    NULL    NULL    3       100.00  Using where
 
914
1       SIMPLE  t7      ALL     NULL    NULL    NULL    NULL    2       100.00  Using where
898
915
1       SIMPLE  t6      ALL     NULL    NULL    NULL    NULL    3       100.00  Using where
899
 
1       SIMPLE  t7      ALL     NULL    NULL    NULL    NULL    2       100.00  Using where
900
916
1       SIMPLE  t8      ALL     NULL    NULL    NULL    NULL    2       100.00  Using where
901
917
1       SIMPLE  t9      ALL     NULL    NULL    NULL    NULL    3       100.00  Using where; Using join buffer
 
918
Warnings:
902
919
Note    1003    select `test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b`,`test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b`,`test`.`t9`.`a` AS `a`,`test`.`t9`.`b` AS `b` from `test`.`t0` join `test`.`t1` left join (`test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(((`test`.`t4`.`b` = `test`.`t2`.`b`) and (`test`.`t3`.`a` = 1))) join `test`.`t5` left join (`test`.`t6` join `test`.`t7` left join `test`.`t8` on(((`test`.`t8`.`b` = `test`.`t5`.`b`) and (`test`.`t6`.`b` < 10)))) on(((`test`.`t7`.`b` = `test`.`t5`.`b`) and (`test`.`t6`.`b` >= 2)))) on((((`test`.`t3`.`b` = 2) or isnull(`test`.`t3`.`c`)) and ((`test`.`t6`.`b` = 2) or isnull(`test`.`t6`.`c`)) and ((`test`.`t5`.`b` = `test`.`t0`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t6`.`c`) or isnull(`test`.`t8`.`c`)) and (`test`.`t1`.`a` <> 2))) join `test`.`t9` where ((`test`.`t9`.`a` = 1) and (`test`.`t1`.`b` = `test`.`t0`.`b`) and (`test`.`t0`.`a` = 1) and ((`test`.`t2`.`a` >= 4) or isnull(`test`.`t2`.`c`)) and ((`test`.`t3`.`a` < 5) or isnull(`test`.`t3`.`c`)) and ((`test`.`t4`.`b` = `test`.`t3`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t4`.`c`)) and ((`test`.`t5`.`a` >= 2) or isnull(`test`.`t5`.`c`)) and ((`test`.`t6`.`a` >= 4) or isnull(`test`.`t6`.`c`)) and ((`test`.`t7`.`a` <= 2) or isnull(`test`.`t7`.`c`)) and ((`test`.`t8`.`a` < 1) or isnull(`test`.`t8`.`c`)) and ((`test`.`t9`.`b` = `test`.`t8`.`b`) or isnull(`test`.`t8`.`c`)))
903
 
Warnings:
904
920
CREATE INDEX idx_b ON t4(b);
905
921
CREATE INDEX idx_b ON t5(b);
906
922
EXPLAIN EXTENDED
1038
1054
(t8.b=t9.b OR t8.c IS NULL) AND
1039
1055
(t9.a=1);
1040
1056
id      select_type     table   type    possible_keys   key     key_len ref     rows    filtered        Extra
1041
 
1       SIMPLE  t0      ref     idx_a   idx_a   5       const   2       100.00  Using where
1042
 
1       SIMPLE  t1      ALL     idx_b   NULL    NULL    NULL    3       100.00  Using where; Using join buffer
 
1057
1       SIMPLE  t0      ref     idx_a   idx_a   5       const   1       100.00  
 
1058
1       SIMPLE  t1      ref     idx_b   idx_b   5       test.t0.b       1       100.00  
1043
1059
1       SIMPLE  t2      ALL     NULL    NULL    NULL    NULL    3       100.00  Using where
1044
1060
1       SIMPLE  t4      ref     idx_b   idx_b   5       test.t2.b       1       100.00  
1045
1061
1       SIMPLE  t3      ALL     NULL    NULL    NULL    NULL    2       100.00  Using where
1307
1323
create table t1 (a int);
1308
1324
insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
1309
1325
create table t2 (a int, filler char(100), key(a));
1310
 
insert into t2 select A.a + 10*B.a, '' from t1 A CROSS JOIN t1 B;
 
1326
insert into t2 select A.a + 10*B.a, '' from t1 A, t1 B;
1311
1327
create table t3 like t2;
1312
1328
insert into t3 select * from t2;
1313
1329
explain select * from t1 left join 
1488
1504
1       SIMPLE  t1      ALL     PRIMARY NULL    NULL    NULL    36      
1489
1505
1       SIMPLE  t4      eq_ref  PRIMARY,id      PRIMARY 10      test.t1.carrier 1       
1490
1506
1       SIMPLE  t5      ref     carrier_id      carrier_id      5       test.t4.id      1       Using index
1491
 
1       SIMPLE  t2      ref     package_id      package_id      5       test.t1.id      1       Using where; Using index
1492
 
1       SIMPLE  t3      ref     package_id      package_id      5       test.t1.id      1       Using where; Using index
 
1507
1       SIMPLE  t2      ref     package_id      package_id      5       test.t1.id      1       Using index
 
1508
1       SIMPLE  t3      ref     package_id      package_id      5       test.t1.id      1       Using index
1493
1509
SELECT COUNT(*) 
1494
1510
FROM ((t2 JOIN t1 ON t2.package_id = t1.id) 
1495
1511
JOIN t3 ON t3.package_id = t1.id)