Skip to content
BENIBIX Learn

Broadcast Join

Data⚙️ ProcessingDistributed Processing

Also known as Broadcast Hash Join, Map-Side Join, Map Join

A join that sends a small table to every worker. The big table stays put.

Think of it like

It is like giving each cook a copy of a short recipe. No one has to walk to get it.

Example

A shop joins 3 billion sales rows to a list of 200 stores. The store list goes to every worker, and the sales rows never move.

Why it matters

Moving a big table across the network is often the slowest step in a job. A broadcast join skips it.

Definition

A broadcast join is a way to join a big table to a small one in a cluster. A full copy of the small table is sent to every worker. Each worker then joins its own slice of the big table locally. The big table never has to move across the network. Spark does this on its own when the small table is under 10 MB, unless you change that limit.

Example code

sql
SELECT /*+ BROADCAST(s) */ *
FROM sales t JOIN stores s ON t.store_id = s.store_id;
A hint that tells Spark to copy the small stores table to every worker.
Each worker box holds a copy of the small table. That copy is the bright strip.

Common mistake

Hinting a broadcast for a table that is not small. Every worker must hold a full copy, and they can run out of memory.

Key takeaways

  1. 1
    Small table copied. Every worker gets all of it.
  2. 2
    Big table stays. No shuffle across the network.
  3. 3
    Size limit. Spark does it under 10 MB by default.