VIVEK_SHARMA wrote: > > Which would Perform Better ? > 1) Having an SQL Query Doing a Join between 6 Tables > > 2) Running 1 SQL Query on a Single Table , getting the Output Values in a Cursor > & passing the Cursor Values as Arguments to the where Clause of a 2nd SQL Query > Running on a 2nd Table & thus so on ... thereby finally getting the Output from the >6th Table >
In the first case you give a free-hand to the optimizer, which, for all its flaws, doesn't do THAT bad a job. In the second one, you force (forgetting about the cost of additional cursors etc.) nested loops. Think about it. God knows I have met awful SQL programmers (people I wouldn't give SELECT 'HELLO WORLD' FROM DUAL to maintain) but assuming some reasonable knowledge of SQL and no obvious mistake (eg 2 or 3 missing join conditions fixed by a DISTINCT) 1) is the winner, by a margin which depends on the query and the developer's skills. Even in the worst case, the join will be easier to fix by somebody who is knowledgeable. BTW a join between 6 tables is not, in itself, a monster query. I have done worse. -- Regards, Stephane Faroult Oriole Software -- Please see the official ORACLE-L FAQ: http://www.orafaq.com -- Author: Stephane Faroult INET: [EMAIL PROTECTED] Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051 San Diego, California -- Public Internet access / Mailing Lists -------------------------------------------------------------------- To REMOVE yourself from this mailing list, send an E-Mail message to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).
