Federated queries
One of FeatureQL's core strengths is its ability to federate data from multiple heterogeneous sources within a single query. This enables building features that span across databases, caches, APIs, and other data systems seamlessly.
Cross-source data federation
This powerful example demonstrates federated querying across multiple data sources:
Data sources involved:
- Redis: Contains order details (
order:*
keys with JSON data) - PostgreSQL: Contains customer information with last order references
- FeatureQL: Orchestrates the join between these sources
Federation workflow:
- Customer lookup: Query PostgreSQL for customer details and
last_order_id
- Order enrichment: Use the
last_order_id
to fetch order details from Redis - Cross-source join:
ADD_FIELDS()
links Redis order data to PostgreSQL customer data - Type-safe binding: Entity annotations (
BIGINT#ORDERS
,BIGINT#CUSTOMERS
) ensure referential integrity
Key federation features:
- Multi-source joins: Combine data from different storage systems
- Type safety: Entity relationships are preserved across sources
- Performance: Each source is queried optimally using its native access patterns
On this page