IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Difference in performance between the two queries below


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
venkagov

New User


Joined: 10 Aug 2006
Posts: 6
Location: Chennai

PostPosted: Fri Sep 22, 2006 11:19 am
Reply with quote

Hi,

Can anyone tell me will there be any difference in performance between the two queries below.

Query 1:

Select A.EMPNO,A.EMPNAME,A.DEPTNO,B.DEPTNAME
FROM EMP A,DEPT B
WHERE A.DEPTNO = B.DEPTNO

I think above query uses cartesian product.

Query 2:

Select A.EMPNO,A.EMPNAME,A.DEPTNO,B.DEPTNAME
FROM EMP A INNER JOIN DEPT B
ON A.DEPTNO = B.DEPTNO

Above query uses join.

Join is better than cartesian product right?

Let me know if I am wrong.

Also please tell me some way of comparing the perfomance of queries.
Back to top
View user's profile Send private message
anamikak

New User


Joined: 10 May 2006
Posts: 64
Location: Singapore

PostPosted: Fri Sep 22, 2006 11:30 am
Reply with quote

query 1 and 2 are just the same. They represent inner join.
query 1 and 2 represent two equivalent syntax for performing inner join. when INNER JOIN is specified, the WHERE keyword is replaced with the ON keyword.
Back to top
View user's profile Send private message
anamikak

New User


Joined: 10 May 2006
Posts: 64
Location: Singapore

PostPosted: Fri Sep 22, 2006 11:33 am
Reply with quote

Also, performance wise there is not going to be any difference.

Anamika
Back to top
View user's profile Send private message
venkagov

New User


Joined: 10 Aug 2006
Posts: 6
Location: Chennai

PostPosted: Fri Sep 22, 2006 11:47 am
Reply with quote

Thanks Anamika.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts exploiting Z16 performance PL/I & Assembler 2
No new posts Timestamp difference and its average ... DB2 11
No new posts Difference when accessing dataset in ... JCL & VSAM 7
No new posts JOIN STATEMENT PERFORMANCE. DFSORT/ICETOOL 12
No new posts What is the difference between Taskty... Compuware & Other Tools 2
Search our Forums:

Back to Top