3 ms·
I think the point is rather that a join with a condition (which is the norm) is almost never actually executed as a cartesian product. take for example from tfa
by gfody 6y ago
I think the point is rather that a join with a condition (which is the norm) is almost never actually executed as a cartesian product. take for example from tfa
select * from customer_order_items
the grain is one row per customer order item, and the next two joins don't change that
select * from customer_order_items join customer_orders on order_id
the grain is still one row per customer order item
select * from customer_order_items join customer_orders on order_id join customers on customer_id
the grain is still one row per customer order item
..etc..
of course later on they screw it up and take the cartesian product of customer_order_items by employ_markouts, but it's just 2 big factors not 7 - their query did finish after a few seconds. usually mistakes involving cartesian products with 7 factors just run for hours and eventually throw out of memory.