Abstract
Resource Description Framework (RDF) knowledge graphs are foundational to modern data representation, yet their graph-based structure often leads to performance bottlenecks in traditional relational database systems. This paper introduces a novel approach that optimizes RDF storage by framing database schema design as a Reinforcement Learning (RL) problem. Utilizing a Double Deep Q-Network (DDQN), the system autonomously determines optimal table partitioning strategies—dividing or merging data based on workload patterns. Experimental results demonstrate query speedups exceeding 90% compared to standard storage solutions like Apache Jena.
Introduction
RDF data is typically represented as "triples" consisting of a Subject, Predicate, and Object. While Relational Database Management Systems (RDBMS) offer stability for storing these triples, the inherent complexity of graph queries often results in excessive "join" operations, which degrade performance. Traditionally, optimizing these schemas required manual intervention by Database Administrators (DBAs). However, as knowledge graphs scale to billions of edges, manual partitioning becomes untenable.
Existing automated tools frequently struggle with data sparsity and fail to adapt to dynamic workloads. There is a critical need for a storage system capable of "learning" the optimal layout for specific datasets and query patterns.
Methodology
The proposed system transforms the storage design challenge into a Markov Decision Process (MDP), solved using a Double Deep Q-Network (DDQN). The architecture consists of several key components that facilitate automated schema optimization.
State Representation and Action Space
The "state" in this MDP represents the current configuration of tables within the database. To process this via a neural network, predicates (the graph's edges) are extracted as features and mapped into fixed-length numerical vectors. The RL agent operates within an action space that allows it to either divide a table (splitting it based on a specific predicate) or merge tables (joining them based on common subjects or objects).
Reward Function and Query Rewriting
The agent's reward is directly tied to improvements in query execution time. If a schema modification reduces the workload duration compared to the previous state, the agent receives a positive reward.
Because structural changes necessitate new query logic, a priority-based query rewriting policy was developed. This policy moves beyond the simple heuristic that "fewer joins are better," instead utilizing empirical execution times to identify the most efficient query plans for a given schema.
Experimental Evaluation
The approach was evaluated using two industry-standard benchmarks: WatDiv (Waterloo SPARQL Benchmark) and LUBM (Lehigh University Benchmark).
Key Results
- Significant Performance Gains: On the LUBM dataset, query execution time improved by 89.88% after 30 training episodes. WatDiv saw an even greater improvement of 93.12% after 20 episodes.
- Comparative Advantage: The RL-based approach consistently outperformed Apache Jena SDB, running 3 to 4 times faster on LUBM queries and 3 to 6 times faster on WatDiv queries.
- Convergence: The DDQN model demonstrated rapid learning, with significant performance breakthroughs occurring between the 9th and 12th training episodes before stabilizing at an optimal configuration.
Discussion and Insights
A primary insight from this research is that predicates serve as the "DNA" of RDF data; mapping them to vectors allows the model to effectively characterize the schema. Furthermore, the study challenges traditional database heuristics by showing that redundant data—created through table merging—can be a beneficial trade-off. While this increases storage space (up to 7 times more than standard Jena SDB), it drastically reduces the join overhead that typically bottlenecks RDF systems.
Limitations and Future Work
The primary cost of this optimization is increased disk space and the initial time required to "learn" and materialize the optimized tables. Future research will focus on refining the query rewriting process for even more complex graph queries and exploring more sophisticated storage structures to mitigate the storage overhead.
Summary updated