Query Routing

Route each Iceberg query to the right engine

One SQL endpoint in front of Trino, DuckDB, StarRocks, Athena, Snowflake, and more. Your rules send each query to the engine that fits, with no application changes. Built on open-source QueryFlux.

Six client protocols
One endpoint
Routing overhead
<1 ms
Powered by QueryFlux
Open source
LakeOps LogoLakeOps

Last 30 days Optimization Activity

Total Operations
12,211
Last 90 days
Query Speed
12.4×
Avg. acceleration across engines
Cost Savings
$1,374,672
Saved in last 3 months
CPU & Storage
-76%
Last 90 days
Data Optimized
46.8 PB
Last 30 days

Key Metrics

Total Tables
786
Tables in all catalogs
Critical Tables
70
Require immediate attention
Warning Tables
105
Should be addressed or auto-piloted
Healthy Tables
566
Tables in optimal state
Total Data
112.4 PB
Total lake data size

Storage

-56% reclaimed
30d
112 TB75 TB38 TB
Storage used

CPU

-76% reduction
30d
100%66%33%
Compute hours

Recent Operations

Last 10 operations
OperationTableDurationImpactTimeStatus
Compact Data Files
customer_orders
orders
4s1.24 TB, 16 → 1 files57 minutes agoSUCCESS
Expire Snapshots
payment_transactions
payments
27s8.2 TB4 hours agoSUCCESS
Expire Snapshots
inventory_snapshots_20250702
warehouse
3s2.1 TB4 hours agoSUCCESS
Rewrite Manifests
raw_clickstream
analytics
1.9s3 → 1 manifests5 hours agoSUCCESS
Compact Data Files
product_catalog
products
6m 11.3s3,008 → 1,256 files6 hours agoSUCCESS

Lake Events

LiveLast 24 hours
Compact Data Files·customer_orders
ecommerce_prod·1.24 TB, 16 → 1 files
4s57 min agoOK
Expire Snapshots·payment_transactions
ecommerce_prod·12 snapshots expired
4.6s1h agoOK
Compact Data Files·raw_clickstream
marketing_events·970 → 87 files
9m 31.6s2h agoOK
Remove Orphan Files·user_sessions
marketing_events·847 MB reclaimed, 1,203 files
1m 12s3h agoOK
Rewrite Manifests·search_query_logs
ecommerce_prod·487 → 12 manifests
2.1s3h agoOK
Expire Snapshots·inventory_levels
warehouse_analytics·62 snapshots, 18.4 GB freed
27s4h agoOK
Compact Data Files·product_catalog
ecommerce_prod·3,008 → 1,256 files
6m 11.3s5h agoOK
Rewrite Manifests·shipping_events
warehouse_analytics·14 → 3 manifests
1.0s6h agoOK
Remove Orphan Files·balance_snapshots
warehouse_analytics·59,831 files, 74.8 GB
13m 6.9s7h agoOK
Compact Data Files·ad_impressions
marketing_events·42,633 → 69 files
2m 18s8h agoOK
No vendor lock-in
No code / infra changes
No data changes
REST API & MCP

Open and runs on your stack

AWS
Azure
Google Cloud
Snowflake
Databricks
Apache Flink
Apache Iceberg
Delta Lake
DuckDB
Dremio
Lakekeeper
ClickHouse
AWS
Azure
Google Cloud
Snowflake
Databricks
Apache Flink
Apache Iceberg
Delta Lake
DuckDB
Dremio
Lakekeeper
ClickHouse

How it works

From one endpoint to the right engine for each query

Clients keep the protocol they speak. Rules pick a routing group, the group's strategy picks an engine, and every query is on record.

  1. Point clients at one endpoint

    Trino, Postgres, MySQL, Snowflake, Flight SQL, and MCP clients connect as they do today.

  2. Group your engines

    Put engines into routing groups with capacity limits and a balancing strategy.

  3. Write routing rules

    Route by protocol, header, SQL pattern, client tags, or a Python function.

  4. See where queries ran

    Each query is recorded with its routing group, engine, status, and duration.

One SQL endpointQueryFlux

Clients connect with

Trino HTTP
PostgreSQL wire
MySQL wire
Snowflake HTTP
Arrow Flight SQL
MCP

Route

Queue

Translate

<1 ms

Engines run it

Trino
DuckDB
StarRocks
Athena
ClickHouse
Snowflake
Plus Databricks, BigQuery, Redshift, and PostgreSQL through ADBC

01 · One endpoint

Every client, one SQL endpoint

BI tools, notebooks, services, and AI agents connect to one endpoint over the protocol they already speak. LakeOps routing runs on QueryFlux, the open-source SQL proxy and router in Rust, which adds well under a millisecond per query.
  • Trino HTTP, PostgreSQL wire, MySQL wire, Snowflake HTTP, Arrow Flight SQL, and MCP
  • Trino, DuckDB, StarRocks, Athena, and ClickHouse, plus warehouses through ADBC
  • Add, remove, or swap engines without touching client code
Routing rulesconfig.yaml
routers:
  - type: header
    headerName: X-Workload
    headerValueToGroup:
      dashboard: interactive
      etl: batch
  - type: queryRegex
    rules:
      - regex: "(?i) limit \\d+$"
        targetGroup: duckdb-local
  - type: tags
    rules:
      - tags: { team: finance }
        targetGroup: finance
routingFallback: interactive
First match wins. Unmatched queries go to the fallback group.

02 · Routing rules

Route by protocol, header, SQL, or code

Routers run in order and the first match picks a routing group. Match on the client protocol, a request header, a SQL regex, client tags, or your own Python function, and combine them with AND/OR rules. Anything unmatched goes to a fallback group.
  • Send dashboards, ETL, and agents to different engine groups
  • Compound rules for cases a single condition can't express
  • A Python router for logic the built-in rules don't cover
Routing groupsclusterGroups
interactiveleastLoaded
trino-atrino-b
38/50 running
batchfailover
starrocks-1athena
20/20 running · 6 queued
agentsroundRobin
duckdb-local
4/16 running
A full group queues at the proxy instead of overloading its engines.

03 · Routing groups

Engines grouped by workload, with capacity limits

A routing group is a set of engine clusters for one kind of work, such as interactive dashboards or batch ETL. Each group caps its running queries and queues the rest at the proxy, so one workload can't overload an engine another one depends on.
  • Strategies: round robin, least loaded, failover, engine affinity, weighted, or Python
  • Health checks skip unhealthy members; failover moves to the next one
  • Concurrency limits hold across replicas with the PostgreSQL store
Query shape → enginePython router

CPU-heavy joins and aggregations

Compute-priced

Trino · StarRocks

Selective scans over cold data

Scan-priced

Athena

Small lookups and filters

In-process

DuckDB

2–5×

Cost of a mismatched engine

Up to 56%

Lower suite cost, matched

04 · Cost and latency

Match each query to the pricing model that fits

Compute-priced engines bill for CPU time; scan-priced engines bill for bytes read. CPU-heavy queries are cheapest on the first, selective scans over cold data on the second, and small lookups come back fastest from in-process DuckDB. Routing rules put each shape where it belongs.
  • A mismatched engine can cost 2–5× more for the same SQL
  • Matching shapes to engines cut a representative suite's cost by up to about 56%
  • Small queries on DuckDB can return in tens of milliseconds instead of a second

Engine comparison

Compare engines side-by-side on cost, latency, throughput, and data scanned.

Select engines

Spark
Active
Trino
Active
Athena
Active
Snowflake
Active
DuckDB
Active
Flink
Active

Performance comparison

MetricSparkTrinoAthenaSnowflake
Query success rate99.2%99.5%99.9%99.8%
Average runtime3.1s1.8s2.3s2.1s
Cost per query$0.04$0.03$0.05$0.08
Total queries3,1202,4561,2801,876
Data scanned4.2 TB2.8 TB1.5 TB3.5 TB

Cost vs latency

Lower-left is ideal

Low cost
High cost

Success rate

Spark
99.2%
Trino
99.5%
Athena
99.9%
Snowflake
99.8%

05 · Engine comparison

Compare engines on cost, speed, and success

The Engines view puts the engines in your stack side by side: success rate, average runtime, cost per query, total queries, and data scanned. See where each workload runs best, then point routing groups at the engines that earn it.
  • Cost per query and average runtime for each engine
  • Success rate and data scanned, side by side
  • Health and load per engine
Dialect translationsqlglot

Client sends · dialect: snowflake

SELECT IFF(amount > 100, 'big', 'small'),
       DATEADD(day, -7, CURRENT_DATE)
FROM orders

Runs on Trino

SELECT IF(amount > 100, 'big', 'small'),
       DATE_ADD('day', -7, CURRENT_DATE)
FROM orders
No dialect passed? The SQL is sent exactly as written.

06 · SQL dialects

Snowflake SQL in, Trino SQL out, when you ask

When a client passes its dialect, QueryFlux translates the SQL for the target engine with sqlglot, across more than 30 dialects. When it doesn't, the SQL is sent exactly as written, so nothing changes behind your back.
  • Translation only when the client names its dialect
  • Strict mode fails the query rather than guess; best-effort falls back to the original SQL
  • With a catalog connected, translation can use the target table's schema
Agent accessMCP · /mcp
read_onlyBlocks writes and DDL
row_limitCaps rows returned (max_rows)
require_predicateRejects full scans on big tables
opa_accessRow filters and column masks
execute_querylist_schemasdescribe_tableexplain_query

07 · AI agents

Agents query through the same guardrails

Agents connect to the MCP endpoint instead of holding a key per engine. Guardrails run before a query reaches an engine: read-only, row limits, required predicates on large tables, and OPA or Cerbos row filters and column masks. Each query is recorded with the agent and conversation that sent it.
  • MCP tools: execute_query, list_schemas, describe_table, explain_query, and more
  • Guardrails per routing group, on top of global ones
  • Replay agent conversations in QueryFlux Studio
Engines that can serve the queryorders
Before maintenance42,633 small files
TrinoDuckDBStarRocksAthena
After maintenance69 files, sorted
TrinoDuckDBStarRocksAthena

12×

Faster queries

−51%

Data scanned

−62%

S3 GETs

08 · Healthy tables

Maintained tables open up cheaper engines

Routing decides where a query runs; the table's layout decides how much work it is. LakeOps compacts and sorts your Iceberg tables and keeps manifests lean, so lighter engines like DuckDB and StarRocks can serve queries that used to need a big cluster.
  • Fewer, larger, sorted files mean less to open and scan on every engine
  • Lean manifests keep planning fast for every engine that reads the table
  • Up to 12× faster queries after compaction and layout optimization

Connect in minutes, with no lock-in

1

Connect catalogs & engines

LakeOps reads your Iceberg metadata. Data stays in your storage.

Apache Iceberg
AWS
Snowflake
DuckDB
2

Get visibility & insights

Every table's health and what it needs, from the first scan.

Health for every table
Optimization opportunities
Cost & performance insights
3

Choose your mode

Autopilot, on-demand runs, or your own policies.

Autopilot
Manual
Policies
4

Lakehouse optimized

Queries 12× faster
Cost down 76%
Engines optimized
Agents governed
Tables healthy
Fully governed
Sign upSet up in 10 minutes · Works with your existing stack

The challenge

One engine can't be the right engine for every query

Query shapes differ, engines bill differently, and workloads compete. Without a routing layer, every app picks an engine once and lives with it.

Every query hits the same engine

Dashboards, ETL, and ad-hoc exploration all land on one engine, whatever their shape. Small lookups wait behind batch jobs.

A driver config per engine, per team

Every engine brings its own drivers, credentials, and connection strings. Adding or swapping an engine means changing every client.

The wrong pricing model for the query

Compute-priced engines bill for CPU time; scan-priced ones bill for bytes read. A query on the wrong model can cost 2–5× more.

Workloads fight over one cluster

A batch job and an interactive dashboard on the same cluster slow each other down. Without isolation, latency is unpredictable.

Compare

How teams route queries today

Hard-coded connections can't adapt, and Trino Gateway stops at Trino. LakeOps routing spans engines and client protocols behind one endpoint.

CapabilityOne engine per appTrino GatewayLakeOps, powered by QueryFlux
EnginesWhichever engine the app is wired toTrino clustersTrino, DuckDB, StarRocks, Athena, ClickHouse, plus Snowflake, Databricks, BigQuery, Redshift, and PostgreSQL via ADBC
Client protocolsEach engine's own driverTrino HTTPTrino HTTP, PostgreSQL wire, MySQL wire, Snowflake HTTP, Arrow Flight SQL, and MCP
How queries are routedHard-coded in each appRouting rules across Trino clustersProtocol, header, SQL pattern, client tags, Python, or compound rules, with a fallback group
CapacityThe engine's own queuesHealth checks across clustersPer-group concurrency limits, proxy-side queueing, and health-aware strategies
SQL dialectsRewrite queries by handTrino SQLOptional translation between dialects when the client asks for it
AI agentsCredentials per engineNot built inMCP endpoint with read-only, row-limit, and predicate guardrails
Source—Open source (Apache-2.0)Open source (Apache-2.0)

Trino Gateway details are from its public documentation, November 2026. QueryFlux overhead from its open-source proxy benchmark; cost figures from QueryFlux's routing tests.

Results

Cut costs and boost performance

Benchmarks from production-grade tables across multiple engines and clouds.

Query speed

12×faster

After compaction + layout optimization

CPU reduction

76%less compute

Compute hours across all engines

Storage saved

56%reclaimed

Orphans, snapshots & bloat removed

Table health

100%healthy

Autonomous maintenance keeps every table optimized

TPC-DS benchmark suiteProduction Iceberg tablesMulti-cloud, multi-engine

See it in action

Watch the LakeOps control plane in action

Healthy tables and the right engine for each query, across your lakehouse.

Watch demoYouTube ↗

FAQ

Multi-engine query routing, answered

What is multi-engine query routing?

A router that sits between your clients and your query engines. Clients connect to one SQL endpoint, and rules decide which engine runs each query, for example dashboards on a low-latency engine and heavy ETL on a cheaper one, without changing application code.

Which engines and clients does LakeOps routing support?

Engines: Trino, DuckDB, StarRocks, Athena, and ClickHouse, plus Snowflake, Databricks, BigQuery, Redshift, and PostgreSQL through ADBC. Clients connect over Trino HTTP, PostgreSQL wire, MySQL wire, Snowflake HTTP, Arrow Flight SQL, or MCP.

How does routing lower query cost?

Engines bill differently: compute-priced engines charge for CPU time, scan-priced engines for bytes read. Sending each query shape to the pricing model that fits it avoids the 2–5× penalty of a mismatch. In QueryFlux's routing tests, matching shapes to engines cut the cost of a representative suite by up to about 56%. You express that logic as routing rules or a Python router.

How much latency does the router add?

Well under a millisecond. QueryFlux is written in Rust, and its proxy overhead benchmark measures a fraction of a millisecond per query at the median.

Do applications need to change?

Only the connection: point the client at the routing endpoint using the protocol it already speaks. After that, engines can be added, removed, or swapped behind the endpoint without client changes. SQL is sent as written unless the client asks for dialect translation.

How is this different from Trino Gateway?

Trino Gateway load-balances and routes across Trino clusters. LakeOps routing, built on QueryFlux, routes across different engines, accepts several client protocols, can translate SQL dialects, and gives AI agents a guarded MCP endpoint.

Is QueryFlux open source?

Yes. QueryFlux is an open-source (Apache-2.0) SQL proxy and router in Rust, maintained by the LakeOps team. LakeOps query routing is built on it, so your routing configuration is portable.

One endpoint. The right engine for each query.

Route across Trino, DuckDB, StarRocks, Athena, and Snowflake, with no app changes.