What is the most efficient way to implement join on multiple tables (>5 tables) using SQL/ANSI SQL?
-
how to implement 10+ tables outer join using ANSI SQL (using ON clause) for non oracle database (SQL Server and DB2).
-
Answer:
Generally speaking, your database's optimizer should figure out the best method for accessing and joining data. While you could provide optimizer hints, there isn't any better way to inner join two tables than writing an inner join statement. The biggest thing that will impact the performance of your joins is your data model, data size, physical storage properties (IE partitioning), join type (Outer, inner, etc) and indexing strategy. Also don't forget to gather statistics. For understanding how joins will impact query performance I recommend understanding how/when the following joining methods are used: Hash Join Nested Loop Sort Merge Cartesian Anti-Join Semi-Join Oracle docs have great details on each of these and how the optimizer works to predict lowest cost access: http://docs.oracle.com/cd/E11882_01/server.112/e16638/optimops.htm#autoId31
Chris Schrader at Quora Visit the source
Related Q & A:
- Is this right way to implement Abort, Retry and Ignore activity pattern?Best solution by Code Review
- Is it better to use many records in one table, or to use multiple tables?Best solution by Stack Overflow
- How to combine 3 tables using entity framework and LINQ?Best solution by Stack Overflow
- What is the most beneficial way to list my multiple items on eBay?Best solution by Yahoo! Answers
- What is the fastest and most efficient way to heal a canker sore?Best solution by Yahoo! Answers
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.