🤖 AI Summary
Relational databases’ flat data model exhibits impedance mismatch with the nested data structures required by modern applications. This paper introduces the graph-relational database model, which unifies the formal rigor of the relational model with the expressive power of graph-structured nesting to support composable, type-safe complex queries. Our approach comprises three core contributions: (1) EdgeQL—a statically typed, SQL-like query language designed for expressive, safe navigation and transformation of nested, graph-shaped data; (2) the Gel compiler system, which jointly compiles EdgeQL schemas and queries—incorporating both static and dynamic semantics—into highly optimized, native PostgreSQL SQL; and (3) end-to-end type safety without runtime overhead, achieving execution performance comparable to hand-written SQL. Experimental evaluation demonstrates that our system substantially outperforms conventional ORMs, delivering superior balance among query expressivity, developer productivity, and runtime efficiency.
📝 Abstract
For applications that store structured data in relational databases, there is an impedance mismatch between the flat representations encouraged by relational data models and the deeply nested information that applications expect to receive. In this work, we present the graph-relational database model, which provides a flexible, compositional, and strongly-typed solution to this "object-relational mismatch." We formally define the graph-relational database model and present a static and dynamic semantics for queries. In addition, we discuss the realization of the graph-relational database model in EdgeQL, a general-purpose SQL-style query language, and the Gel system, which compiles EdgeQL schemas and queries into PostgreSQL queries. Gel facilitates the kind of object-shaped data manipulation that is frequently provided inefficiently by object-relational mapping (ORM) technologies, while achieving most of the efficiency that comes from require writing complex PostgreSQL queries directly.