Federated query guide联邦查询指南

Federated Query: Architecture, Pushdown & Joins联邦查询:参考架构、下推与跨源连接

A federated query uses one query layer to plan and execute work across multiple autonomous data sources, combining selected results without first copying every dataset into one store.

联邦查询使用一个查询层在多个自治数据源之间规划和执行工作,并组合选定结果,而不要求先把每个数据集复制到同一存储中。

Updated August 10, 2026更新于2026年8月10日11-minute read阅读约11分钟InfiniSynapse
Federated query architecture decomposing a logical plan into connector-specific subplans, pushing filters and aggregations to autonomous sources, and joining bounded results
On this page本页目录

    What Is a Federated Query?什么是联邦查询?

    For the full topic map and the neighboring methods that support this workflow, continue with the federated queries and data virtualization guide.

    如需查看完整主题结构以及支撑本流程的相邻方法,请继续阅读联邦查询与数据虚拟化指南

    A federated query is one logical query whose plan reads from two or more separately managed data sources and combines their selected results at query time. A federated query engine resolves source objects, translates types and operations through connectors, pushes safe work to each source, executes remaining joins or aggregations, and returns one result with execution and source evidence.

    联邦查询是一条逻辑查询,其执行计划读取两个或更多分别管理的数据源,并在查询时组合选定结果。联邦查询引擎解析来源对象,通过连接器转换类型与操作,把安全工作下推到各来源,执行剩余连接或聚合,再返回带执行和来源证据的统一结果。

    The term describes a query behavior, not a universal product contract. One engine may join a warehouse table with an operational database; another may query object storage and a remote catalog; a cloud service may expose only specific external sources through managed connectors. Connector, source, edition, region, identity, network, type, operator, quota, and transaction support must all be verified.

    该术语描述查询行为,并不代表统一产品契约。一个引擎可能连接数据仓库表与业务数据库;另一个可能查询对象存储和远程目录;某云服务则只能通过托管连接器访问特定外部来源。连接器、来源、版本、区域、身份、网络、类型、操作符、配额和事务支持都必须逐项验证。

    Trino provides one concrete model: catalogs configure connectors, a coordinator parses and plans, workers fetch through connectors, and stages, tasks, splits, operators, and exchanges execute the distributed plan. Athena, BigQuery, Redshift, and PostgreSQL foreign-data wrappers expose different boundaries. Their official documentation is evidence for implementations, not proof that every federated query engine behaves alike.

    Trino提供一种具体模型:目录配置连接器,协调器解析和规划,工作节点通过连接器读取数据,阶段、任务、分片、操作符和交换共同执行分布式计划。Athena、BigQuery、Redshift和PostgreSQL外部数据包装器则具有不同边界。它们的官方文档是实现证据,并不能证明所有联邦查询引擎行为相同。

    Federated Query Architecture from Client to Source从客户端到来源的联邦查询架构

    Client and session context客户端与会话上下文

    Supplies query text, identity, role, purpose, locale, time zone, resource class, deadline, and result expectations.

    提供查询文本、身份、角色、用途、语言环境、时区、资源类别、截止时间和结果预期。

    Catalog and connector registry目录与连接器登记

    Maps logical names to endpoints, credentials, owners, schemas, types, functions, statistics, limits, health, and versioned capabilities.

    把逻辑名称映射到端点、凭据、所有者、Schema、类型、函数、统计、限制、健康和带版本能力。

    Parser, analyzer, and policy gate解析器、分析器与策略门禁

    Resolves objects and fields, checks syntax and types, applies policies, and rejects operations that cannot preserve required semantics or authorization.

    解析对象和字段,检查语法与类型,应用策略,并拒绝无法保持所需语义或授权的操作。

    Optimizer and planner优化器与规划器

    Chooses join order, execution location, pushdown, partitioning, exchange, memory, spill, concurrency, and fallback using available evidence.

    依据可用证据选择连接顺序、执行位置、下推、分区、交换、内存、溢写、并发和回退。

    Workers and source adapters工作节点与来源适配器

    Execute connector-specific requests, stream bounded data, normalize returned types, propagate cancellation, and expose source errors.

    执行连接器专属请求,流式传输受限数据,规范返回类型,传播取消,并暴露来源错误。

    Assembly and evidence组合与证据

    Performs remaining joins or aggregates and returns provenance, observation times, warnings, coverage, plan identity, rows, bytes, timing, and audit correlation.

    执行剩余连接或聚合,并返回来源证明、观察时间、警告、覆盖、计划身份、行数、字节、时序和审计关联。

    These are responsibilities, not mandatory products. A cloud service may combine them; a self-managed engine may separate control plane, coordinator, workers, catalogs, and secret management; an embedded foreign-data mechanism may place planning inside an existing database. Evaluate where each responsibility lives and who operates it.

    这些是职责,并非必须对应独立产品。云服务可能把它们组合起来;自管引擎可能分离控制面、协调器、工作节点、目录和密钥管理;嵌入式外部数据机制则可能把规划放在现有数据库内部。应评估每项职责位于何处以及由谁运营。

    How a Federated Query Works Step by Step联邦查询如何逐步工作

    1. Bind identity and intent.绑定身份与意图。 Authenticate the caller and attach purpose, role, resource class, deadline, time zone, result policy, and session settings.验证调用者,并附加用途、角色、资源类别、截止时间、时区、结果策略和会话设置。
    2. Parse and resolve.解析与定位。 Convert query text into a logical plan and resolve every catalog, schema, table, column, type, function, and policy.把查询文本转换为逻辑计划,并解析每个目录、Schema、表、列、类型、函数和策略。
    3. Analyze capabilities.分析能力。 Compare required operations with connector and source support; reject or compensate for differences explicitly.比较所需操作与连接器和来源支持情况;显式拒绝差异或执行补偿。
    4. Optimize placement.优化执行位置。 Use statistics, selectivity, locality, transfer cost, source load, memory, concurrency, and deadlines to choose pushdown and join order.使用统计、选择性、位置、传输成本、来源负载、内存、并发和截止时间选择下推及连接顺序。
    5. Generate source subplans.生成来源子计划。 Translate approved fragments into source-native requests with bounded columns, predicates, aggregates, limits, parameters, and identifiers.把获批片段转换为来源原生请求,并限制列、谓词、聚合、行数、参数和标识符。
    6. Execute and exchange.执行与交换。 Run remote and local stages, stream or stage results, enforce budgets, propagate cancellation, and avoid unsafe unbounded retries.运行远端和本地阶段,流式或暂存结果,执行预算,传播取消,并避免不安全的无界重试。
    7. Join, aggregate, and normalize.连接、聚合与规范化。 Apply remaining operations while preserving types, nulls, precision, collation, time, provenance, and declared incomplete-result policy.执行剩余操作,同时保留类型、空值、精度、排序规则、时间、来源证明和已声明的不完整结果策略。
    8. Return result and evidence.返回结果与证据。 Expose plan identity, pushed and local operations, source states, rows, bytes, timings, warnings, observation times, policy decisions, and audit correlation.暴露计划身份、下推与本地操作、来源状态、行数、字节、时序、警告、观察时间、策略决定和审计关联。

    Verify Federated Query Pushdown with the Actual Plan使用实际计划验证联邦查询下推

    Pushdown sends selected work to a source so less data crosses the network and less coordinator work remains. Common forms include predicate, projection, nested-field dereference, aggregation, join, limit, and Top-N pushdown. It is valuable only when the translated operation is semantically safe and the source can execute it within its protection envelope.

    下推把选定工作发送到来源,从而减少跨网络数据量和协调器剩余工作。常见形式包括谓词、投影、嵌套字段解引用、聚合、连接、限制和Top-N下推。只有当转换后的操作在语义上安全,且来源能在保护范围内执行时,下推才有价值。

    Plan evidence计划证据

    Capture normalized and physical plans. Identify remote scans, filters, projections, aggregates, joins, limits, exchanges, repartitioning, local operators, estimates, and selected connectors.

    捕获规范化计划与物理计划。识别远程扫描、筛选、投影、聚合、连接、限制、交换、重分区、本地操作、估计和选定连接器。

    Runtime evidence运行时证据

    Reconcile the plan with source logs and telemetry: submitted text or parameters, rows scanned and returned, bytes transferred, partitions read, duration, connections, memory, spill, cancellation, and errors.

    将计划与来源日志及遥测核对:提交文本或参数、扫描与返回行数、传输字节、读取分区、时长、连接、内存、溢写、取消和错误。

    Do not assume a join is pushed because both tables use the same connector type. Some engines require the same catalog, compatible types, translatable predicates, trusted statistics, and connector-specific support. A pushed join can also expand rows; placement must be validated from actual cardinality and transfer evidence.

    不能因为两张表使用同一种连接器就假设连接已下推。某些引擎要求相同目录、兼容类型、可转换谓词、可信统计和连接器专属支持。下推连接也可能扩大行数;执行位置必须依据实际基数和传输证据验证。

    Failure rule: if a mandatory filter, authorization predicate, time boundary, precision rule, or row limit cannot be preserved, reject the query or use an approved alternative. Silently performing a different operation is not optimization.

    失败规则:如果必需筛选、授权谓词、时间边界、精度规则或行数限制无法保持,应拒绝查询或使用获批替代方案。静默执行不同操作不是优化。

    Control Cross-Source Joins and Data Movement控制跨源连接与数据移动

    A cross-source join is where many promising prototypes fail. The planner must decide which side to filter or aggregate remotely, which side to move, whether to broadcast a small relation, whether to repartition streams, and whether an approved temporary stage or cache is allowed. A poor decision can scan operational tables, saturate links, exhaust coordinator memory, spill sensitive data, or miss a deadline.

    跨源连接是许多看似成功原型失败的地方。规划器必须决定哪一侧在远端筛选或聚合、移动哪一侧、是否广播小关系、是否重分区数据流,以及是否允许获批临时暂存或缓存。错误决定可能扫描业务表、占满链路、耗尽协调器内存、溢写敏感数据或错过截止时间。

    Join-placement decision evidence连接位置决策证据
    Factor因素Required evidence所需证据Risk when missing缺失风险
    Cardinality and selectivity基数与选择性Fresh row counts, value distributions, filter selectivity, skew, and null rates最新行数、值分布、筛选选择性、倾斜和空值率Wrong build side, network explosion, or memory exhaustion错误构建侧、网络膨胀或内存耗尽
    Key semantics键语义Type, normalization, uniqueness, collation, padding, case, and duplicate rules类型、规范化、唯一性、排序、填充、大小写和重复规则False matches, missed matches, or duplicate multiplication错误匹配、漏匹配或重复倍增
    Location and transfer位置与传输Region, route, bandwidth, egress, encryption, data class, and staging permission区域、路由、带宽、出口、加密、数据分类和暂存许可Unexpected cost, policy violation, or deadline miss意外成本、策略违规或错过截止时间
    Source envelope来源范围Concurrency, scan, CPU, I/O, timeout, lock, replica, and maintenance limits并发、扫描、CPU、I/O、超时、锁、只读副本和维护限制Production-source degradation or cascading retries生产来源降级或级联重试

    When a recurring join repeatedly moves the same large data, materializing an approved model may be safer and cheaper. Federation is not a moral preference for “no copies”; it is one execution choice whose movement, retention, freshness, security, cost, and reliability must be compared with alternatives.

    当重复连接持续移动同一批大数据时,物化获批模型可能更安全、更经济。联邦并不是“不复制”的道德偏好;它只是一个执行选择,必须将其移动、保留、新鲜度、安全、成本和可靠性与替代方案比较。

    Use InfiniSynapse for Related Approved Multi-Source Analysis使用InfiniSynapse执行相关获批多来源分析

    The InfiniSynapse public product pageInfiniSynapse公开产品页面 visibly describes direct connections to supported databases and multi-source joint analysis. That makes the application a relevant entry when the actual task is approved analysis across supported sources. The existing data-source identification guide数据源识别指南 and data-quality guide数据质量指南 can help prepare source scope and checks.

    InfiniSynapse public product pageInfiniSynapse公开产品页面明确描述了对受支持数据库的直接连接和多来源联合分析。当实际任务是在受支持来源之间开展获批分析时,该应用可作为相关入口。现有数据源识别指南数据源识别指南数据质量指南数据质量指南可帮助准备来源范围和检查。

    This page does not claim that every InfiniSynapse connection implements a universal federated SQL engine, arbitrary cross-source join, connector pushdown, distributed transaction, source-native identity delegation, full EXPLAIN plan, workload governor, or every capability discussed above. Confirm the exact visible source and workflow before relying on it.

    本页不声称每个InfiniSynapse连接都实现通用联邦SQL引擎、任意跨源连接、连接器下推、分布式事务、来源原生身份委派、完整EXPLAIN计划、工作负载治理器或本文讨论的全部能力。使用前应确认确切可见来源与工作流。

    Before opening the application, prepare confirmed supported connection details, data-owner approval, least-privilege credentials, network and certificate requirements, approved tables and fields, join keys and grain, time and freshness rules, reconciliation checks, expected result size, and source-load limits.

    打开应用前,请准备已确认支持的连接信息、数据所有者批准、最小权限凭据、网络与证书要求、获批表与字段、连接键与粒度、时间与新鲜度规则、核对检查、预期结果大小和来源负载限制。

    Analyze approved sources within defined query boundaries在明确查询边界内分析获批来源

    After support, authorization, semantics, freshness, reconciliation, and workload limits are confirmed, open InfiniSynapse for the related multi-source analysis workflow.

    确认支持、授权、语义、新鲜度、核对和工作负载限制后,打开InfiniSynapse执行相关多来源分析工作流。

    Analyze approved data sources分析获批数据来源

    Federated Query FAQ联邦查询常见问题

    What is a federated query?

    什么是联邦查询?

    A federated query is one logical query whose execution plan reads from two or more separately managed data sources and combines selected results at query time. A query engine resolves source objects, translates types and operations through connectors, pushes safe work to sources, executes remaining joins or aggregates, and returns one result with source and execution evidence.

    联邦查询是一条逻辑查询,其执行计划读取两个或更多分别管理的数据源,并在查询时组合选定结果。查询引擎解析来源对象,通过连接器转换类型与操作,把安全工作下推到来源,执行剩余连接或聚合,再返回带来源与执行证据的统一结果。

    How does a federated query work?

    联邦查询如何工作?

    The engine binds identity and session context, parses the query, resolves catalogs and objects, checks policy and connector capabilities, chooses execution locations and join order, generates source-native subplans, runs remote and local stages, normalizes returned types, combines results, and returns provenance, observation times, warnings, coverage, plan identity, rows, bytes, and timing.

    引擎绑定身份与会话上下文,解析查询,定位目录与对象,检查策略与连接器能力,选择执行位置与连接顺序,生成来源原生子计划,运行远端和本地阶段,规范返回类型,组合结果,再返回来源证明、观察时间、警告、覆盖、计划身份、行数、字节和时序。

    Does a federated query copy data?

    联邦查询会复制数据吗?

    It does not require every source dataset to be copied into one permanent store before the query. Data can still cross the network and may be exchanged, buffered, spilled, staged, cached, logged, or returned. Every intermediate artifact needs explicit authorization, encryption, retention, invalidation, deletion, provenance, and freshness rules.

    它不要求在查询前把每个来源数据集复制到一个永久存储中,但数据仍可能跨网络传输,并被交换、缓冲、溢写、暂存、缓存、记录或返回。每种中间工件都需要明确的授权、加密、保留、失效、删除、来源证明和新鲜度规则。

    What is query pushdown in federation?

    联邦中的查询下推是什么?

    Pushdown delegates supported operations such as predicates, projections, aggregates, joins, limits, or Top-N to a connected source. It can reduce transfer and coordinator work, but support varies by connector, source, version, expression, and query shape. Verify the actual EXPLAIN plan and source logs; never assume pushdown from a feature label.

    下推把连接来源支持的谓词、投影、聚合、连接、限制或Top-N等操作委派给来源执行,可以减少传输和协调器工作。但支持情况会因连接器、来源、版本、表达式与查询形状而异。必须检查实际EXPLAIN计划与来源日志,不能从功能标签推断。

    What happens when one federated query source fails?

    一个联邦查询来源失败时会发生什么?

    Follow a declared result policy. Fail closed when the source is mandatory or partial data could be unsafe; return an explicitly marked partial result only when policy and consumers allow it; or use an approved bounded cache or materialized fallback with visible observation time and coverage. Deadlines and cancellation must bound downstream source work.

    应遵循已声明结果策略。来源必需或部分数据可能不安全时关闭式失败;仅在策略与使用者允许时返回明确标记的部分结果;或使用带可见观察时间与覆盖的获批有边界缓存或物化回退。截止时间与取消必须限制下游来源工作。

    When should data be materialized instead of queried through federation?

    何时应物化数据而不是使用联邦查询?

    Prefer materialization, replication, or centralized integration when repeated high-volume scans, stable shared history, predictable latency, strict availability, common semantics, source isolation, or recurring heavy joins outweigh live access. A hybrid can materialize historical or expensive components while keeping small current dimensions live, provided time, coverage, precedence, and rollback are explicit.

    当重复高容量扫描、稳定共享历史、可预测延迟、严格可用性、统一语义、来源隔离或重复重连接的重要性高于实时访问时,应优先物化、复制或集中式集成。混合方案可以物化历史或昂贵组件,同时保持小型当前维度实时,但必须明确时间、覆盖、优先级和回滚。

    Official Sources and Verification Notes官方来源与验证说明

    These sources establish concrete behavior for their documented implementations. They do not establish one universal federated-query feature set. Verify the exact engine edition, connector and version, source and version, region, topology, identity path, query operators, type mappings, plan behavior, limits, failure semantics, availability, licensing, pricing, and commercial terms you will operate.

    这些来源为其记录的具体实现建立行为证据,但不建立通用联邦查询功能集。请针对计划运行的确切引擎版本、连接器及版本、来源及版本、区域、拓扑、身份路径、查询操作符、类型映射、计划行为、限制、故障语义、可用性、许可、定价和商业条款重新验证。