TL;DR
MillenniumDB is a new open-source, persistent graph database engine designed to bridge the gap between theoretical research and practical systems. By introducing a "domain graph" model and leveraging worst-case optimal joins, it significantly outperforms established engines like Neo4j and Blazegraph on complex, real-world knowledge graph queries.
What Problem Does This Paper Address?
Graph databases have exploded in popularity, but a rift remains between theory and practice. On one hand, the RDF model is excellent for web-scale interlinking but requires cumbersome "reification" (creating extra nodes and edges) to handle metadata like "who said what and when." On the other hand, Property Graphs (like those used in Neo4j) are intuitive but often treat metadata as simple strings, making it difficult to query that metadata as first-class graph objects.
Furthermore, many existing engines struggle with "join explosions"—where intermediate results during a query become so large they crash the system. The authors of MillenniumDB set out to build a modular, persistent engine that handles complex metadata elegantly and uses state-of-the-art algorithms to ensure stable performance even on massive datasets like Wikidata.
Methods
The core of MillenniumDB is a new abstraction called the Domain Graph. In this model, every edge is assigned a unique identifier (EID). This allows an edge to act as a node in other relationships, enabling the direct modeling of $n$-ary relations and qualifiers without the overhead of standard reification.
Key technical components include:
- DGQL (Domain Graph Query Language): A new language inspired by Cypher but extended to support the domain graph model and features like two-way regular path queries (2RPQs).
- Worst-Case Optimal Joins (WCOJ): The engine implements a modified "leapfrog" algorithm. Unlike traditional join plans that process relations two at a time, WCOJ looks at multiple relations simultaneously to prevent the explosion of intermediate results.
- Storage & Indexing: Data is stored in B+ trees. To support efficient joins, the system maintains four different permutations of edge data (e.g., source-target-type-eid).
- Path Evaluation: Path queries are evaluated using a breadth-first search (BFS) approach guided by an automaton, allowing the system to return shortest paths efficiently.
Datasets
The authors evaluated MillenniumDB using two primary datasets derived from Wikidata:
- Wikidata Truthy: A simplified version containing ~1.25 billion triples, used for head-to-head comparisons against other engines.
- Wikidata Complete: The full Wikidata knowledge graph, totaling ~300 million objects and 4.3 billion edges (827GB on disk). This was used to demonstrate the scalability of the domain graph model.
The benchmarks utilized real-world "troublesome" queries—those known to time out on the public Wikidata SPARQL endpoint.
Key Insights and Ideas
- Edges as First-Class Citizens: By giving every edge an ID, MillenniumDB can model complex statements (like Wikidata qualifiers) much more concisely than RDF. For example, Figure 4 shows how a domain graph represents a statement about Michelle Bachelet's presidency, including start/end dates and predecessors, by simply linking to the edge ID.
- Theory in the Wild: The paper demonstrates that Worst-Case Optimal Joins—often discussed in purely theoretical contexts—can be successfully integrated into a persistent, disk-based system to provide massive performance gains.
- Graceful Degradation: Unlike many enterprise engines that crash or require a full restart after a timeout, MillenniumDB’s architecture allows it to return partial results and recover gracefully from interrupted queries.
Key Results
MillenniumDB consistently outperformed prominent engines including Blazegraph, Neo4j, Jena, and Virtuoso:
- BGP Performance: On single-triple pattern queries, MillenniumDB was roughly 30x faster on average than the next best performers. On complex join queries, its median runtime was an order of magnitude faster than Blazegraph.
- Path Queries: It was the only system that did not time out on any query in the path benchmark suite, maintaining an average runtime of ~1.1 seconds.
- Scalability: Remarkably, MillenniumDB showed no deterioration in performance when moving from the "Truthy" dataset to the much larger "Complete" dataset, proving its buffer management and indexing are highly efficient.
Limitations and Future Work
While MillenniumDB is a powerful new tool, the authors acknowledge it is still in its early stages:
- Query Language: DGQL currently lacks a full path algebra (e.g., it can find shortest paths but not perform complex manipulations on path variables).
- Features: The current release does not yet support full ACID transactions or a graph update language.
- Future Directions: The team plans to add keyword search, more compact index structures, and support for existing standard query languages to increase adoption within the research community.
For those interested in exploring the code or benchmarks, the project is fully open-source and available on GitHub.
Summary updated