You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/performance/SQLITE_COMPARISON.md
+46-1Lines changed: 46 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -39,8 +39,53 @@ We addressed the gaps via the following optimizations:
39
39
2.**Pinned Page Iteration**: Modifying our `HeapTable::Iterator` to hold pages pinned across slot iteration avoids repetitive atomic checks and LRU updates per-row.
40
40
3.**Batch Insert Mode**: Skipping single-row undo logs and exclusive locks to exploit pure in-memory bump allocation. This drove the `INSERT` speedup well past SQLite limits, as we write raw tuples uninterrupted.
41
41
42
-
## 6. Future Roadmap
42
+
## 6. Post-Optimization Enhancements
43
+
We addressed the gaps via the following optimizations:
44
+
1.**Buffer Pool Bypass (`fetch_page_by_id`)**: Reduced global std::mutex latch contention by explicitly caching ID lookups, yielding a ~30% improvement in scan logic.
45
+
2.**Pinned Page Iteration**: Modifying our `HeapTable::Iterator` to hold pages pinned across slot iteration avoids repetitive atomic checks and LRU updates per-row.
46
+
3.**Batch Insert Mode**: Skipping single-row undo logs and exclusive locks to exploit pure in-memory bump allocation. This drove the `INSERT` speedup well past SQLite limits, as we write raw tuples uninterrupted.
Distributed shuffle joins send **all tuples** across the network to partitioned nodes, even when many will never match. This causes unnecessary network traffic and buffer memory usage.
52
+
53
+
### Solution: Bloom Filter Integration
54
+
Implemented bloom filters to filter tuples at the source before network transmission:
55
+
-**One-sided bloom filter**: Built from the inner/right table, applied to filter the outer/left table
56
+
-**Distributed construction**: Each data node builds bloom filter locally during its scan phase
57
+
-**Coordinator coordination**: `BloomFilterPush` RPC broadcasts filter metadata to all nodes
58
+
59
+
### Architecture
60
+
```
61
+
[Phase 1: Shuffle Left] [Phase 2: Shuffle Right]
62
+
| |
63
+
v v
64
+
Build local bloom Apply bloom filter
65
+
from join keys before buffering
66
+
| |
67
+
+---- BloomFilterPush ----->---+
68
+
(filter metadata) |
69
+
v
70
+
Filtered tuples buffered
71
+
```
72
+
73
+
### Key Components
74
+
| Component | Location | Purpose |
75
+
|-----------|----------|---------|
76
+
|`BloomFilter` class |`include/common/bloom_filter.hpp`| MurmurHash3-based bloom filter |
77
+
|`BloomFilterArgs` RPC |`include/network/rpc_message.hpp`| Serialization for network transfer |
78
+
|`ClusterManager` storage |`include/common/cluster_manager.hpp`| Stores bloom filter per context |
79
+
|`PushData` handler |`src/main.cpp`| Applies bloom filter before buffering |
80
+
| Coordinator |`src/distributed/distributed_executor.cpp`| Broadcasts filter after Phase 1 |
Added probabilistic filtering to reduce network traffic in shuffle joins.
30
+
-**MurmurHash3-based BloomFilter**: Configurable false positive rate (default 1%) with optimal bit count and hash function calculation.
31
+
-**Filter Construction**: Built during Phase 1 scan, stored in `ClusterManager` per context.
32
+
-**Filter Application**: `PushData` handler checks `might_contain()` before buffering, skipping tuples that will definitely not match.
33
+
27
34
## Lessons Learned
28
35
- Shuffle joins significantly reduce network traffic compared to broadcast joins for large-to-large table joins.
29
36
- Fine-grained locking in the shuffle buffers is critical for maintaining high throughput during the redistribution phase.
37
+
- Bloom filters provide significant network traffic reduction when join selectivity is low, at the cost of a small false positive rate (typically <1%).
30
38
31
39
## Status: 100% Test Pass
32
40
Verified the end-to-end shuffle join flow, including multi-node data movement and final result merging, through automated integration tests.
41
+
- 10 unit tests for bloom filter implementation and integration (`tests/bloom_filter_test.cpp`)
0 commit comments