Home » SQL & PL/SQL » SQL & PL/SQL » Which one is faster
Which one is faster [message #22805] Tue, 29 October 2002 21:32 Go to next message
Pujar
Messages: 1
Registered: October 2002
Junior Member
Hi! All,
I have a Confusion with Subquery and join.
My question is which one is fast?
Please tell me how to test timing's

Thank U
Pujar
Re: Which one is faster [message #22815 is a reply to message #22805] Wed, 30 October 2002 09:58 Go to previous messageGo to next message
Todd Barry
Messages: 4819
Registered: August 2001
Senior Member
The answer is...it depends. Look at the EXPLAIN PLAN output for both and turn on AUTOTRACE to look at the internals of the executions.
Re: Which one is faster [message #22867 is a reply to message #22805] Sat, 02 November 2002 17:58 Go to previous message
Su
Messages: 154
Registered: April 2002
Senior Member
As Todd said, it depends. But a normal/plan subquery is faster than corelated subquery. Unless it is needed to do so or no alternative, giving a co-related subquery is not a good idea (performancewise) as each and every time the main query fetches a row the corelated subquery is processed to check its output against the fetched row of main query, causing slow down in the entire query's performance, whereas a plain subquery is processed only once to retrieve its output to check with the rows fetched by main query.
And rest depends on the use of keys and indexes on them. Hope you understand my point.

Good luck :)
Previous Topic: More newbie questions...
Next Topic: How to insert a special character
Goto Forum:
  


Current Time: Sun Apr 28 16:13:56 CDT 2024