#+mvStore#>>SELECTONE.ID,TWO.VAL,THREE.ID,THREE.VAL,FOUR.IDFROMPUBLIC.ONE/* PUBLIC.ONE.tableScan */INNERJOINPUBLIC.TWO/* PUBLIC.PRIMARY_KEY_14: ID = PUBLIC.ONE.ID AND ID = PUBLIC.ONE.ID */ON1=1/* WHERE PUBLIC.ONE.ID = PUBLIC.TWO.ID */LEFTOUTERJOINPUBLIC.TWOTHREE/* PUBLIC.PRIMARY_KEY_14: ID = ONE.ID */ONONE.ID=THREE.IDLEFTOUTERJOINPUBLIC.ONEFOUR/* PUBLIC.PRIMARY_KEY_1: ID = TWO.ID */ONTWO.ID=FOUR.IDWHERE(PUBLIC.ONE.ID=PUBLIC.TWO.ID)AND((THREE.VALISNULL)OR(THREE.VAL>=DATE'2006-07-01'))
#-mvStore#>>SELECTONE.ID,TWO.VAL,THREE.ID,THREE.VAL,FOUR.IDFROMPUBLIC.ONE/* PUBLIC.PRIMARY_KEY_1 */INNERJOINPUBLIC.TWO/* PUBLIC.PRIMARY_KEY_14: ID = PUBLIC.ONE.ID AND ID = PUBLIC.ONE.ID */ON1=1/* WHERE PUBLIC.ONE.ID = PUBLIC.TWO.ID */LEFTOUTERJOINPUBLIC.TWOTHREE/* PUBLIC.PRIMARY_KEY_14: ID = ONE.ID */ONONE.ID=THREE.IDLEFTOUTERJOINPUBLIC.ONEFOUR/* PUBLIC.PRIMARY_KEY_1: ID = TWO.ID */ONTWO.ID=FOUR.IDWHERE(PUBLIC.ONE.ID=PUBLIC.TWO.ID)AND((THREE.VALISNULL)OR(THREE.VAL>=DATE'2006-07-01'))
#+mvStore#>>SELECTONE.ID,TWO.VAL,THREE.ID,THREE.VAL,FOUR.IDFROMPUBLIC.ONE/* PUBLIC.ONE.tableScan */INNERJOINPUBLIC.TWO/* PUBLIC.PRIMARY_KEY_14: ID = PUBLIC.ONE.ID */ON1=1/* WHERE PUBLIC.ONE.ID = PUBLIC.TWO.ID */LEFTOUTERJOINPUBLIC.TWOTHREE/* PUBLIC.PRIMARY_KEY_14: ID = ONE.ID */ONONE.ID=THREE.IDLEFTOUTERJOINPUBLIC.ONEFOUR/* PUBLIC.PRIMARY_KEY_1: ID = TWO.ID */ONTWO.ID=FOUR.IDWHERE(PUBLIC.ONE.ID=PUBLIC.TWO.ID)AND((THREE.VALISNULL)OR(THREE.VAL>=DATE'2006-07-01'))
#-mvStore#>>SELECTONE.ID,TWO.VAL,THREE.ID,THREE.VAL,FOUR.IDFROMPUBLIC.ONE/* PUBLIC.PRIMARY_KEY_1 */INNERJOINPUBLIC.TWO/* PUBLIC.PRIMARY_KEY_14: ID = PUBLIC.ONE.ID */ON1=1/* WHERE PUBLIC.ONE.ID = PUBLIC.TWO.ID */LEFTOUTERJOINPUBLIC.TWOTHREE/* PUBLIC.PRIMARY_KEY_14: ID = ONE.ID */ONONE.ID=THREE.IDLEFTOUTERJOINPUBLIC.ONEFOUR/* PUBLIC.PRIMARY_KEY_1: ID = TWO.ID */ONTWO.ID=FOUR.IDWHERE(PUBLIC.ONE.ID=PUBLIC.TWO.ID)AND((THREE.VALISNULL)OR(THREE.VAL>=DATE'2006-07-01'))
-- Query #4: same as #3, but the joins have been manually re-ordered
-- Correct result set, same as expected for #3.
...
...
@@ -254,8 +254,8 @@ explain select * from test1
innerjointest2ontest1.id=test2.idleft
outerjointest3ontest2.id=test3.id
wheretest3.idisnull;
#+mvStore#>>SELECTTEST1.ID,TEST2.ID,TEST3.IDFROMPUBLIC.TEST2/* PUBLIC.TEST2.tableScan */LEFTOUTERJOINPUBLIC.TEST3/* PUBLIC.PRIMARY_KEY_4C0: ID = TEST2.ID */ONTEST2.ID=TEST3.IDINNERJOINPUBLIC.TEST1/* PUBLIC.PRIMARY_KEY_4: ID = TEST2.ID */ON1=1WHERE(TEST3.IDISNULL)AND(TEST1.ID=TEST2.ID)
#-mvStore#>>SELECTTEST1.ID,TEST2.ID,TEST3.IDFROMPUBLIC.TEST1/* PUBLIC.PRIMARY_KEY_4 */INNERJOINPUBLIC.TEST2/* PUBLIC.PRIMARY_KEY_4C: ID = TEST1.ID AND ID = TEST1.ID */ON1=1/* WHERE TEST1.ID = TEST2.ID */LEFTOUTERJOINPUBLIC.TEST3/* PUBLIC.PRIMARY_KEY_4C0: ID = TEST2.ID */ONTEST2.ID=TEST3.IDWHERE(TEST3.IDISNULL)AND(TEST1.ID=TEST2.ID)
#+mvStore#>>SELECTTEST1.ID,TEST2.ID,TEST3.IDFROMPUBLIC.TEST1/* PUBLIC.TEST1.tableScan */INNERJOINPUBLIC.TEST2/* PUBLIC.PRIMARY_KEY_4C: ID = TEST1.ID */ON1=1/* WHERE TEST1.ID = TEST2.ID */LEFTOUTERJOINPUBLIC.TEST3/* PUBLIC.PRIMARY_KEY_4C0: ID = TEST2.ID */ONTEST2.ID=TEST3.IDWHERE(TEST3.IDISNULL)AND(TEST1.ID=TEST2.ID)
#-mvStore#>>SELECTTEST1.ID,TEST2.ID,TEST3.IDFROMPUBLIC.TEST1/* PUBLIC.PRIMARY_KEY_4 */INNERJOINPUBLIC.TEST2/* PUBLIC.PRIMARY_KEY_4C: ID = TEST1.ID */ON1=1/* WHERE TEST1.ID = TEST2.ID */LEFTOUTERJOINPUBLIC.TEST3/* PUBLIC.PRIMARY_KEY_4C0: ID = TEST2.ID */ONTEST2.ID=TEST3.IDWHERE(TEST3.IDISNULL)AND(TEST1.ID=TEST2.ID)
@@ -5250,7 +5250,7 @@ EXPLAIN PLAN FOR SELECT NAME, COUNT(*) FROM TEST GROUP BY NAME HAVING COUNT(*) >
>> SELECT NAME, COUNT(*) FROM PUBLIC.TEST /* PUBLIC.TEST.tableScan */ GROUP BY NAME HAVING COUNT(*) > 1
EXPLAIN PLAN FOR SELECT * FROM test t1 inner join test t2 on t1.id=t2.id and t2.name is not null where t1.id=1;
>> SELECT T1.ID, T1.NAME, T2.ID, T2.NAME FROM PUBLIC.TEST T1 /* PUBLIC.PRIMARY_KEY_2: ID = 1 */ /* WHERE T1.ID = 1 */ INNER JOIN PUBLIC.TEST T2 /* PUBLIC.PRIMARY_KEY_2: ID = T1.ID AND ID = T1.ID */ ON 1=1 WHERE (T1.ID = 1) AND ((T2.NAME IS NOT NULL) AND (T1.ID = T2.ID))
>> SELECT T1.ID, T1.NAME, T2.ID, T2.NAME FROM PUBLIC.TEST T1 /* PUBLIC.PRIMARY_KEY_2: ID = 1 */ /* WHERE T1.ID = 1 */ INNER JOIN PUBLIC.TEST T2 /* PUBLIC.PRIMARY_KEY_2: ID = T1.ID */ ON 1=1 WHERE (T1.ID = 1) AND ((T2.NAME IS NOT NULL) AND (T1.ID = T2.ID))
EXPLAIN PLAN FOR SELECT * FROM test t1 left outer join test t2 on t1.id=t2.id and t2.name is not null where t1.id=1;
>> SELECT T1.ID, T1.NAME, T2.ID, T2.NAME FROM PUBLIC.TEST T1 /* PUBLIC.PRIMARY_KEY_2: ID = 1 */ /* WHERE T1.ID = 1 */ LEFT OUTER JOIN PUBLIC.TEST T2 /* PUBLIC.PRIMARY_KEY_2: ID = T1.ID */ ON (T2.NAME IS NOT NULL) AND (T1.ID = T2.ID) WHERE T1.ID = 1