Commit 8fb6414
fix: eliminate N+1 queries in _load_candidate_sessions event_type filter (#132)
Replace the Python loop that issued one SQL query per session when
filtering by event_type with a single IN subquery pushed into the
initial session SELECT. Query count drops from O(n) to O(1) regardless
of the number of candidate sessions.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>1 parent 9f4328e commit 8fb6414
1 file changed
Lines changed: 13 additions & 18 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
315 | 315 | | |
316 | 316 | | |
317 | 317 | | |
318 | | - | |
319 | | - | |
320 | | - | |
321 | | - | |
| 318 | + | |
| 319 | + | |
322 | 320 | | |
323 | | - | |
324 | | - | |
325 | | - | |
326 | | - | |
327 | | - | |
328 | | - | |
329 | | - | |
330 | | - | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
331 | 325 | | |
332 | 326 | | |
333 | | - | |
334 | | - | |
335 | | - | |
336 | | - | |
337 | | - | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
338 | 332 | | |
339 | | - | |
| 333 | + | |
| 334 | + | |
340 | 335 | | |
341 | 336 | | |
342 | 337 | | |
| |||
0 commit comments