Storing and querying ordered XML using a relational database system
Igor TatarinovStratis D. ViglasKevin BeyerJayavel ShanmugasundaramEugene ShekitaChun Zhang
Develops three order-encoding techniques—Global, Local, and Dewey Order—alongside translation algorithms that enable standard relational databases to efficiently store, query, and update ordered XML documents.
As XML emerged as the primary standard for Internet data exchange, content management systems increasingly required ways to store, query, and reconstruct documents while preserving their inherent hierarchical and sequential order. Prior approaches focused on decomposing XML documents into unordered relational databases, leaving a critical gap in understanding how to efficiently support ordered XML data models without purpose-built sequence engines. The article set out to evaluate whether relational database systems can efficiently support ordered XML data and to demonstrate effective order-encoding methods and query translation algorithms for standard database workloads.
To address this challenge, the authors introduced three lossless numbering schemes to encode order as explicit data values: Global Order (absolute document positions), Local Order (relative sibling positions), and Dewey Order (hierarchical path vectors). They developed algorithms to translate ordered XPath navigation, predicates, and updates into SQL across both schema-less (Edge) and schema-aware (Inlining) database configurations. The researchers evaluated these approaches by running query, reconstruction, and insertion workloads on an IBM DB2 relational database system using scaled versions of the Shakespeare XML dataset, sizing up to 100 megabytes, and comparing performance against a dedicated main-memory XML processor.
The findings show that standard relational database management systems can process complex ordered XML queries efficiently, executing queries on a 100-megabyte dataset in roughly 2 to 3 seconds. Global Order delivers the fastest query execution times across most ordered access patterns, though it experiences significant renumbering overhead during updates. Dewey Order offers the best overall trade-off, showing query speeds only slightly slower than Global Order while reducing insertion and renumbering times during data updates by roughly half compared to Global Order under conflict conditions. In contrast, Local Order performs best on updates but struggles severely with queries on schema-less tables due to its reliance on expensive SQL recursion, though knowing the document schema significantly mitigates this performance penalty.
These results demonstrate that enterprises do not need to abandon mature, scalable relational database infrastructures to manage ordered XML content. Relational engines can remain highly competitive and even outpace main-memory XML processors by avoiding repetitive document parsing and leveraging relational path indexes. However, the study uncovered that standard relational query optimizers frequently misestimate hierarchical containment predicates, occasionally selecting execution plans that run orders of magnitude slower than optimal plans unless manually tuned.
Organizations handling XML data within relational databases should adopt Global Order for read-dominated environments and Dewey Order when systems require frequent updates. System architects should also utilize schema-aware storage designs whenever possible to avoid recursive SQL evaluation. To sustain these performance benefits systematically, database vendors and engineering teams must enhance relational query optimizers with native awareness of hierarchical data structures and containment costing. While the reported benchmarks reliably reflect workloads fitting in-memory database buffers, teams should anticipate a two- to five-fold increase in reconstruction runtimes when data outgrows the relational buffer pool.
- Paper: Access path selection in a relational database management system, P. Selinger et al. (1979). This foundational paper establishes the cost-based relational optimization and access path selection principles that govern how translated SQL queries over shredded hierarchical data are evaluated.
- Paper: Dremel: Interactive Analysis of Web-Scale Datasets, S. Melnik et al. (2010). This work advances techniques for storing and querying nested, structured data by introducing columnar encoding and distributed SQL-like execution for large-scale hierarchical records.
