Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Fri, 20 Feb 2004 @ 09:00:23 GMT


     
  <Prev Next>  
<<First
<Prev
Next> Last>>  


Subj:   Simple question about a left outer join...
 
From:   Richard Gomez

Hi all,

This is a pretty basic question, but I'm having trouble understanding it (please be kind J). Given the following information:

tbl1 has 2,500 rows
tbl2 has 55,000,000 rows

the UPI for both tables is col1

Will these two SQL statements yield the same results?

sel a.c1,a.c2,a.c3
from tbl1 a left outer join tbl2 b
on a.col1 = b.col1 and b.col1 is null;

sel a.c1,a.c2,a.c3
from tbl1 a left outer join tbl2 b
on a.col1 = b.col1
where b.col1 is null;

If not could you explain why not.

Doing an explain on both queries (stats have been collected), query 1 will take 7 + hours, and query 2 will take just over 2 minutes. By those results, I have a feeling that I may not get the same results I'm looking for.



     
  <Prev Next>  
<<First
<Prev
Next> Last>>  
 
 
 
 
 
 
 
 
  
  Top Home Privacy Feedback  
 
 
Copyright for the TeradataForum (TDATA-L), Manta BlueSky    
Copyright 2016 - All Rights Reserved    
Last Modified: 27 Dec 2016