Skip to main content
QUICK REVIEW

[Paper Review] Extending Relational Query Processing with ML Inference

Konstantinos Karanasos, Matteo Interlandi|arXiv (Cornell University)|Nov 1, 2019
Advanced Database Systems and QueriesComputer Science19 references16 citations
TL;DR

Raven proposes deep integration of machine learning inference within SQL Server via ONNX Runtime and a unified intermediate representation (IR), enabling cross-optimizations between relational and ML operators. This achieves up to 24× performance gains over standalone inference frameworks by leveraging native execution and advanced query optimization.

ABSTRACT

The broadening adoption of machine learning in the enterprise is increasing the pressure for strict governance and cost-effective performance, in particular for the common and consequential steps of model storage and inference. The RDBMS provides a natural starting point, given its mature infrastructure for fast data access and processing, along with support for enterprise features (e.g., encryption, auditing, high-availability). To take advantage of all of the above, we need to address a key concern: Can in-RDBMS scoring of ML models match (outperform?) the performance of dedicated frameworks? We answer the above positively by building Raven, a system that leverages native integration of ML runtimes (i.e., ONNX Runtime) deep within SQL Server, and a unified intermediate representation (IR) to enable advanced cross-optimizations between ML and DB operators. In this optimization space, we discover the most exciting research opportunities that combine DB/Compiler/ML thinking. Our initial evaluation on real data demonstrates performance gains of up to 5.5x from the native integration of ML in SQL Server, and up to 24x from cross-optimizations--we will demonstrate Raven live during the conference talk.

Motivation & Objective

  • To address the challenge of achieving high-performance, secure, and governable ML inference within enterprise RDBMS environments.
  • To investigate whether in-RDBMS ML inference can match or outperform dedicated ML frameworks in terms of performance.
  • To extend relational algebra and query optimization with native support for ML scoring and model pipelines.
  • To enable seamless deployment and execution of ML models using standard SQL, with full integration into enterprise database features like security, auditing, and high availability.
  • To explore novel cross-optimizations between relational operators (e.g., joins, aggregates) and ML operators (e.g., inference, featurization) in a unified execution framework.

Proposed method

  • Raven uses a static analyzer to capture SQL queries and Python ML pipelines into a unified intermediate representation (IR) that includes both relational and ML operators.
  • The system applies novel cross-operator optimizations—such as pushdown of ML inference into scan and join operators—within the IR to minimize data movement and improve efficiency.
  • Raven natively integrates ONNX Runtime within SQL Server to enable low-overhead, in-process execution of ONNX-compatible models with minimal latency.
  • For unsupported model pipelines, Raven falls back to out-of-process execution via external language runtimes (e.g., Python/R) or containerized inference via Docker and REST endpoints.
  • The optimized IR is compiled and executed on SQL Server, leveraging its native parallel execution and query execution engine for both data and model processing.
  • Performance is measured across varying data sizes and model types, comparing Raven against standalone ONNX Runtime and external execution methods.

Experimental results

Research questions

  • RQ1Can in-RDBMS scoring of ML models achieve performance comparable to or better than dedicated ML inference frameworks?
  • RQ2How effective are cross-optimizations between relational and ML operators in reducing end-to-end inference latency?
  • RQ3What performance overheads are introduced by integrating ML inference natively into a relational database engine?
  • RQ4To what extent can native database features like query optimization, caching, and parallel execution improve ML inference performance?
  • RQ5How does the unified IR enable optimization across diverse ML frameworks and data processing pipelines?

Key findings

  • Raven’s native integration of ONNX Runtime within SQL Server achieves up to 5.5× speedup over standalone ONNX Runtime execution.
  • Cross-optimizations between relational and ML operators yield performance improvements of up to 24×, especially for large-scale data processing.
  • For small datasets (e.g., 100 tuples), Raven outperforms standalone ONNX Runtime by up to 10× due to model and session caching in SQL Server.
  • For large datasets (1M–10M tuples), Raven achieves ~5× speedup over ORT due to automatic parallelization of both scan and PREDICT operators in SQL Server.
  • The overhead of out-of-process execution (Raven Ext) is approximately 0.5 seconds per invocation, but remains viable for unsupported pipelines.
  • Batch inference in Raven provides an order-of-magnitude performance improvement over per-tuple inference, with optimal batch size being a key tuning parameter.

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.