Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Principle:4paradigm OpenMLDB SQL Online Deployment

From Leeroopedia
Knowledge Sources
Domains Feature_Engineering, Database
Last Updated 2026-10-12 12:00 GMT

Overview

A deployment mechanism that compiles a validated SQL feature query into an optimized execution plan for sub-millisecond online serving, bridging offline development and real-time production.

Description

SQL Online Deployment is the process of transitioning a feature engineering SQL query from offline development to online serving. The DEPLOY statement registers a named deployment in OpenMLDB, which pre-compiles the SQL into an optimized execution plan, pre-allocates memory resources, and makes the query available for real-time serving via HTTP API or SDK. This eliminates the overhead of SQL parsing and optimization at query time, enabling consistent low-latency feature computation.

The key problem solved is query latency unpredictability: parsing and optimizing SQL at request time introduces variable latency. Pre-compilation ensures every request for the same deployment follows the same optimized execution path.

Usage

Use this principle when a feature engineering SQL query has been validated offline and needs to serve real-time requests. Deploy the query, then use the deployment name in HTTP/SDK queries to invoke the pre-compiled plan with input data.

Theoretical Basis

Deployment pre-compilation follows the prepared statement pattern extended to a distributed context:

Latencyonline=Compiledeploy+Executerequest

Where Compile_deploy is a one-time cost at deployment, and Execute_request is the per-request cost (sub-millisecond).

The deployment lifecycle:

# Abstract algorithm (NOT real implementation)
# 1. Offline: develop and validate SQL
sql = "SELECT sum(amount) OVER w1 FROM txn WINDOW w1 AS (...)"

# 2. Deploy: compile and register
deploy("feature_name", sql)
#   - Parse SQL → AST
#   - Optimize AST → physical plan
#   - Allocate resources
#   - Register in metadata store

# 3. Online: execute with input data
result = query("feature_name", input_data)
#   - Look up pre-compiled plan
#   - Execute with input rows
#   - Return features

Practical Guide

  • Validate SQL thoroughly in offline mode before deploying
  • Use a meaningful deployment name — it becomes the query identifier
  • After deploying, verify via SHOW DEPLOYMENT or HTTP API (curl /dbs/{db}/deployments/{name})
  • The sync_job_timeout and deploy_job_max_wait_time_ms flags control how long to wait for the deployment job to complete

Related Pages

Implemented By

Uses Heuristic

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment