On Saturday, December 8, 2001, at 12:53 PM, Arjen G. Lentz wrote:
> >>> Re-order the list of tables in the FROM, and put the >>> "subprojectweb.subproject_name = 'shoeshine.com' " bit first >>> after the WHERE, that will also make it clearer for you to read. > >> Is this just for my own personal clarity? I was under the impression >> that the exact order of the JOINs wouldn't matter very much, but I >> haven't found any evidence of this yet. > > Join order *does* matter, the table with the search criteria should > generally > be checked first, most limiting the number of rows. Then the other > tables are > joined into the result using their foreign keys. You don't want te > query to be > performed based on the foreign keys, with the search criteria being > applied > last! I didn't realize that the order of JOIN statements mattered... > For a regular join with commas, the optimiser will try to work out an > optimal > join order. However, you will need to have a look at the output from > EXPLAIN, > which will show the tables in the order they are joined. If it is > non-optimial, you could modify your query by using STRAIGHT_JOIN or > other > tricks to get an optimal join order. ... but now I feel like I have a better grasp of how it works. I guess the best thing to do is just examine the results of the EXPLAIN. >> Thanks very much for responding to my questions about this, Arjen. > > You're quite welcome. > This kind of stuff (optimising) is an important subject in MySQL > training > courses (www.mysql.com/training/). I wish! At some point in the future my organization might grant me that kind of benefit, but for the time being I'm just an office temp who is having a hard enough time trying to justify his project!! Basically, I proposed this project because I wanted to learn more about database-driven web applications using MySQL and PHP and because my organization needed a way to keep track of projects and image files. I really am hoping to take this to a new level eventually, a sort of web-based "workspace" that will include message boards and other functionality to keep all of the users in touch. I would love to take a class on this subject! -- Erik --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php