Parallel Join Examples

Parallel Join Example 1

The example is a basic SQL query that creates a pairwise join of two server tables, Table1 and Table2.
libname path1 sasspds .... IP=YES;

proc sql;
create table junk as
 select *
  from path1.table1 a,
  path1.table2 b
  where a.i = b.i;
 quit;

Parallel Join Example 2

This example is an SQL query that uses more than two server tables. The SQL Planner performs a parallel join on Table1 and Table2. It then use a non-parallel method to join the results of the first join and Table3. The second join uses a non-parallel join method because the criteria for a parallel join were not met. A parallel join can be performed only on a pairwise join of two server tables and the query calls three server tables.
libname path1 sasspds .... IP=YES;

proc sql;
create table junk as
 select *
  from path1.table1 a,
  path1.table2 b,
  path1.table3 c
 where a.i = b.i and b.i = c.i;
quit;

Parallel Join Example 3

You can use multiple parallel joins in the same SQL query, as long as the SQL Planner can perform the query by using more than one pairwise join. In this parallel join example, a more complex query contains a union of two separate joins. Both joins are pairwise joins of two server tables. There is a pairwise join between Table1 and Table2. A pairwise join between Table3 and Table4 is performed concurrently, using the Parallel Join facility.
proc sql;
create table junk as
 select *
  from path1.table1 a,
  path1.table2 b
  where a.i = b.i
  union

 select *
  from path1.table3 c,
path1.table4 d
where c.i = d.i;
quit;
Last updated: February 8, 2017