does JOINING on TABLES ALWAYS create Cartesian products of those tables ?
if a problem can be solved by sub-query and Joining which should i prefer ?
which one is fast and memory saving ?
All the questions are tightly coupled, so please dont tell to open another thread 🙁
MySQL 5
Yes, but normall that is then filtered down and the query optimizer is smart enough to take a more efficient approach. Anyhow, all joins without conditions ARE cartesian products ni the start.
Depends a lot on the query optimizer and the data in question. As in: Try it out. Prettym uch the only way.
Again – try it out.
This stuff really depends no the table sizes involved AND THE FILTER CONDITIONS. Basically a materialized cartesian product in most cases is bad programming (ups, forgot the fitler conditions) or a very bad query plan. In most cases the cartesian product iwll never materialize and the query optimizer will use a different approach.