Bigdata SQL: Join Order

The order of tables joined while executing an SQL query affects performance, because of the intermediate data sets that are generated. This problem is very similar to the order
in which a series of matrices can be multiplied. The number of possible join orders increases exponentially with the number of tables involved, and it is not possible to
evaluate the cost of execution of each such join order. The idea is to find the join order that results in the maximum reduction of intermediate rows generated, or, in other words,
select the join order that is the most selective in terms of reducing or initially pruning the data sets. If the least amount of data sets that are to be worked on by later operators is
identified early enough, this automatically speeds up the queries.
Join orders can be of three types: left-deep, bushy, and right-deep.
A left-deep join tree does not produce efficient plans for snowflake schemas.