Aggregate Query Prediction under Dynamic Workloads

Fotis Savva, Christos Anagnostopoulos, Peter Triantafillou

Abstract

This paper presents a lightweight, client-side machine learning framework designed to predict aggregate query results (SUM, COUNT, AVG) with millisecond latency. By utilizing a novel Change Detection Mechanism, the system identifies shifts in analyst workloads (concept drift) and automatically adapts local models, maintaining high accuracy without the need for constant, expensive backend communication.

Introduction

In big data analytics, exploratory tasks require interactive response times—typically under 500ms—to maintain analyst productivity. However, querying massive, geographically distributed datasets often results in latencies orders of magnitude higher and significant cloud computing costs. While Approximate Query Processing (AQP) offers a potential solution, existing methods often rely on static models that fail under dynamic workloads. Analysts are ad-hoc by nature, and their interests "drift" as they explore different data regions. This paper introduces a framework that detects this "concept drift" locally on the analyst's device and adapts models in real-time.

Methods

The proposed system resides on the Analyst’s Device (AD) and interacts with the Cloud/Central System (CS). The workflow involves several key steps:

  1. Query Vectorization: Range predicates are transformed into a $2d$-dimensional vectorial space.
  2. Query Space Clustering: The system uses an ensemble approach, clustering similar queries and assigning a local XGBoost regression model to each cluster for improved accuracy and fit.
  3. Change Detection Mechanism (CDM): The system monitors the Euclidean distance of new queries to their cluster centers. This distance serves as a proxy for prediction error, allowing the system to detect concept drift without executing queries on the server.
  4. Model Adaptation (ADM): Upon detecting drift, the system enters a "Buffering Mode," selectively forwarding queries to the backend to obtain ground-truth results. These results are used to update cluster representatives via Stochastic Gradient Descent (SGD) and train new local models.
System architecture showing the interaction between the analyst's device and the cloud system, highlighting the local adaptation loop.

Evaluation and Results

The framework was evaluated using real-world datasets, including the Chicago Crimes dataset (6.6M records) and the Intel Lab Sensors dataset (2.3M records), alongside synthetic workloads.

  • Accuracy and Speed: The system maintained a relative error below 10%, meeting industry standards for AQP. Prediction latency was remarkably low at approximately 0.008ms, well within the 500ms interactivity constraint.
  • Efficiency: Local models are extremely compact (approx. 65 KB), facilitating easy storage and transmission.
  • Robustness to Drift: Experiments demonstrated that the CDM effectively identifies shifts in query patterns. As shown in the figure below, the ADM successfully restores accuracy after a brief buffering phase following a concept drift event.
Impact of concept drift on relative error, comparing the proposed adaptive framework against a static model.

Conclusion

This research demonstrates a viable path for millisecond-latency aggregate query prediction on local devices. By using geometric distance as a proxy for model uncertainty, the system provides a storage-efficient "pseudo-cache" of statistical patterns. While the system currently faces a "cold start" period and temporary buffering during drift, future work will focus on extending support to complex joins and non-numerical categorical data.

Summary updated

BibTeX
@inproceedings{savva2019aggregate,
  author = {Fotis Savva and Christos Anagnostopoulos and Peter Triantafillou},
  title = {{Aggregate Query Prediction under Dynamic Workloads}},
  booktitle = {IEEE BigData},
  year = {2019},
  doi = {10.1109/bigdata47090.2019.9006267},
}
Figure