@gabotechs made great improvements in PR #145, and our query plan is much better now. Looking at Q3’s plan, there’s still room to optimize.
Currently, both joins run in the same stage and task because we retain the build-side hash in memory. To scale further, we should distribute each join into its own stage and across multiple tasks. This requires shuffling both sides of the join on their join key—unless they’re already partitioned appropriately, in which case we can skip repartitioning but still keep them distributed. See issue #119 for a related example.