Introduction
Traditional Database Management Systems (DBMS) primarily function as historians, meticulously recording and retrieving past events. However, modern analytical needs require systems that can look forward. This paper advocates for the Predictive Database Management System (PDBMS), a paradigm shift where machine learning models are treated as first-class citizens. By integrating predictive capabilities directly into the database engine, users can query future trends as easily as historical data, while the system itself leverages these models for self-tuning and performance optimization.
The Integration Gap
Currently, a significant "wall" exists between data management and predictive analytics. Data scientists typically export data from a DBMS into specialized environments like R or Python to perform forecasting or anomaly detection. This "loose coupling" is inherently inefficient, as it bypasses decades of database optimization techniques—such as indexing, query optimization, and materialized views. Furthermore, as databases grow in complexity, manual tuning becomes unsustainable. A PDBMS addresses this by enabling the system to predict its own resource usage and query latencies internally.
The Longview Architecture
To bridge this gap, the authors developed Longview, a prototype PDBMS built on top of PostgreSQL. The core philosophy of Longview is that model management should mirror data management.
As shown in Figure 1, the architecture introduces a Model Manager alongside the traditional Data Manager. This component handles model templates and materialized models, allowing the Optimizer to consider predictive models during query planning. This integration enables several key features:
- Declarative Predictive Queries: Users can employ extended SQL (e.g.,
CREATE PREDICTOR) to handle training and deployment, while "p-relations" (predictive relations) allow models to be treated as virtual tables. - Model Materialization: Similar to materialized views, the system can pre-compute and store models to provide near-instant predictions.
- I/O-Aware Skip-Lists: A specialized data structure for time-series data that stores samples at varying densities, optimizing the data retrieval process for specific accuracy requirements.
Methodology: Models as First-Class Citizens
A central insight of this work is that a machine learning model is essentially a compact representation of data. By treating models as first-class citizens, the system can apply standard database optimizations to ML workflows. For the specific challenge of Query Performance Prediction (QPP), the authors utilized a hybrid approach, combining coarse-grained plan-level features with fine-grained operator-level features (such as individual joins or scans) to create a robust prediction engine.
Evaluation and Results
The system was evaluated using the TPC-H benchmark on a 10GB database, focusing on the accuracy of internal performance models across various query templates.
As illustrated in Figure 4, the effectiveness of predictive modeling varies significantly by workload and strategy:
- Fixed Workloads: Plan-level models achieved an impressive 90% accuracy for stable query patterns.
- Changing Workloads: When faced with unseen query types, simple plan-level models struggled significantly. However, the Hybrid Model (combining plan and operator levels) successfully reduced the relative error to 38%.
- Model Segmentation: The authors found that building dedicated models for complex "outlier" queries (like Template 9) could improve accuracy to 93%, highlighting the need for specialized modeling in heterogeneous workloads.
Discussion and Future Work
While Longview demonstrates the potential of PDBMS, several challenges remain. The maintenance costs of keeping many models "fresh" as data evolves are significant, mirroring the overhead of materialized views. Furthermore, the authors suggest the need for a formal Model Algebra—analogous to Relational Algebra—to define how models can be selected, composed, and merged. Future research will focus on automating the design process to decide which models to build based on evolving query workloads.
Summary updated