🤖 AI Summary
Existing methods for uniform sampling and approximate counting of projection join queries suffer from poor efficiency, particularly when projections drastically reduce output size, leading to unacceptable computational complexity. This work presents the first asymptotically optimal algorithms for uniform sampling and approximate counting tailored to three fundamental classes of join-projection queries: matrix, star, and chain queries. By integrating rejection sampling with hybrid counting reduction techniques, the proposed approach achieves polynomial-speedup for matrix and star queries. Theoretical optimality is established through communication complexity lower bounds, which also reveal an inherent limitation: chain queries fundamentally preclude sublinear-time algorithms. These results precisely delineate the theoretical boundary between tractable and intractable regimes within this problem space.
📝 Abstract
Uniform sampling and approximate counting are fundamental primitives for modern database applications, ranging from query optimization to approximate query processing. While recent breakthroughs have established optimal sampling and counting algorithms for full join queries, a significant gap remains for join-project queries, which are ubiquitous in real-world workloads. The state-of-the-art ``propose-and-verify'' framework \cite{chen2020random} for these queries suffers from fundamental inefficiencies, often yielding prohibitive complexity when projections significantly reduce the output size.
In this paper, we present the first asymptotically optimal algorithms for fundamental classes of join-project queries, including matrix, star, and chain queries. By leveraging a novel rejection-based sampling strategy and a hybrid counting reduction, we achieve polynomial speedups over the state of the art. We establish the optimality of our results through matching communication complexity lower bounds, which hold even against algebraic techniques like fast matrix multiplication. Finally, we delineate the theoretical limits of the problem space. While matrix and star queries admit efficient sublinear-time algorithms, we establish a significantly stronger lower bound for chain queries, demonstrating that sublinear algorithms are impossible in general.