Distributed Joins
A distributed join is a SQL statement with a join clause that combines two or more partitioned tables. If the tables are joined on the partitioning column (affinity key), the join is called a collocated join. Otherwise, it is called a non-collocated join.
Collocated joins are more efficient because they can be effectively distributed between the cluster nodes.
By default, GridGain treats each join query as if it is a collocated join and executes it accordingly (see the corresponding section below).
Collocated Joins
The following image illustrates the procedure of executing a collocated join. A collocated join (Q
) is sent to all the nodes that store the data matching the query condition. Then the query is executed over the local data set on each node (E(Q)
). The results (R
) are aggregated on the node that initiated the query (the client node).

Non-Collocated Joins
If you execute a query in a non-collocated mode, the SQL Engine executes the query locally on all the nodes that store the data matching the query condition. But because the data is not collocated, each node will request missing data (that is not present locally) from other nodes by sending either broadcast or unicast requests. This process is depicted on the image below.

If the join is done on the primary or affinity key, the nodes will send unicast requests because in this case the nodes will know the location of the missing data. Otherwise, nodes will send broadcast requests. For performance reasons, both broadcast and unicast requests are aggregated into batches.
Enable the non-collocated mode of query execution by setting a JDBC/ODBC parameter or, if you use SQL API, by calling SqlFieldsQuery.setDistributedJoins(true)
.
© 2020 GridGain Systems, Inc. All Rights Reserved. Privacy Policy | Legal Notices. GridGain® is a registered trademark of GridGain Systems, Inc.
Apache, Apache Ignite, the Apache feather and the Apache Ignite logo are either registered trademarks or trademarks of The Apache Software Foundation.