Efficient lineage for SUM aggregate queries

Foto N. Afrati, Dimitris Fotakis, Angelos Vasilakopoulos · DOI

TL;DR

This paper introduces "Aggregate Lineage," a novel, randomized data summarization technique that allows for efficient approximation of SUM aggregate queries on large datasets. The key innovation is a small, size-independent summary that can explain "large" aggregate values, enabling better data debugging and intelligent analytics without needing to query the entire original dataset.

What Problem Does This Paper Address?

Modern AI systems and data analytics heavily rely on aggregate functions (like SUM) to derive insights and make decisions. However, computing these aggregates over massive datasets ("big data") is computationally expensive and can be a bottleneck. Furthermore, as AI systems become more sophisticated, there's a growing need to explain why certain aggregate results are high or low. This "data lineage" or "provenance" is crucial for tasks like data debugging (identifying errors) and understanding patterns. Traditional lineage methods, which track every contributing data point, are often too costly for big data. This paper addresses the challenge of creating a compact, efficient summary that can approximate aggregate query results, particularly for explaining significant values, without prior knowledge of the queries themselves.

Methods

The core of the paper is the Aggregate Lineage concept and the Comp-Lineage algorithm.

  • Aggregate Lineage: This is a small summary of the original dataset, maintaining the same schema. It's not a simple random sample; instead, it's generated using weighted random sampling with replacement. The probability of selecting a tuple is proportional to the value of the attribute being aggregated (e.g., salary). The intuition is that tuples with larger values contribute more to the sum, so they should be more likely to be represented in the lineage. The lineage also includes a "frequency" attribute, indicating how many times a tuple was selected.
  • Comp-Lineage Algorithm: This algorithm computes the Aggregate Lineage in a single pass over the data, with a time complexity linear in the size of the original dataset. It takes the original relation R and a desired lineage size b as input. It performs b weighted random selections, where each tuple t is chosen with probability p_t = t[A]/S (where t[A] is the attribute value and S is the total sum of that attribute). The output is the Aggregate Lineage relation LR.A.

The theoretical guarantees for the approximation quality are based on Althöfer's Sparsification Lemma, which deals with sparse approximations of probability vectors.

Datasets

The paper uses a synthetic dataset for illustration, specifically a "Salaries" relation with attributes like EmplID, Department, and Sal (salary). This dataset is used in the running examples (Example 1, 2, and 4) to demonstrate the properties and application of Aggregate Lineage. No specific real-world datasets are mentioned or used for evaluation.

Key Insights and Ideas

  • Value-Proportional Sampling is Key: The core insight is that for explaining large aggregate sums, sampling tuples proportionally to their value is more effective than simple random sampling. This ensures that high-value contributors are well-represented, even if they are few.
  • Lineage Size is Independent of Data Size: A crucial outcome is that the size of the Aggregate Lineage (b) can be chosen independently of the original data size (n). This is a significant advantage for big data scenarios.
  • Explaining "Large" Sums: The method excels at approximating queries that result in large sums relative to the total sum of the attribute. This makes it particularly useful for identifying anomalies or understanding significant contributions.
  • Query Agnosticism: The Aggregate Lineage is computed before any specific queries are known. This makes it a versatile tool that can be used to answer a wide range of ad-hoc SUM queries later.
  • Trade-off for Small Sums: The paper acknowledges that this approach is less effective for approximating queries that result in very small sums compared to the total. This is an inherent limitation of focusing on large-value contributors.

Key Results

  • Approximation Guarantees: The paper provides theoretical guarantees that for a given number of queries (m), error tolerance (ε), and confidence level (p), the size of the Aggregate Lineage (b) can be determined. The approximation error is bounded by εS (where S is the total sum) with a probability of at least 1-p. The formula for b shows it grows logarithmically with m and inversely with ε², making it efficient for a large number of queries.
  • Efficiency: The Comp-Lineage algorithm runs in linear time (O(n)) with respect to the original data size and requires O(b) space for the lineage.
  • Practical Example: The running example demonstrates how Aggregate Lineage can be used to approximate the sum of salaries for specific employee subsets, showing that the approximations are good, especially for larger salary values. For instance, in Example 4, an approximation of 1.17 * 10^12 was achieved for an exact sum of 1.1 * 10^12.

Limitations and Future Work

  • Focus on Large Sums: The primary limitation is that the method is most effective for approximating queries that yield large sums relative to the total. It is not well-suited for approximating small sums.
  • Single Attribute: The current exposition focuses on a single aggregated attribute. While the authors suggest extending it to multiple attributes by maintaining separate lineages, this adds complexity.
  • Parallelization: The current implementation of weighted random sampling is not easily parallelizable in a direct way. Efficient implementation in distributed environments like MapReduce remains an open problem.
  • Evolving Data: The technique assumes a static dataset. Adapting it for continuously evolving data streams, where the sample might need to change over time, is another area for future research.
  • Oblivious Adversary: The theoretical guarantees hold for queries posed by an "oblivious adversary," meaning the query cannot know the specific random choices made during lineage construction. This is a standard assumption in randomized algorithms but is a technical constraint.

Summary updated

BibTeX
@article{afrati2015efficient,
  author = {Foto N. Afrati and Dimitris Fotakis and Angelos Vasilakopoulos},
  title = {{Efficient lineage for SUM aggregate queries}},
  journal = {AI Commun.},
  year = {2015},
  doi = {10.3233/aic-140647},
}
Figure