Portal | IBM Manuals | Downloads | Products | Refer | Info | Programs | JCLs | Forum Rules*| Site Map | Mainframe CD 
IBMMAINFRAMES.com - IBM Mainframe Support Forums Index
 
Register
 
IBMMAINFRAMES.com - IBM Mainframe Support Forums Index FAQ Search Memberlist Usergroups Profile Log in to check your private messages Log in
 
Difference in performance between the two queries below

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
Author Message
venkagov

New User


Joined: 10 Aug 2006
Posts: 6
Location: Chennai

PostPosted: Fri Sep 22, 2006 11:19 am    Post subject: Difference in performance between the two queries below
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
References
anamikak

Active User


Joined: 10 May 2006
Posts: 65
Location: Singapore

PostPosted: Fri Sep 22, 2006 11:30 am    Post subject:
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

Active User


Joined: 10 May 2006
Posts: 65
Location: Singapore

PostPosted: Fri Sep 22, 2006 11:33 am    Post subject:
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    Post subject: Re: Query Performance
Reply with quote

Thanks Anamika.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1