ML in SQL: real-time fraud detection
ML in SQL means calling a trained model as a SQL function, next to the data. In Otterstax Enterprise, you put an ONNX model in S3, register it through SQL and call it in any query — for example, to score each transaction from Kafka for fraud in real time.
- Situation
- A trading company detected fraud about 2 hours after it happened.
- With Otterstax
- Transactions stream in from Kafka, and an ONNX model scores each one as a SQL function.
SELECT tx_id, fraud_score(tx.*) AS risk
FROM kafka.transactions tx
WHERE fraud_score(tx.*) > 0.9;Less infrastructure. Faster delivery. No lock-in.
From heavy to light infrastructure
AI workloads multiply data volume. With Otterstax you don’t need a central warehouse or data copies, and you run fewer pipelines and pay for fewer licenses.
faster time-to-production for ML features
Enterprise capabilities
ML models as SQL functions
Put an ONNX model with its weights in S3, register it through SQL and call it like any function. New models go live without a restart and run on CPU or GPU nodes. Training stays outside.
GPU acceleration
Up to 10× faster aggregations, sorts and ML inference on 100M–1B rows (NVIDIA H100 / H200 vs CPU).
CDC with guarantees
Change data capture and dual writes with delivery guarantees, running in a cluster. Open source has CDC without guarantees.
ML models as SQL functions (ONNX) — Otterstax: ✓ (Enterprise) · Trino: — · Spice.ai: AI via LLM gateway. See all comparisons →
SQL on Kafka, five ways
ksqlDB, Flink SQL, the ClickHouse Kafka engine, the Trino Kafka connector and Otterstax, with code and a stream-to-table JOIN for each.
How do ML models run in SQL?
In Enterprise, you put an ONNX model with its weights in S3, register it through SQL and call it as a SQL function. New models go live without a restart and run on Otterstax CPU or GPU nodes. Only inference runs inside Otterstax. Training happens elsewhere, and the model must fit in a node's memory. Any external feature store can read from Otterstax over SQL.
Can it handle transactional and analytical load together?
Yes. Otterstax sends transactions to row-store databases and analytics to column stores such as ClickHouse or ColumnStore, or runs heavy analytics itself on its columnar engine and GPUs. Query priorities and queues, resource limits, replicas and separate cluster nodes keep analytics from slowing down transactions. It works poorly for transactions that span several databases, analytics on an OLTP database with no replicas, and large JOINs over a slow network.
Use cases: cross-database joins, analytics without ETL, ML in SQL, database migration
One app, many data sources
Analytics without ETL
Gradual database migration
See Otterstax on your own data sources
In a 30-minute call we'll map your stack and show a working query across your data sources.