In a broadcast join, all of the selected records of one file are sent or broadcast to all the nodes of the other file before the join is performed.
This is the join method that is used for all nonequijoin queries. This method is also used when the join criteria uses fields that have a data type of date, time, timestamp, or floating-point numeric.
In the following example, the distributed query optimizer decides to broadcast EMPLOYEE, because applying the selection JOB = 'Manager' results in broadcasting a smaller set of records. The temporary file at each node in the node group contains all the selected records. (Records are duplicated at each node.)
SQL statement:
SELECT DEPTNAME, FIRSTNME, LASTNAME FROM DEPARTMENT, EMPLOYEE WHERE DEPTNO <> WORKDEPT AND JOB = 'Manager'
OPNQRYF command:
OPNQRYF FILE((DEPARTMENT) (EMPLOYEE)) FORMAT(JOINFMT) QRYSLT('JOB *EQ 'Manager') JFLD((DEPTNO WORKDEPT *NE))
The distributed query optimizer sends the following two selected records to each node:
|
Records returned by this query:
|