Linking Tables

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
Does linking tables with JOIN offer any significant performance
advantage or does it just make things more simple from a programming


Re: Linking Tables

If you mean JOIN give you a performance boost compared to doing
somethig lik "WHERE table_one_id = table_two_id" I'm not sure. You
could always run "EXPLAIN {sql statement here}" to see if you see a

JOINS are necessary when you want to include everything from one table,
even if it's not in the other (outer join).

D. wrote:
Quoted text here. Click to load it

Re: Linking Tables wrote:
Quoted text here. Click to load it

SQL89-style joins (SELECT * FROM table1, table2 WHERE ...condition...)
and SQL92-style joins (SELECT * FROM table1 JOIN table2 ON
...condition...) should optimize identically in virtually all cases.

I prefer the SQL92-style joins, because it includes syntax to do outer
joins.  There is no syntax to do outer joins in SQL89.  It's nice to use
one syntax style throughout one's app.

Bill K.

Re: Linking Tables

Quoted text here. Click to load it

MySQL and other databases are *highly optimized* to do JOINs efficiently.

I would turn your question around a bit and say there are no performance
*disadvantages* to using JOINs with lots of great programming reasons to
take advantage of them.

    The excuses people make to avoid learning table JOINs !

Of these, the lamest is an unwillingness to take a performance hit involved
with using JOIN.  What performance hit?  These amateurs take a performance
hit bigtime in lousy database design that always results from JOIN

JOINS are your friend ;-)
Thomas Bartkus

Re: Linking Tables

Thanks to all, I'll certainly take advantage of joins in my project.
They are certainly much better. I'm fairly new to MySQL, so I was using
nested while loops on three different queries and it was taking 16
seconds to perform about 900 queries on a page. Now by joining tables,
it loads in two.

Thanks again,

Site Timeline