
Routing Multiple Query Engines with Iceberg
How to route queries across Trino, Spark, DuckDB, Snowflake, Athena, and Flink on shared Iceberg tables — covering routing architecture, dialect translation, and strategies.
Multi-Engine Query Routing
One SQL endpoint. LakeOps sends each query to Trino, Spark, DuckDB, Snowflake, Athena, StarRocks, or Flink based on cost, latency, or workload type. Swap engines without changing application code. Up to 56% lower query spend.
Open and runs on your stack

Measured Impact
Cost reduction
Workload-aware routing matches queries to optimal pricing models
Latency
Point lookups on DuckDB vs same query on Athena (0.5s vs 2.3s)
Proxy overhead
Rust-based routing adds negligible latency to query path
Benchmarks from queryflux-bench suite • Production Iceberg tables • Multi-cloud, multi-engine
How LakeOps optimizes routing
Dispatch by query shape, isolate workloads on dedicated endpoints, fail over unhealthy engines, and compact tables so cheaper engines can run more of the SQL.
Query dispatch
Interactive lookups go to DuckDB or Trino. Heavy scans go to Spark or Athena. Cost, latency, or throughput strategy is set per routing group. Rules update as query mix changes.
Optimize for: cost · performance · consumer
Routing groups & endpoints
Group engines into routing endpoints by workload type: storefront analytics on Trino + DuckDB, checkout transactions on Snowflake + StarRocks, catalog ETL on Athena + Spark. Each group has its own policies, capacity limits, and fallback rules — all managed from one console.
Map workloads to engine pools, publish stable URLs, and tune priority without touching clients.
Edit engines, query types, and published URLs
Handles BI, DT queries on Transactional databases
Batch data transformation and scheduled loads
Routine reporting and dashboard queries
Engine comparison & health
Compare every registered engine across query success rate, average runtime, cost per query, total queries, and data scanned. Spot under-performing engines before they impact SLAs. View engine health, uptime, and resource signals in one place — then route traffic away from degraded backends automatically.
Compare engines side-by-side on cost, latency, throughput, and data scanned.
| Metric | Spark | Trino | Athena | Snowflake |
|---|---|---|---|---|
| Query success rate | 99.2% | 99.5% | 99.9% | 99.8% |
| Average runtime | 3.1s | 1.8s | 2.3s | 2.1s |
| Cost per query | $0.04 | $0.03 | $0.05 | $0.08 |
| Total queries | 3,120 | 2,456 | 1,280 | 1,876 |
| Data scanned | 4.2 TB | 2.8 TB | 1.5 TB | 3.5 TB |
Lower-left is ideal
Table-aware optimization
Routing alone improves dispatch — but compacted, sorted tables unlock even more engines for any given query. LakeOps continuously optimizes file layout, manifests, and statistics so that engines like DuckDB and StarRocks can handle queries that previously required heavy distributed compute.
One set of rules
Set cost ceilings, latency targets, fallbacks, and capacity once. Clients connect to one endpoint. Add or remove backends without touching application code. Every query is logged with engine, cost, and reason.
Interactive BI → low-latency pool
ETL batch → compute-optimized
Ad-hoc exploration → cost-optimized
Streaming ingest → stream-native
Product tour
Register engines, compare performance, monitor health, and route traffic — without per-engine scripts or duplicate dashboards.


QueryFlux is an open-source, Rust-based SQL proxy that provides multi-engine query routing with protocol translation, capacity management, and observability. It works as a standalone proxy — and gains intelligent optimization when connected with LakeOps.
Deploy QueryFlux as your multi-engine SQL proxy without any other dependencies. One endpoint replaces N×M driver configurations — clients connect once, the backend topology is config, not code.
4 frontend protocols
Trino HTTP, PostgreSQL wire, MySQL wire, Arrow Flight SQL
6+ backend engines
Trino, DuckDB, StarRocks, Athena, ClickHouse, Snowflake, and more
Cost, latency, or throughput per group
Protocol-based, header-based, regex, client tags, Python script logic
SQL dialect translation
sqlglot-backed conversion across 31+ SQL dialects automatically
Per-group capacity & queuing
Concurrency limits, overflow queuing, and fallback routing per cluster group
Observability built in
Prometheus metrics, Grafana dashboards, QueryFlux Studio UI, Admin API
When connected with LakeOps, QueryFlux gains access to table telemetry, query history, and optimization signals — enabling intelligent routing decisions that go beyond static rules.
Table-health-aware routing
Route queries away from tables with fragmented manifests or high delete file counts to engines that handle degraded state better
Query-pattern learning
LakeOps telemetry feeds historical latency and cost data per query shape — routing improves automatically over time
Optimization-driven engine expansion
As LakeOps compacts and sorts tables, more engines become viable for each query — expanding routing options dynamically
Unified cost model
Combine query routing cost data with compaction compute savings for full lake-wide cost visibility and optimization
Policy-driven automation
Set cost ceilings, latency targets, and priority rules — LakeOps enforces them across routing and table optimization together
Lakehouse Control Plane
Routing sits next to compaction, snapshot expiry, table health, and MCP guardrails — same catalogs, same tables.
| Table | NS | Size | Status |
|---|---|---|---|
| customer_orders | orders | 1.24 TB | HEALTHY |
| payment_transactions | payments | 860 GB | WARNING |
| raw_clickstream | analytics | 4.6 TB | CRITICAL |
| product_catalog | products | 42 GB | HEALTHY |
| user_sessions | analytics | 1.9 TB | WARNING |
| inventory_levels | operations | 320 GB | HEALTHY |
| shipping_events | logistics | 580 GB | HEALTHY |
| search_query_logs | analytics | 3.2 TB | CRITICAL |
Learns from query patterns and table signals to decide what to optimize, when, and how — no schedules, no manual tuning.
The problem
Most teams run 2–5 engines. Without a router, dashboards, batch jobs, and ad-hoc SQL share one cluster — or every app hardcodes its own connection string.
Without routing, all queries — interactive dashboards, heavy ETL, ad-hoc exploration — land on one engine. CPU-heavy joins pay scan-pricing on Athena; selective lookups wait behind batch jobs on Trino.
Each engine requires its own connection strings, credentials, and client libraries. Every team maintains a separate config per engine — adding or removing a backend means coordinating across every consumer.
Compute-priced backends (Trino, StarRocks) charge for CPU-seconds. Scan-priced backends (Athena, BigQuery) charge for bytes read. Without cost-aware routing, every query pays the wrong pricing model.
A batch ETL job competing with an interactive dashboard on the same Trino cluster degrades both. Without workload isolation at the routing layer, latency-sensitive queries suffer unpredictably.
Resources

How to route queries across Trino, Spark, DuckDB, Snowflake, Athena, and Flink on shared Iceberg tables — covering routing architecture, dialect translation, and strategies.

How production Iceberg lakehouses run Spark, Trino, Snowflake, Athena, Flink, and DuckDB on the same tables — covering write isolation, conflict resolution, and query routing.

Where lakehouse spend leaks, what to measure, how autonomous management and query routing are replacing manual maintenance — and a practical survey of tools.
Only metadata is processed — never retained or stored.
Telemetry reveals table health and actions needed.
Autopilot, manual approval, or policy-driven.
Connect your engines and get a routing analysis in minutes — see which queries should move, how much you'd save, and which engines to add or consolidate.