Skip to main content
QUICK REVIEW

[Paper Review] One SQL to Rule Them All

Edmon Begoli, Tyler Akidau|arXiv (Cornell University)|May 28, 2019
Advanced Database Systems and QueriesComputer Science26 references7 citations
TL;DR

This paper proposes a unified SQL framework for managing both streaming and relational data using time-varying relations, event-time semantics, and controlled materialization. By extending standard SQL with minimal, syntactically idiomatic constructs—such as EMIT AFTER DELAY and EMIT AFTER WATERMARK—it enables full SQL functionality on streams while supporting robust, flexible, and efficient real-time processing with correct event-time behavior.

ABSTRACT

Real-time data analysis and management are increasingly critical for today`s businesses. SQL is the de facto lingua franca for these endeavors, yet support for robust streaming analysis and management with SQL remains limited. Many approaches restrict semantics to a reduced subset of features and/or require a suite of non-standard constructs. Additionally, use of event timestamps to provide native support for analyzing events according to when they actually occurred is not pervasive, and often comes with important limitations. We present a three-part proposal for integrating robust streaming into the SQL standard, namely: (1) time-varying relations as a foundation for classical tables as well as streaming data, (2) event time semantics, (3) a limited set of optional keyword extensions to control the materialization of time-varying query results. Motivated and illustrated using examples and lessons learned from implementations in Apache Calcite, Apache Flink, and Apache Beam, we show how with these minimal additions it is possible to utilize the complete suite of standard SQL semantics to perform robust stream processing.

Motivation & Objective

  • To unify stream and table processing under a single, consistent SQL semantics for improved developer productivity and system coherence.
  • To enable robust event-time processing in SQL without sacrificing compatibility with standard SQL operators.
  • To provide minimal, extensible extensions for controlling how and when query results are materialized in streaming environments.
  • To support real-world use cases such as late-arriving events, periodic updates, and changelog streaming via standardized SQL extensions.
  • To inform SQL standardization efforts with practical insights from Apache Flink, Beam, and Calcite implementations.

Proposed method

  • Introduces time-varying relations as a foundational concept, where relations evolve over time and can be treated as functions from time to relations.
  • Proposes event-time semantics by extending SQL to natively handle timestamps associated with events, enabling correct processing of out-of-order data.
  • Introduces EMIT AFTER DELAY and EMIT AFTER WATERMARK as optional keywords to control materialization frequency and timing of results.
  • Supports stream materialization by allowing query outputs to be rendered as changelogs (streams of updates), enabling recursive streaming queries.
  • Defines a flexible materialization control model that supports both periodic and watermark-triggered emission, enabling use cases like notifications and high-throughput aggregation.
  • Leverages existing SQL operators (e.g., JOIN, GROUP BY, WINDOW) on time-varying relations via pointwise application, preserving full SQL expressiveness.

Experimental results

Research questions

  • RQ1How can standard SQL be extended to natively support streaming data while preserving full relational semantics?
  • RQ2What minimal syntactic extensions are required to enable correct and efficient event-time processing in SQL?
  • RQ3How can materialization of streaming query results be controlled to support diverse use cases like notifications and high-throughput aggregation?
  • RQ4Can time-varying relations serve as a unified foundation for both batch and streaming SQL processing?
  • RQ5How can SQL be extended to support custom windowing logic and correlated temporal table access in streaming contexts?

Key findings

  • The proposed extensions allow full standard SQL operators to be applied to time-varying relations, enabling consistent and powerful stream processing without semantic restrictions.
  • Event-time semantics are natively supported through time-varying relations, allowing correct handling of out-of-order events and late data.
  • Materialization controls such as EMIT AFTER DELAY and EMIT AFTER WATERMARK enable efficient, predictable, and flexible emission of results, supporting both real-time and batch-like patterns.
  • The framework supports complex use cases such as periodic updates for partial results and on-time/late row emission, as demonstrated in the Beam and Flink implementations.
  • The approach enables recursive streaming queries by allowing stream outputs to be consumed as input streams, extending the expressiveness of SQL in streaming systems.
  • The authors demonstrate that minimal, syntactically idiomatic SQL extensions can unify batch and streaming processing while maintaining compatibility with existing SQL standards and tooling.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.