Abstract
Data mining often requires a delicate balance between the flexibility of declarative query languages and the raw performance of procedural code. This paper explores a hybrid framework that utilizes Iterative User-Defined Aggregates (UDAs) within the LDL++ deductive database system. By implementing "hot-spot refinement," the authors allow high-level algorithm logic to be expressed in Datalog++ while offloading performance-critical tasks to C++. A case study on the Apriori algorithm demonstrates that this approach offers a customizable yet efficient alternative to traditional "black box" mining integrations and standard SQL implementations.
Introduction
The integration of data mining into database systems has traditionally faced an "efficiency vs. flexibility" trade-off. Logic-based deductive databases are ideal for incorporating domain knowledge and ad-hoc constraints but often struggle with the computational intensity of mining tasks. Conversely, procedural "black box" implementations (e.g., in C++) are fast but rigid, making it difficult for users to modify the mining process or evaluate custom interest measures on-the-fly.
This paper addresses this mismatch by proposing a framework based on Iterative UDAs. The goal is to create a system that is declarative enough for easy customization but efficient enough to handle large-scale datasets by identifying and optimizing computational "hot-spots."
The Iterative UDA Framework
The core of the proposed system is the extension of the LDL++ system with Iterative User-Defined Aggregates. Unlike standard SQL aggregates (like SUM or AVG) that typically operate in a single pass, these UDAs support an iterate predicate. This allows the aggregate to scan the dataset multiple times, which is a fundamental requirement for level-wise algorithms like Apriori.
Hot-Spot Refinement
To maintain high performance, the authors employ a strategy called "hot-spot refinement." The high-level control flow—including initialization, pruning, candidate generation, and termination—is defined in Datalog++. However, computationally expensive operations, such as managing complex data structures or counting candidate occurrences, are implemented as external C++ predicates. This modularity allows developers to inject domain-specific rules into the logic layer without needing to rewrite the underlying optimized engine.
Implementation and Data Structures
A key innovation in this framework is treating complex structures, such as Hash-Trees used for storing frequent itemsets, as first-class data types within the logic system. By passing these structures as user-defined pointers between different stages of the algorithm, the system avoids the overhead of constant re-serialization.
As shown in Figure 5, the hash-tree evolves through various stages (a-f) as the algorithm processes transactions and identifies frequent itemsets. This iterative refinement is managed by the UDA, which maintains the state of the tree across multiple passes over the data. This approach effectively treats the entire mining task as a single inductive rule, making "pattern discovery" a standard aggregate function within the query language.
Experimental Evaluation
The authors evaluated the LDL++ implementation using synthetic datasets generated according to the methodology of Agrawal and Srikant. The experiments varied the number of transactions ($|D|$), average transaction size ($|T|$), and the total number of items ($N$), with scales ranging up to 100,000 transactions.
Key Results
The performance of the LDL++ system was compared against three benchmarks: DB2 Batch (caching data), DB2 Interactive (tuple-by-tuple processing), and a standalone C++ Apriori implementation.
- Superiority over Interactive SQL: The LDL++ approach significantly outperformed the DB2 Interactive method. The authors noted that "interactive" approaches often fail because the cost of context switching between the database and the application environment outweighs the actual computation time.
- Competitive Performance: LDL++ remained competitive with the DB2 Batch approach on small to medium datasets.
- Scalability and the "Deductive Tax": While LDL++ showed stable, near-linear scaling, a performance gap relative to DB2 Batch began to narrow as dataset sizes increased. This is attributed to a constant overhead factor inherent in the deductive system's abstract machine.
- Predictability: The linear scaling curve suggests that the architecture is robust and predictable for varying data volumes.
Conclusion
The study demonstrates that Iterative UDAs provide a powerful mechanism for specifying complex mining algorithms within a database. By combining the strengths of declarative logic and procedural optimization, the framework allows for significant customization without sacrificing performance. Future work will focus on narrowing the optimization gap by automatically mapping high-level logic specifications to more efficient query plans and formalizing the integration of background domain knowledge.
Summary updated