Prepare for your Next Interview
|
Welcome to the Geeks Talk forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact contact us. |
This is a discussion on Sql join performance Query within the Database Design forums, part of the Databases category; I have a sql join 3 tables, like this: select * from tableA a left join tableB b on a.id1 = b.id1 left join tableC c on b.id2 = c.id2 ...
|
|||||||
| Database Design Disucss if you have any issues with Database Design and Concepts |
![]() |
| LinkBack | Thread Tools | Display Modes |
|
|||
|
Sql join performance Query
I have a sql join 3 tables, like this:
select * from tableA a left join tableB b on a.id1 = b.id1 left join tableC c on b.id2 = c.id2 It works with the correct result, but takes so long time. For example, in each table, there is about 300 rows --> the above query takes ~ 20 seconds. Does anyone know how to improve in this case? |
| Sponsored Links |
|
|||
|
Re: Sql join performance Query
Quote:
The very purpose of the left outer join is to get the records meets the join condition + rest of the rows from left table. The left most table will the table that he wants to get all the records whether it satisfies the join condition or not. Changing the smaller table as left most table may not serve its purpose. |
|
|||
|
Re: Sql join performance Query
Are the index created on the tables? Again you have only 300 records so creating an index might not work out for you becuase the data volume is very very less.
|
|
|||
|
Re: Sql join performance Query
Since the query has " Select * ", server will not able to understand which " id "column to select . So please specify all the common columns in the select statement. This will help you.
Check all the ids columns in the where clause have values. Could be because of null values in the ids columns , if these are ids then must have unique values. Performance could be because of your data. |
![]() |
|
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Outer Join Query Example | mailtos.ravi | SQL | 4 | 03-05-2008 04:34 AM |
| Query Performance | krishnaindia2007 | Oracle | 4 | 12-12-2007 04:21 AM |
| calculating the sum of a field in a query with join | 3roses | Oracle | 2 | 09-05-2007 01:17 PM |
| Writing query with LEFT OUTER JOIN | N SRIRAM K | Data Warehousing | 5 | 09-03-2007 06:08 AM |
| Join Query without using NOT IN subquery | Geek_Guest | SQL | 1 | 03-07-2007 04:24 PM |