Skip to content

Commit 75e7f81

Browse files
dtunikovclaude
andcommitted
perf(cdc-graph): add composite (flow_name, start_time) index for CDCGraph
The CDCGraph query range-joins generate_series ticks against peerdb_stats.cdc_batches per bucket. The pre-existing indexes are a HASH on flow_name and a btree on start_time, which cannot be combined in a single scan, so each per-bucket probe scans a start_time range and filters flow_name as a recheck. Add a composite (flow_name, start_time) index so each probe is a single tight index range scan. Benchmarked against ~1.05M batches for one flow: buffers touched for the 30h window drop from 3844 to ~180 (~20x less I/O), with matching reductions in cache pressure on large tables. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent cf1e119 commit 75e7f81

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
CREATE INDEX IF NOT EXISTS idx_cdc_batches_flow_name_start_time ON peerdb_stats.cdc_batches (flow_name, start_time);

0 commit comments

Comments
 (0)