Linking Tables
am 31.07.2006 17:42:23 von trevordixonDoes linking tables with JOIN offer any significant performance
advantage or does it just make things more simple from a programming
standpoint?
Trevor
Does linking tables with JOIN offer any significant performance
advantage or does it just make things more simple from a programming
standpoint?
Trevor
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
difference.
JOINS are necessary when you want to include everything from one table,
even if it's not in the other (outer join).
HTH
D.
trevordixon@gmail.com wrote:
> Does linking tables with JOIN offer any significant performance
> advantage or does it just make things more simple from a programming
> standpoint?
>
> Trevor
trevordixon@gmail.com wrote:
> Does linking tables with JOIN offer any significant performance
> advantage or does it just make things more simple from a programming
> standpoint?
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.
Regards,
Bill K.
news:1154360543.614627.80830@i3g2000cwc.googlegroups.com...
> Does linking tables with JOIN offer any significant performance
> advantage or does it just make things more simple from a programming
> standpoint?
>
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
avoidance.
JOINS are your friend ;-)
Thomas Bartkus
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,
Trevor