In traditional database query optimization, data flows upward. Tables are scanned, filtered by local predicates, and then joined in a bottom-up fashion. However, for complex queries—those involving many tables, graph patterns, or distributed data—this linear flow often leads to an "intermediate result explosion." A join between two tables might produce millions of rows, only for 99% of them to be discarded by a third join later in the pipeline.
The core insight of Sideways Information Passing (SIP) is that we can use information from one part of a query tree to prune data in a completely different branch before the expensive join operations even begin.
The Problem of Dangling Tuples
The fundamental bottleneck in complex joins is the "dangling tuple." These are records that satisfy local filters (e.g., age > 25) but have no matching partner in the final multi-way join result. Standard optimizers often process these tuples through multiple join stages before realizing they don't contribute to the output.
As Matthias Lanzinger, Cem Okulmus, and their colleagues argue in Structure-Guided Query Evaluation: Towards Bridging the Gap from Theory to Practice, this explosion can be avoided by rewriting queries into sequences of semi-joins. A semi-join doesn't combine rows; it simply acts as a filter, asking: "Which of my rows actually have a match in that other table?" By performing a bottom-up pass of these semi-joins, a system can eliminate dangling tuples early, turning queries that previously timed out into tasks that finish in seconds.
Mechanisms of Information Passing
To pass information "sideways" between branches of a query tree, systems use various compact representations of data.
- Hash and Bloom Filters: In their seminal work, Ming-Syan Chen, Hui-I Hsiao, and Philip S. Yu proposed interleaving the execution of bushy join trees with hash filters. By assigning sequence numbers to joins, they demonstrated that filters generated by later operations could be applied to earlier ones, slashing execution times by over 50% in Applying Hash Filters to Improving the Execution of Bushy Trees.
- Bidirectional Handshakes: When data is split across heterogeneous systems (like Hadoop and a relational warehouse), moving raw data is prohibitively expensive. Fatma Ozcan and Yuanyuan Tian introduced a "zigzag join" in Joins for Hybrid Warehouses. This uses a bidirectional Bloom filter handshake, where both sides exchange filters to prune non-matching records locally before any actual data crosses the network.
- Variable Bindings: In decentralized SPARQL queries, Gabriela Montoya and Ilkcan Keles show that transmitting intermediate variable bindings back to the server can drastically reduce the volume of data transferred by ensuring the server only returns triples relevant to the current join state (Analysis of the Effect of Query Shapes on Performance over LDF Interfaces).
SIP in Modern Systems
The intuition of sideways passing is now being integrated into specialized database engines to handle modern workloads like graph processing and cloud-native analytics.
In the KÙZU Graph Database Management System, Chang Liu and Ziyi Chen use SIP to transmit filters from the "probe" side of a join to the "build" side. This ensures that the system only scans the specific disk blocks containing relevant node or edge properties, preventing unnecessary I/O.
Similarly, Amazon Redshift Spectrum uses small local dimension tables to generate dynamic semi-join predicates. As Mengchu Cai and Ippokratis Pandis describe, these filters are pushed down to the remote S3 storage layer, filtering exabytes of data at the source before it ever reaches the compute cluster.
Bridging Theory and Practice
While the theoretical benefits of these techniques—often rooted in Yannakakis' algorithm—have been known for decades, they are difficult to implement because they don't always help. If a filter isn't selective, the overhead of creating and passing it might exceed the savings.
Recent research is turning to machine learning to solve this. In Selective Use of Yannakakis' Algorithm to Improve Query Performance, Daniela Böhm and her team explore using ML to decide exactly when the overhead of semi-join pruning is justified. Meanwhile, the FlowLog engine by Hangdong Zhao and Paraschos Koutris demonstrates that decoupling this logical optimization from physical execution allows SIP to scale to massive, recursive Datalog queries.
By treating a query not as a rigid tree but as a fluid network where information can flow sideways, these systems move closer to the theoretical ideal of processing only the data that actually matters.