Perfect and Maximum Randomness in Stratified Sampling over Joins

Research paper by Niranjan Kamat, Arnab Nandi

Indexed on: 19 Jan '16Published on: 19 Jan '16Published in: Computer Science - Databases


Supporting sampling in the presence of joins is an important problem in data analysis. Pushing down the sampling operator through both sides of the join is inherently challenging due to data skew and correlation issues between output tuples. Joining simple random samples of base relations typically leads to results that are non-random. Current solutions to this problem perform biased sampling of one~(and not both) of the base relations to obtain a simple random sample. These techniques are not always practical since they may result in the sample size being greater than the size of the relations due to sample inflation, rendering sampling counter-productive. This paper presents a unified strategy towards sampling over joins, comprising two key contributions. First, in the case that perfect sampling is a requirement, we introduce techniques to generate a \emph{perfect} random sample from both sides of a join. We show that the challenges faced in sampling over joins are ameliorated in the context of stratified random sampling as opposed to simple random sampling. We reduce the dependency of feasibility of sampling from relation level to strata level. Our technique minimizes the sample size while maintaining perfect randomness. Second, in the case that random sampling is not a requirement but is still preferred, we provide a novel sampling heuristic to \emph{maximize} randomness of the join. It allows us to allocate a fixed sample size between multiple relations consisting of multiple strata to maximize the join randomness. We validate our techniques theoretically and empirically using synthetic datasets and a standard benchmark.