在sparksql中,我有一个查询,它在联接中使用多个表(大表和小表)。我的问题是- does the order of these tables matter with respect to query performance ?
例如。
select larger.col1, smaller.col2
from larger
Left Join smaller
on larger.key = smaller.key
Left Join larger2
on larger2.key2 = smaller.key2
我在网上搜索过,但没有得到确切的答案。那么,如果我改变左表和右表的顺序,性能会有所不同吗?
1条答案
按热度按时间rlcwz9us1#
连接顺序似乎被spark更改为优化。
可能有:
重新排序联接优化器
重新排序联接优化器-星型架构
重新排序联接优化器-基于成本的优化
以下内容似乎对这一主题有所帮助:
https://www.waitingforcode.com/apache-spark-sql/reorder-join-optimizer-star-schema/readhttps://www.waitingforcode.com/apache-spark-sql/reorder-join-optimizer/readhttps://www.waitingforcode.com/apache-spark-sql/reorder-join-optimizer-cost-based-optimization/read