473,382 Members | 1,258 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

Left join performance

Jaz
Hello,

Could do with a bit of advice regarding left joins, would be
much appreciated!

OK, I have a table of products. I wish to have another table
of images (filenames only) and a third table which links products
to images (i.e: productID | imageID only).

So... if I do a select like this:

SELECT
p.name,
i.filename
FROM
products AS p
LEFT JOIN
products_to_images AS pi
ON(p.productID = pi.productID)
LEFT JOIN images AS i
ON (pi.imageID = i.imageID)

What sort of performance penalties am I looking at, assuming
I have appropriate indexes on the various IDs? Am I understanding
the idea of relationship tables correctly?

Would storing the image filename directly within the product table
be a significant speed increase? (tho obviously losing expandability).

And finally... how far should you go with joins (in terms of number?).
For example, as well as images, a product could have its description,
reviews etc. etc. all stored in other tables and linked with an ID. A query
to show the whole lot of info would have a LOT of joins.

Sorry for the rambling, just trying to get my head round these concepts.
Any advice would be great.

Cheers,
J
Jul 19 '05 #1
0 2508

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Jaz | last post by:
Hello, Could do with a bit of advice regarding left joins, would be much appreciated! OK, I have a table of products. I wish to have another table of images (filenames only) and a third table...
4
by: Marek Kotowski | last post by:
Hi, What is the real difference between LEFT JOIN and RIGHT JOIN? Are there situations where a query with RIGHT JOIN cannot be rewritten with LEFT JOIN and tables reversed? (and vice versa). ...
1
by: Steve | last post by:
I have a SQL query I'm invoking via VB6 & ADO 2.8, that requires three "Left Outer Joins" in order to return every transaction for a specific set of criteria. Using three "Left Outer Joins"...
7
by: Steve | last post by:
I have a SQL query I'm invoking via VB6 & ADO 2.8, that requires three "Left Outer Joins" in order to return every transaction for a specific set of criteria. Using three "Left Outer Joins"...
6
by: Thomas Beutin | last post by:
Hi, i've a speed problem withe the following statement: SELECT DISTINCT pz.l1_id, pz.l2_id, pz.l3_id, pz.l4_id FROM ot_adresse AS a, ot_produkt AS p LEFT OUTER JOIN ot_kat_prod AS pz ON (...
5
by: Todd | last post by:
Data related to the query I'm working on is structured such that TableA and TableB are 1-many(optional). If an item on TableA has children on TableB, I need to use the Max(tstamp) from Table B in...
2
by: lelandhuang | last post by:
I am developing reporting service and using lots of 'LEFT OUTER JOIN', I am worried about the performance and want to use some subquery to improve the performance. Could I do that like below, ...
9
by: shanevanle | last post by:
I have two tables that are pretty big. I need about 10 rows in the left table and the right table is filtered to 5 rows as well. It seems when I join the tables in the FROM clause, I have to...
1
by: skaterplus | last post by:
dear guys, I would like to know about performances using these to type of queries: select * from a, b where a.id=b.id or: select * from a left join b on a.id=b.id I also thing that in...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...

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.