Scalable aggregation predictive analytics - A query-driven machine learning approach

Christos Anagnostopoulos, Fotis Savva, Peter TriantafillouApplied Intelligence 2018

Introduction

In the era of Big Data, performing simple aggregations like COUNT—referred to as Set Cardinality Prediction (SCP)—is surprisingly difficult. Traditional methods like histograms or sampling are data-centric, requiring direct and frequent access to underlying raw data to build and update statistical synopses. This paper, published in Applied Intelligence, presents a paradigm shift: moving from "data-centric" to "query-driven" predictive modeling.

The Problem: Data-Centric Bottlenecks

Traditional data-centric approaches encounter three major bottlenecks:

  1. Access Restrictions: Data in federated environments (e.g., medical databases) often prohibit raw access for privacy reasons, though aggregate results are permitted.
  2. Cost: Scanning terabytes of data in cloud environments incurs significant monetary and computational expenses.
  3. Latency: As datasets grow, even distributed frameworks like Apache Spark struggle to provide the sub-millisecond responses required for interactive exploration or real-time query optimization.

The authors propose a solution that treats data as a black box, learning to predict answers based solely on the patterns of previous queries.

Methods: A Two-Stage Learning Architecture

The core of the proposal is a novel Machine Learning (ML) model that maps the high-dimensional space of range queries to their corresponding cardinality results.

1. Unsupervised Learning via Self-Organizing Maps (SOM)

The model first uses a SOM to quantize the query space. It takes 2d-dimensional query vectors (representing hyper-rectangles) and clusters them into $M$ representative "neurons." This step is crucial because it preserves the topology of the query space—similar queries end up near each other on a 2D lattice.

Self-organizing Map (SOM) adaptation after query projection.

2. Supervised Learning via Heteroassociative Competitive Learning (HCL)

Once the query space is partitioned, the model learns the association between these clusters and their cardinality answers. This is visualized as a mapping from the query space through a neuron lattice to a cardinality lattice.

Two-stage architecture mapping query space to neuron and cardinality lattices.

The authors propose two prediction variants:

  • Cardinality Lattice: A simpler version that associates each cluster with a constant cardinality value.
  • Coefficient Lattice: A more sophisticated version that fits a local linear regression model to each cluster, allowing for interpolation and higher precision for unseen queries within a specific region.

Experimental Results

The system was implemented as an extension to Apache Spark and evaluated using the RS4 sensor dataset and synthetic workloads.

  • Massive Speedup: The ML model achieved a Mean Execution Time (MET) of 0.0074 ms, compared to Spark’s native COUNT which took 83.165 ms—a performance boost of roughly four orders of magnitude.
  • High Accuracy: The model achieved a Coefficient of Determination ($R^2$) of 0.99 and a Symmetric Mean Absolute Percentage Error (SMAPE) of just 9%.
  • Join Optimization: In tests for query optimization (deciding which of two relations is smaller to optimize a JOIN), the model made the correct decision 97% of the time.
  • Scalability: While Spark's execution time grew linearly with file size, the ML model's prediction time remained perfectly constant across 1GB, 2GB, and 3GB files.

Key Insights

  • Query-Driven vs. Data-Driven: We don't need the data to predict its properties. A history of previous queries and answers can build a surrogate model that bypasses the data bottleneck entirely.
  • Topology Matters: Using SOMs ensures that the "neighborhood" of a query is meaningful, allowing local regression models to be highly accurate because they are trained on topographically related data.
  • Independence from Data Size: Once trained, prediction time is $O(d \log M)$. Crucially, this is independent of the number of rows in the dataset; whether the table has 4 million or 4 billion rows, the prediction takes the same amount of time.

Conclusion

This query-driven approach offers a scalable, high-performance alternative for cardinality prediction in Big Data environments. While the initial training phase involves overhead, it is a "pay-once" cost that enables near-instantaneous query results. Future work will address on-line data mutations and the challenges of higher-dimensional feature spaces.

Summary updated

BibTeX
@article{anagnostopoulos2018scalable,
  author = {Christos Anagnostopoulos and Fotis Savva and Peter Triantafillou},
  title = {{Scalable aggregation predictive analytics - A query-driven machine learning approach}},
  journal = {Applied Intelligence},
  year = {2018},
  doi = {10.1007/s10489-017-1093-y},
}
Figure