QuestionQ227

VerifiedData Processing & Transformations

A data engineer is running a Spark SQL job on Databricks and observes that joins between a small lookup table and a large fact table are performing slowly. The engineer wants Spark to automatically broadcast the small lookup table to all executors in order to speed up the join.

Which configuration parameter should the data engineer adjust?

Explanation

Spark SQL uses the spark.sql.autoBroadcastJoinThreshold setting to decide whether to automatically broadcast a smaller table to all executor nodes instead of performing a shuffle join. When the estimated size of a table (or one side of the join) is below this threshold, Spark converts the join into a broadcast hash join, which eliminates the need to shuffle the large fact table across the cluster and significantly improves join performance. The other options—spark.sql.shuffle.partitions and spark.default.parallelism—control the degree of parallelism/number of partitions during shuffles, and spark.executor.memory controls per-executor memory allocation; none of these directly control automatic broadcast join behavior.

Learn more

Community Discussion

No comments yet. Be the first to start the discussion!