Skip to content
BENIBIX Learn

Federated Query

Data📊 Analytics & BIQuery Engines

Also known as Query Federation, Data Federation, Cross-Database Query

One SQL query that reads from more than one system.

Think of it like

It is like one shopping list that a helper fills from three different shops. You get one bag back.

Example

Finance wants to join this morning's customer list with last year's orders. A federated query does it now, with no pipeline.

Why it matters

It answers a question that spans two systems today. You do not wait for a pipeline to copy the data.

Definition

A federated query reads from more than one data system in a single SQL statement. One part might come from a PostgreSQL database and another from files in a data lake. The engine sends each part to its source, then joins the results. No data is copied ahead of time. It is handy for one-off joins, but it is slower than querying data kept in one place.

Example code

sql
SELECT c.name, SUM(o.total) AS spent
FROM postgresql.public.customers AS c
JOIN hive.sales.orders AS o ON o.customer_id = c.id
GROUP BY c.name;
One query, two systems. Customers come from PostgreSQL, and orders come from the data lake.
This is a federated query. One question gets its answer from three places.

Common mistake

Building daily reports on it. Each run reads both systems again and can slow the live database. Copy the data instead.

Key takeaways

  1. 1
    Many sources. One query, several systems.
  2. 2
    No copy first. Data stays where it is.
  3. 3
    Good for one-offs. Slower than one store.