← Back to Technical blog

Technical article

Joining Across Sources Without Moving Fact Rows: Three Layers of Heterogeneous Filtering

Compare unified compute, federation, and candidate-key filtering for cross-source joins, permissions, and snapshot consistency.

Nov 26, 2026Technical blogHENGSHI9 min read
BIFederated QueryData Integration

Article body

Full article

Orders live in a transactional database and customer tags in the CRM. The business wants monthly net sales for East China VIP customers. One option is to move the detail into the existing warehouse and calculate against a common model. Another passes only the necessary keys for a query. The CRM selects customers and the transactional database filters and aggregates locally. This transfers fewer order records while still requiring keys and values to cross sources, appropriate permissions, and an execution budget.

1 Compare three engineering approaches

ApproachCompute and data movementConditions worth evaluating first
Unified warehouse or analytics engineSync the necessary datasets to a common compute location and join themExact joins between large tables, high concurrency, or a consistent snapshot
Federated query or data virtualizationThe engine distributes queries and pushes down supported operationsConnector support, network, and cross-source join costs
Select candidate keys, then filter in the fact databaseCRM selects a small set of keys and the fact database filters and aggregates locallySelective dimension filtering, usable indexes, and permission to transfer keys

Cross-source joins in federation or virtualization depend on the engine and connectors. Freshness depends on source refreshes, snapshot consistency, external caches, and run windows. For closed-period reconciliation, a reusable snapshot makes verification easier than querying live tables each time.

2 Coordinate heterogeneous filtering across three layers

The dimension source selects candidate keys

The CRM filters by tenant, region, VIP status, and the effective date of the tag, returning unique permitted customer identifiers. Historic reports should use customer tags as of an agreed date. Applying today’s tags to last year’s sales can change attribution. If the dashboard already defines the cohort, check that CRM filtering follows the same rules.

The fact source aggregates locally

The transaction database filters facts by candidate keys, month, and authorized region, then aggregates according to the metric definition. The host can bind parameters for a short list. For a larger list, evaluate key transfer volume, parameter limits, and index coverage before deciding whether to sync an approved small dimension or key set to shared compute. Handle incomplete lists, duplicate keys, and connection errors explicitly. Financial and performance metrics need complete calculations under a defined rule.

The coordination layer aligns formats, snapshots, and evidence

Record the tenant, business month, tag snapshot, and order batch. Additive amounts from disjoint partitions can be combined. Unique counts across partitions need mergeable state or recalculation in a common location. If sources can only be queried at different points in time, show their data dates and switch to closed snapshots when exact reconciliation is necessary.

3 A SQL example with explicit boundaries

This fact-database example takes the tenant and month boundaries as the first three parameters and two validated, deduplicated CRM keys as the last two. The host generates the corresponding number of placeholders and binds them through the driver. An empty key list yields an empty result. This example uses signed amounts. Adapt the amount and business date fields to the applicable rules.

SELECT region_code, SUM(net_amount) AS vip_net_sales
FROM sales_fact
WHERE tenant_id = ?
  AND business_date >= ?
  AND business_date < ?
  AND customer_id IN (?, ?)
GROUP BY region_code;

If CRM returns A and B, A has a valid 700-yuan sale and a −100-yuan refund, B has 300 yuan, and C has 400 yuan, the example returns 900 yuan for one shared region. Giving A two address records must still produce one candidate key. An identically named customer in another tenant must remain outside the fact query.

Design partitioning and caching for the actual query

If keys are sent in batches, partitions must be disjoint or have reliable deduplication. Keep the snapshot and filters consistent when merging. For cross-source sorting and Top N, evaluate staged aggregation before ranking on a common definition. If an entity can appear in several partitions, merge its metrics or deduplication state before computing the global rank or count.

Cache keys can include business period, tag snapshot, metric definition, tenant, and permissions. Closed batches can be retained longer. Define invalidation for live tags, daily inventory, and access changes. Source DBAs should be able to see peak concurrency. Parallel requests may improve latency and increase load on transactional systems, so agree on budgets using measurements.

4 Select a supported path in HENGSHI SENSE

The HENGSHI manual documents Multi-Table Join for datasets from the same source. For datasets from different sources, enable the acceleration engine as documented and join within that engine. If orders and tags are already prepared in a common database, connect to it, select join keys and join type, and preview the results. If the sources remain separate and the candidate-key technique is required, implement it in the source, an external federation service, or business orchestration. HENGSHI SENSE can consume the results through the configured connection.

HENGSHI SENSE documentation showing the join keys and join-type choices in Multi-Table Join

HENGSHI product documentation | Configuring join fields and join type in Multi-Table Join

Business use still requires datasets, common metrics, and permissions. Start with VIP net sales, regional trends, and batch documentation, then verify them in the operating application. For embedding in ERP or CRM, software vendors can reuse governed data and metrics through HENGSHI BI PaaS and the Powered by HENGSHI partnership model. Verify identity, data scope, and publication in the host application.

Choose a maintainable production path

Run a proof of concept with the same data using source-side filtering and a unified engine. Reconcile before comparing transfer volume and latency. Historical orders cleansed in a warehouse can use the common model. For live investigations, evaluate light source queries separately. Hot and cold partitioning depends on access frequency, source SLAs, historical attribution snapshots, and recovery needs. Identify the owners of the source tables, tag rules, and acceleration plans.

5 Verify performance and correctness

TestOperationEvidence
Candidate key volumeRun small, medium, and large examplesKey counts, transfer volume, and source scan and plan
Join correctnessAdd a duplicate tag, a null key, and a cross-tenant orderReconcile with a fixed snapshot and verify deduplication and permissions
Cache and refreshRepeat a request, then change the tag snapshot or accountCheck that data batch and access scope update
Failure and source loadTest a timeout and run under normal concurrencyP95, source times, resource peaks, and recovery path

A unified engine is worth evaluating first for low-selectivity filtering, two large fact tables, strict snapshot consistency, or high concurrency. Source filtering suits a small candidate set and a light query. Compare results and costs with the same examples on real connections before choosing where to compute and whether scheduled synchronization is worthwhile.

About HENGSHI

Founded in 2016, HENGSHI develops Agentic BI for the Data + AI era. Its enterprise analytics platform, HENGSHI SENSE, works with the HENGSHI JARVIS digital employee, the HENGSHI CLI execution engine, and the privately deployable HENGSHI BOX. With a decade in BI and a Powered by Hengshi partner ecosystem, HENGSHI supports software vendors across industries and provides private, trusted AI analytics for business operations and decision-making in manufacturing, finance, retail, public services, and other enterprise settings.

HENGSHI SENSE

Resources, ecosystem, and implementation stories

Explore how teams design and ship analytics with HENGSHI.

Request a trial

Enterprise deployment, embedded delivery, and trial requests can all be handled quickly.