Abstract
The proliferation of diverse data models—relational, key-value, document, and graph—has led to "polyglot persistence," where applications utilize multiple specialized databases. However, querying across these models remains a significant challenge due to the lack of a unified language. This paper introduces Multi-SQL, an extensible query language that provides a unified interface for heterogeneous data models. By employing a "TRIPLE" base unit for data definition and a two-level optimization engine, Multi-SQL bridges the semantic gap between specialized engines while maintaining their native performance strengths.
Introduction: The Multi-Model Challenge
The modern data landscape has moved beyond the "one size fits all" database paradigm. Developers frequently combine relational tables for structured data, graph databases for social connections, and document stores for semi-structured content. While this approach optimizes storage and local access, it introduces a "semantic gap." Existing solutions either force all data into a single, often suboptimal, unified engine or rely on complex middleware that lacks a cohesive query language.
As shown in the comparison of current systems, many databases support multiple models but lack cross-model optimization or a truly unified, extensible language. There is a clear need for a language that is semantically rich enough to respect model-specific features (like graph traversals) while remaining extensible for future data structures.
Methodology: The Multi-SQL Architecture
Multi-SQL addresses these challenges through a novel architectural design that separates high-level data abstraction from low-level execution.
The system's methodology is built on several key pillars:
- The "TRIPLE" Abstraction: To unify Data Definition Language (DDL) operations, all data structures are reduced to a fundamental unit:
<ITEM_NAME, ITEM_TYPE, ITEM_CONSTRAINT>. This allows a single grammar to define columns, nodes, or document fields. - Atomic and Characteristic Filters: Filtering logic is bifurcated. Basic filters handle universal operations (equality, range), while characteristic filters encapsulate model-specific logic, such as path traversal in graphs or pattern matching in documents.
- Two-Level Implementation: Query execution happens at two levels. A global parser creates a primary plan based on semantic equivalence, which is then pushed down to local engines. This "push-down" approach allows specialized databases to utilize their native physical optimizations, such as specialized indexes and caching.
Key Features and Insights
A defining characteristic of Multi-SQL is its extensibility. By defining a function family $\mathcal{F}$ for atomic filters, the language can support new data models without altering its core grammar; developers simply add new characteristic filters to the family.
Furthermore, Multi-SQL treats all major data models as first-class entities. Unlike systems that extend SQL with JSON blobs, Multi-SQL provides a unified JOIN syntax that explicitly handles "coupled queries"—scenarios where results from one model (e.g., a relational user list) filter another (e.g., a graph of social connections). The language also introduces a TRANSFER statement, enabling formal data migration between models within the same script.
Conclusion and Future Work
Multi-SQL provides a formal grammar for cross-model DDL and DML operations, preserving the semantic richness of specialized data structures. While the current work establishes a robust theoretical and architectural framework, the authors acknowledge that converting data between models can lead to semantic loss if constraints do not align perfectly. Future research will focus on empirical performance benchmarking in high-scale environments and refining cost-estimation models for the global query optimizer to further minimize cross-engine overhead.
The authors have made an open-source parser and examples available on GitHub to demonstrate the language's feasibility.
Summary updated