Skip to main content

Module join

Module join 

Source
Expand description

JOIN Executor Algorithms

Provides multiple join strategies for different scenarios:

  • Hash Join: O(n+m) for equi-joins, best for large datasets
  • Nested Loop Join: O(n*m) fallback, works with any condition
  • Merge Join: O(n log n + m log m) for sorted inputs

§Architecture

┌─────────────────────────────────────────────────────────────┐
│                    JoinExecutor                              │
├─────────────────────────────────────────────────────────────┤
│  ┌───────────┐  ┌───────────────┐  ┌─────────────────────┐  │
│  │ Hash Join │  │ Nested Loop   │  │   Merge Join        │  │
│  │  (fast)   │  │  (fallback)   │  │   (sorted)          │  │
│  └─────┬─────┘  └───────┬───────┘  └──────────┬──────────┘  │
│        │                │                      │             │
│        └────────────────┼──────────────────────┘             │
│                         ▼                                    │
│              ┌──────────────────────┐                        │
│              │   JoinPlanner        │                        │
│              │   (cost-based)       │                        │
│              └──────────────────────┘                        │
└─────────────────────────────────────────────────────────────┘

Structs§

JoinStats
Statistics for choosing join strategy

Enums§

JoinCondition
Join condition for filtering matches
JoinStrategy
Strategy to use for executing the join
JoinType
Type of JOIN operation

Functions§

choose_strategy
Choose optimal join strategy based on statistics
execute_join
Execute a join operation using the optimal strategy
hash_join
Execute a hash join
merge_join
Execute a merge join (for sorted inputs)
nested_loop_join
Execute a nested loop join (O(n*m) but works with any condition)