Guide · Oct 30, 2026 · 3 min read

What is a federated query engine?

A federated query engine runs one SQL query across several databases and returns one result. The data stays where it is. The engine sends parts of the query to each database, collects the answers and combines them. For the application, all those databases look like one.

The approach is also called SQL federation, or data virtualization when the focus is on reporting.

On this page
  1. Why the question comes up
  2. How it differs from other tools
  3. How it works inside
  4. When you need one
  5. When you don’t
  6. Where Otterstax fits

Why the question comes up

Few companies plan to run five databases, but it happens anyway. Transactions sit in MariaDB or PostgreSQL. Events go to ClickHouse or Kafka. Files land in S3. Then someone needs an answer that touches all of them: revenue by marketing channel, a customer’s full history, a fraud score that needs live transactions.

There are three usual ways to get that answer:

  1. Glue code. The app opens a connection to each database and joins the results in memory. This works for a few queries, then gets hard to maintain as more queries and teams depend on it.
  2. Copy everything to one place. ETL jobs move data into a warehouse on a schedule. Queries are simple, but the data is hours old.
  3. Query the data where it lives. A federated query engine does this.

How it differs from other tools

ETL and ELT pipelines copy data. A federated engine reads from the sources at query time. The trade-off is freshness against load. ETL gives you a stable copy that is hours old. Federation gives you current data and puts the read load on the source databases.

A data warehouse stores its own copy in a format built for analytics. It is still the right tool for years of history and heavy reports. A federated engine can work next to it and query the warehouse and the live databases in one statement.

CDC tools such as Debezium stream changes from one database to another. They keep copies in sync but don’t answer queries. Some federated engines use CDC inside, for example to keep two databases in sync during a migration.

Read-only query engines such as Trino and Presto are federated engines built mostly for analytics. Clients connect over HTTP or JDBC, and the engine usually runs as a cluster. Other engines also accept the wire protocol of a regular database, so an existing app can connect without a new driver.

How it works inside

A federated query engine has three main parts.

Catalog. The engine keeps a list of connected databases and their tables. Each table gets a full name, such as sales.ops.orders, that says which database it lives in. Schemas are usually discovered automatically.

Planner. The engine reads the SQL and splits it into pieces. It decides which piece can run in which database, and what has to happen in the engine itself, for example a JOIN between two databases.

Pushdown. Filters, limits and aggregations are sent down to each source, so only the rows that matter travel over the network. Query speed depends mostly on this. A good planner pushes down as much as possible. A query with no pushdown pulls whole tables and gets slow.

After that, the engine joins the slices, applies the remaining operations and returns one result.

When you need one

  • Your app joins data from two or more databases in code.
  • Dashboards or ML models need data fresher than the last ETL run.
  • You want to move tables between databases without rewriting every service.
  • AI agents need one place to read company data with the same permissions as people.

When you don’t

  • All your data already sits in one database, and that works.
  • Your queries need years of history and heavy scans. A warehouse is a better fit.
  • A source database is already overloaded. Federation adds read load, so add a replica first.
  • The network between the engine and the databases is slow. Every query waits for the slowest source.

Where Otterstax fits

Otterstax is an open-source federated query engine for MariaDB, PostgreSQL, ClickHouse, S3 and Kafka. Apps connect to it with their existing MariaDB / MySQL or PostgreSQL driver, and analytics tools with Arrow Flight SQL or ADBC. It reads and writes, and keeps databases in sync during a gradual migration. The open-source version runs as one process. Enterprise adds a Kubernetes cluster with failover.

How Otterstax works →

Try it in 5 minutes: Quickstart →


Sources

More guides

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.