Commit 98352aa
perf(cdc-graph): bound cdc_batches scan and add composite index
The CDCGraph query range-joined generate_series ticks against
peerdb_stats.cdc_batches with no global lower bound on start_time, so the
planner could scan every batch for the flow across all history (via the
flow_name hash index) just to render a ~30-point graph.
Rewrite to pull the flow's batches for the window into a bounded CTE
(single scan) and keep the range join over that small set. Semantics are
unchanged, including calendar-correct month stepping.
Add a composite (flow_name, start_time) index so the bounded scan is a
single tight index range scan.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent cf1e119 commit 98352aa
2 files changed
Lines changed: 17 additions & 11 deletions
File tree
- flow/cmd
- nexus/catalog/migrations
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
253 | 253 | | |
254 | 254 | | |
255 | 255 | | |
256 | | - | |
257 | | - | |
258 | | - | |
259 | | - | |
260 | | - | |
261 | | - | |
262 | | - | |
263 | | - | |
264 | | - | |
265 | | - | |
266 | | - | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
267 | 272 | | |
268 | 273 | | |
269 | 274 | | |
| |||
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
0 commit comments