This may be a silly question, but it may shed some light on how joins work internally.
Let’s say I have a large table L and a small table S (100K rows vs. 100 rows).
Would there be any difference in terms of speed between the following two options?:
OPTION 1: OPTION 2:
--------- ---------
SELECT * SELECT *
FROM L INNER JOIN S FROM S INNER JOIN L
ON L.id = S.id; ON L.id = S.id;
Notice that the only difference is the order in which the tables are joined.
I realize performance may vary between different SQL languages. If so, how would MySQL compare to Access?
No, the order does not matter.
Almost all RDBMS’s (such MS Access, MySQL, SQL Server, ORACLE etc) use a cost based optimiser based upon column statistics. In most situations, the optimiser will choose a correct plan. In the example you gave, the order will not matter (provided statistics are up to date).
Ref.
Might be of interest: ACC: How to Optimize Queries in Microsoft Access 2.0, Microsoft Access 95, and Microsoft Access 97
Tony Toews’s Microsoft Access Performance FAQ is worth reading.
There’s a caveat to "JOIN order does not matter".
If your RDBMS’s cost based query optimiser times out creating the query plan then the join order COULD matter. Cost based optimisers have finite resources (both CPU time and memory) in which to construct a query plan. If they time out during the compilation stage, you will get the best plan found so far.
TLDR; If you have complex queries that receive a plan compilation timeout (not query execution timeout), then put your most restrictive joins first. That way, at the point the query plan optimiser times out, it will increase the chance that a ‘better’ plan was found.
Of course, if you are experiencing query plan compilation timeouts, you should probably simplify your query.