Join Types
Stream-to-Stream Joins
Join two streams together for real-time correlation:Stream-to-Table Joins
Join a stream with historical data using thetable() function:
JOIN Syntax
INNER JOIN
Return only matching records from both sides:LEFT JOIN
Return all records from left stream, with matching records from right:right_stream, columns from B will be NULL.
RIGHT JOIN
Return all records from right stream, with matching records from left:FULL OUTER JOIN
Return all records from both streams:Streaming Join Semantics
Time-based Correlation
Stream-to-stream joins correlate events based on event time:Join State Management
Streaming joins maintain internal state:- Events from both streams are buffered
- Matches are emitted as correlations are found
- State is retained based on time or memory limits
- Old events may be evicted from join state
Table Join for Enrichment
Static Reference Data
Enrich streams with static reference data:Dictionary Lookups
Join with dictionaries for fast enrichment:Complex Join Conditions
Multiple Join Keys
Additional Filter Conditions
Window Joins
Joining Windowed Aggregations
Join with table() for Historical Window Analysis
Subquery Joins
Filtered Subquery Join
Aggregated Subquery Join
Performance Considerations
Join Settings
Control join behavior with settings:Seek to Earliest
Process historical data in joins:Complete Join Examples
Real-time Order Payment Correlation
User Activity Enrichment
Multi-Stream Correlation
Window-based Join Analysis
Best Practices
Choose appropriate join type
Choose appropriate join type
- Use INNER JOIN when you only need matching records
- Use LEFT JOIN when left stream is primary and right is optional
- Use table() function for joining with static reference data
Optimize join keys
Optimize join keys
- Join on indexed columns when possible
- Use equality conditions for best performance
- Consider data distribution when choosing join keys
Manage join state
Manage join state
Stream-to-stream joins maintain state:
- Consider memory implications for long-running joins
- Use time-based filters to limit state retention
- Monitor join state size in production
Use window joins for temporal correlation
Use window joins for temporal correlation
When correlating time-series data:
Next Steps
Time Windows
Use time-based windows with joins
Aggregations
Aggregate joined data
Materialized Views
Materialize join results