473,804 Members | 3,462 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

INNER JOIN vs Sub-Query (with where clause)

15 New Member
Hi there,

I am implementing a reporting database which manipulating a huge amount of data. I used a lot of join. Just wondering which one performs better between the two scenarios:
1. INNER JOIN first then filter by the WHERE clause.
2. Sub-query which WHERE clause first then INNER JOIN.
Anybody have any recommendation?
Dec 13 '06 #1
4 11120
pragatiswain
96 Recognized Expert New Member
Hi there,

I am implementing a reporting database which manipulating a huge amount of data. I used a lot of join. Just wondering which one performs better between the two scenarios:
1. INNER JOIN first then filter by the WHERE clause.
2. Sub-query which WHERE clause first then INNER JOIN.
Anybody have any recommendation?
Subquery keeps the sql more clear.
May be you have to see the plan, cost and execution time of both the queries and choose the better one.
Dec 13 '06 #2
islandfong
15 New Member
As such, does it mean that there is not a general principle for using INNER JOIN or Sub-Query, at least there is not a clear cut line to say when is to use INNER JOIN and when is to use Sub-Query? But I do have this impression that the sub-query will surely add some slow down to the performance.
Dec 15 '06 #3
suvam
31 New Member
Can u please write down the exact query ?
Or U can do it yourself by identifying the driving table and where it is involved .
Dec 15 '06 #4
birdready2fly
6 New Member
Hi there,

I am implementing a reporting database which manipulating a huge amount of data. I used a lot of join. Just wondering which one performs better between the two scenarios:
1. INNER JOIN first then filter by the WHERE clause.
2. Sub-query which WHERE clause first then INNER JOIN.
Anybody have any recommendation?
sorry u r s question is not clear
Dec 17 '06 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

2
2010
by: Irlan agous | last post by:
Hello i have t tables reactie and form and this query $sql = "select reactie.persid,form.oproep,form.foto,form.id from reactie,form INNER JOIN reactie ON (reactie.persid = form.id) group by reactie.persid order by reactie.persid DESC LIMIT 0,5"; $result = mysql_query($sql);
11
2913
by: news-east.earthlink.net | last post by:
The scenario: two tables CustomerTable --------------- CustomerID OrderID CustomerName CustomerEmail
23
82054
by: Brian | last post by:
Hello All - I am wondering if anyone has any thoughts on which is better from a performance perspective: a nested Select statement or an Inner Join. For example, I could do either of the following: SELECT supplier_name FROM supplier
1
1541
by: Steve | last post by:
Hi, I am real new to databases and hoping someone can help. Main-table is a huge spreadsheet that I imported into Access Site-table has a bunch of addresses pulled from Main-table, quite a few overlap in some areas and none of the fields are unique except the AddressKey which I created after pulling data from the Main-table. Why some fields are not unique I won't get into.
3
1521
by: Sagi | last post by:
i got two tables: tblCat, tblSubCat. i need to get the list of all the category names (CatName), CatOrder from tblCat when tblCat.CatID=tblSubCat.catPID and i need to know how many rows do i got from each capPID. this is what i used: SELECT Count(tblSubCat.catPID) AS CountCatPID, tblCat.CatID, tblCat.CatName, tblCat.CatOrder FROM tblCat INNER JOIN tblSubCat ON tblCat.CatID = tblSubCat.catPID GROUP BY tblCat.CatID, tblCat.CatName,...
4
2246
exoskeleton
by: exoskeleton | last post by:
hi dear experts im here once again...i have a problem on showing the result when im using inner join...here's my code.. $sql_trans_pro_tbl="SELECT transaction_tbl.date_subscribe,transaction_tbl.date_expire". ",product_tbl.pro_id,product_tbl.pro_des FROM transaction_tbl INNER JOIN". " product_tbl ON transaction_tbl.pro_id=product_tbl.pro_id WHERE". " transaction_tbl.account_name='$forder_name'";...
12
13192
by: Chamnap | last post by:
Hello, everyone I have one question about the standard join and inner join, which one is faster and more reliable? Can you recommend me to use? Please, explain me... Thanks Chamnap
2
1486
by: kjewell23 | last post by:
Hello. I'm trying to inner join two tables into one dataset. Is that possible. If so I do I do it. I have my code down below, so if you could help me. please!! I'm using asp.net for my coding Dim myConnection As New Data.Odbc.OdbcConnection(connectionstring) Dim mysql As String = "select rmsfiles2.obcop200.line#, rmsfiles2.mspmp100.ptyp1, rmsfiles2.mspmp100.ptyp2, rmsfiles2.obcop200.quano, rmsfiles2.obcop200.quana,...
4
6789
by: shapper | last post by:
Hello, I have 2 tables: Aid, Aname ... Bid, Aid, Bname ... I need to get the records in B given a Bname and a Aname. I think I should use Inner Join. I wrote the following code:
11
19974
by: YZXIA | last post by:
Is there any difference between explicit inner join and implicit inner join Example of an explicit inner join: SELECT * FROM employee INNER JOIN department ON employee.DepartmentID = department.DepartmentID
0
9591
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10594
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10087
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9166
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6861
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5667
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4306
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3831
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3001
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.