How to automatically break down a SQL-like query with many joins into discrete, independent steps?
Solution 1:
Implementing joins is a huge topic which is probably out of scope for a StackOverflow answer.
If you're looking for practical information about how joins are implemented, I would suggest...
- The Join Operation section of Use The Index, Luke for different types of join implementation.
- Section 7 of the The SQLite Query Optimizer Overview covers joins. And reading the SQLite source code. It is about as small a practical SQL implementation will get.
- The output of
explain
in Postgresql gives very detailed information about how it has implemented the query. And they are explained in Operator Optimization Information