CLOUD CONCEPT

Query Federation

Query federation lets a query engine access and combine data from separate data sources without first loading all of that data into one store.

Cloud Concepts Hub →

What is Query Federation

A federated query engine presents remote data through a common query interface, translates supported operations for each source, and combines the results. This enables analysis across operational databases, warehouses, and data lakes while reducing ingestion requirements, but introduces dependencies on source performance, connectivity, permissions, and consistency.

Query federation separates where data is stored from where a query is coordinated. Instead of requiring every dataset to be copied into a central warehouse before analysis, a query engine accesses external sources through connectors or external schemas. It can combine remote results with locally stored tables and return one result set. This is useful when engineers need current operational data, occasional access to a remote dataset, or a gradual transition between storage platforms.

A typical implementation begins by configuring source connectivity, credentials, permissions, and metadata mappings. External tables or schemas describe how remote objects appear to the query engine. During execution, the engine determines which operations can run at the source and which must run centrally. Predicate pushdown sends supported filters to the source, while projection pushdown retrieves only required columns. Depending on the connector and query, aggregation or other operations may also execute remotely. Inspect execution plans rather than assuming every operation is pushed down.

For example, an analyst might join historical sales in a warehouse with today's orders in an operational database. Filtering the remote orders by date before transferring results can make this practical. Fetching the entire orders table and then performing a large join centrally can create substantial network traffic, memory pressure, and database load. Federation avoids a prerequisite bulk ingestion pipeline, but it does not mean that no data moves: intermediate results still travel between systems, and some engines use temporary storage.

In Amazon Redshift, federated queries access supported Amazon RDS and Aurora PostgreSQL or MySQL databases through external schemas. Redshift can combine those remote records with local warehouse tables. Redshift Spectrum addresses a different source type: it queries supported data files in Amazon S3 through external tables. Both support analysis without first loading all source data into Redshift tables, but Spectrum is not the mechanism for querying an operational relational database. A practical design can combine warehouse history, operational records, and S3 data in one analytical workflow.

Materialized views solve a related but distinct problem. A normal view stores a query definition; a materialized view stores computed results. Where the engine supports materialized views over external or federated sources, they can reduce repeated remote reads and accelerate recurring reports. The trade-off is additional storage, refresh work, and stale results between refreshes. Refresh support and eligibility vary by source and query definition; do not assume incremental or automatic refresh is available. Materialization is therefore not synonymous with live remote access.

Federation also creates operational coupling. A slow or unavailable source can delay or fail an otherwise healthy analytical query, and large remote scans can compete with application transactions. Use selective predicates, appropriate source indexes, workload limits, and read replicas where supported and suitable. Evaluate network transfer charges, connector execution costs, and remote database capacity alongside query-engine costs. For repeated large scans or predictable dashboard latency, ingestion through batch pipelines or change data capture may be more suitable.

Finally, federation does not automatically provide a globally consistent snapshot or unified security enforcement. Different sources may expose data from different points in time, and data types, collations, and SQL semantics may require reconciliation. Configure least-privilege access at both the coordinating engine and each source, protect credentials, and validate network paths. Choose federation when avoiding persistent duplication and accessing sufficiently current remote data outweigh its runtime dependencies; choose ingestion or materialization when isolation, repeatability, or predictable performance matters more.

Key aspects of Query Federation

Effective federation combines remote access with selective execution, explicit security boundaries, and deliberate choices about freshness, source load, and materialization.

Remote access through a common query interface

Connectors and external schemas expose independently stored data to a coordinating query engine. Supported queries can combine remote datasets with local tables without requiring a complete initial load.

Pushdown and transfer reduction

Supported filters, column selection, and sometimes aggregations execute at the source to reduce transferred data. Check execution plans because connector capabilities and query structure determine what actually runs remotely.

Freshness without guaranteed global consistency

Remote access can avoid the delay of scheduled ingestion, but freshness still depends on source behavior and replica lag. A cross-source query does not inherently read every system at one common transactional snapshot.

Source and network dependencies

Query latency and availability depend on remote capacity, connectivity, and connector behavior. Large scans can affect operational workloads, so constrain queries and monitor the source as well as the coordinating engine.

Federation versus materialization

Federation reads remote data during query execution, whereas materialization persists computed results for reuse. Materialized views can improve repeated-query performance but require supported refresh mechanisms and an acceptable freshness window.

Layered access control

The query engine needs permission to expose external objects, and its source identity needs permission to read the underlying data. Secure credentials and network access, and verify how source policies apply to federated requests.

Cloud services for Query Federation

These services provide alternative coordinating engines rather than components that must all be deployed together. Redshift can combine warehouse tables with operational data through federated queries and S3 datasets through Spectrum. Athena offers connector-based access to supported external sources alongside S3 analysis. BigQuery provides comparable remote-query capabilities for supported databases in Google Cloud. In each architecture, connectors, source permissions, and network access establish the remote path. Use materialized results or ingestion when recurring scans would overload sources or when reports need more predictable latency than live federation can provide.

Amazon Redshift image Amazon Redshift

Redshift federated queries access supported RDS and Aurora PostgreSQL or MySQL databases and can join their data with local tables. Redshift Spectrum queries supported S3 data through external tables, while supported materialized views offer a separate way to persist results for repeated analysis.

Open Amazon Redshift →
Amazon Athena image Amazon Athena

Athena federated queries use data source connectors to query supported systems outside S3 and can combine data across sources. Pushdown capabilities and operational requirements depend on the connector, so evaluate source load and execution costs.

Open Amazon Athena →