Secure Query Processing with Linear Complexity

Ke Yi, Qiyao Luo, Yilei Wang, Wei Dong, Ke Yi 0001arXiv 2024 · DOI

TL;DR

LINQ is the first secure multi-party computation (MPC) protocol to achieve linear complexity—in both time and communication—for join operations and the broad class of "free-connex" queries. By matching the theoretical efficiency of plaintext database systems, LINQ reduces query times for large datasets from hours to seconds, bringing privacy-preserving data analysis significantly closer to real-world viability.

The Complexity Gap in Secure Joins

In the world of Secure Multi-Party Computation (MPC), multiple parties (such as a hospital and an insurance company) seek to analyze combined data without sharing raw records. While MPC has advanced significantly, joins—the operation of linking records across different datasets—remain a massive performance bottleneck.

In standard plaintext databases, many common queries can be solved in "linear time" ($O(n + m)$, where $n$ is the input size and $m$ is the output size). However, existing secure protocols usually rely on expensive $O(n \log n)$ sorting or even $O(n^2)$ brute-force comparisons. This "complexity gap" means that as datasets grow, secure queries become exponentially slower than their private counterparts. For multi-way joins (joining three or more tables), the overhead often becomes so high that queries simply never finish.

Comparison of asymptotic complexities for various secure join methods. LINQ achieves linear complexity across two-way and multi-way joins.

Methods

The authors introduce LINQ, a protocol designed for the three-party computation (3PC) model with an honest majority. Its core innovation lies in avoiding the $O(n \log n)$ sorting bottleneck through three main techniques:

  1. Consistent Sort via Hashing: Traditional MPC joins use "sort-merge-join," which requires a full cryptographic sort. LINQ observes that a perfectly ordered list is unnecessary; parties only need to sort their data in the same way. They achieve this in $O(n)$ time by having parties locally hash their join keys into buckets and then sorting those small buckets.
  2. Rank Attributes: To handle multi-way joins without leaking intermediate data sizes (a major security risk), LINQ uses "ranks." These are secret-shared indices that track the position of tuples. By maintaining and updating these ranks through a modified version of the Yannakakis algorithm, LINQ can process complex query trees while keeping communication costs strictly linear.
  3. Expansion with Ranks: When a join produces more rows than the input (e.g., one-to-many joins), LINQ uses a novel "expansion" primitive that replicates rows and updates their rank attributes in linear time, ensuring the next join in the chain remains efficient.
The LINQ workflow for computing indices and expanding rows using rank attributes and prefix sums.

Evaluation and Key Results

The researchers evaluated LINQ using two primary benchmarks: TPC-H (the industry standard for relational queries) and Bitcoin-Alpha (a real-world graph dataset for trust relationships).

Key Insights

  • The "Consistent Sort" Breakthrough: By using public hash functions to create a "consistent" (but not necessarily alphabetical) order, the protocol moves from $O(n \log n)$ to $O(n)$.
  • Bridging Yannakakis and MPC: LINQ is the first to successfully "circuitize" the Yannakakis algorithm for MPC in a way that preserves linear complexity.
  • Hiding Intermediate Sizes: Most MPC protocols leak the size of intermediate results. LINQ uses padding and rank-based expansion to ensure only the final output size is revealed, maintaining a higher security standard.

Performance Gains

  • Massive Speedup: On TPC-H queries, LINQ was consistently 2x to 4x faster than the previous state-of-the-art (OptScape) and had 4x to 8x lower communication costs.
  • Practical Scalability: LINQ finished a three-relation join with an output of 1 million tuples in approximately 100 seconds. Existing protocols supporting the same query class failed to finish within an hour.
  • Linear Growth: Experiments confirmed that LINQ’s execution time grows linearly with data size, whereas competing methods show performance degradation on big data due to logarithmic overhead.

Limitations and Future Work

While LINQ represents a major step forward, it is currently optimized for the 3PC Honest Majority model. Extending this to the two-party (2PC) model or malicious settings remains an open challenge, as the "consistent sort" relies on parties performing some work on plaintext join keys. Additionally, while LINQ covers the large class of "free-connex" queries, it does not yet support "cyclic" queries (like finding triangles in a graph) with linear complexity, which are theoretically harder even in plaintext environments.

Summary updated

BibTeX
@misc{yi2024secure,
  author = {Ke Yi and Qiyao Luo and Yilei Wang and Wei Dong and Ke Yi},
  title = {{Secure Query Processing with Linear Complexity}},
  year = {2024},
  eprint = {2403.13492},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2403.13492},
}
Figure