By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,677 Members | 1,890 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,677 IT Pros & Developers. It's quick & easy.

Left join performance

P: n/a

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:

products AS p
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.

Jul 19 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.