Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Query Efficency Question

Status
Not open for further replies.

fmrock

Programmer
Sep 5, 2006
510
US
I am trying to make a query more efficient, and was wondering if it makes a difference the order of the clause in the join

Code:
FROM 
	ACCOUNT A 
	JOIN CHARGES C ON ((A.ACCTCPCODE = C.CPCODE) AND (A.ACCTCODE = C.ACCOUNT))
WHERE

OR

Code:
FROM 
	ACCOUNT A 
	JOIN CHARGES C ON ((C.CPCODE=A.ACCTCPCODE) AND (C.ACCOUNT=A.ACCTCODE))
WHERE
 
Did you run an explain plan? It would tell you if changing the order makes a difference.

Beware of false knowledge; it is more dangerous than ignorance. ~George Bernard Shaw
Consultant Developer/Analyst Oracle, Forms, Reports & PL/SQL (Windows)
My website: www.EmuProductsPlus.com
 
fmrock:
No, it doesn't matter.

BJCooperIT:
2 similar plans may produce different workload, e.g. in case of compound indexes. At least it was in older Oracle versions, where the order of predicates mattered.

Regards, Dima
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top