Query Federation What Actually Happens When You Query Across Data Systems
Query federation lets one SQL statement run across separate data systems. Learn how planning, pushdown, cross-source joins, and result assembly work.
In the full article
Read the transcript
Auto-generated captions; wording may contain recognition errors.
Query federation is the technical mechanism by which a single SQL query executes across multiple separate data systems and returns a unified result. While data federation describes the architectural principle, query federation describes what actually happens when a query runs, how it is parsed, planned, decomposed, pushed to sources, and reassembled. When a federated query arrives at the engine, the query planner analyzes it to determine which tables or data sources each portion needs to access. This produces an execution plan specifying which subqueries will be sent to which sources and in what order. Predicate pushdown is the optimization that makes federated queries practically viable at scale. Without it, the engine retrieves all data from each source and performs filtering, joining, and aggregation in a central layer. With predicate pushdown, the engine rewrites each subquery to include as many wear clauses, aggregation functions, and join conditions as the source system can handle natively. The source does as much work as possible on its own data before returning results, dramatically reducing the volume of data that crosses the network. Cross-source joins are where federated query engines face their most significant challenge. When tables from different source systems need to be joined, the engine must fetch data from both and perform the join in memory. This works well when one side of the join is small enough to broadcast, but joins between large tables from different systems can become expensive because they require moving significant data volumes to a common processing location. The practical value for enterprise AI is that query federation allows data products to be built on current operational data without replication pipelines. An AI agent that needs to join customer status from a CRM with order history from an ERP and pricing from a product catalog can execute that as a single federated statement against live source data.


