Principle:4paradigm OpenMLDB SQL Online Deployment
| 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:
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 DEPLOYMENTor HTTP API (curl /dbs/{db}/deployments/{name}) - The
sync_job_timeoutanddeploy_job_max_wait_time_msflags control how long to wait for the deployment job to complete
Related Pages
Implemented By
- Implementation:4paradigm_OpenMLDB_SQL_Deploy_Statement
- Implementation:4paradigm_OpenMLDB_CLI_Client
- Implementation:4paradigm_OpenMLDB_Demo_Scenarios