Fix N+1 query pattern in events findAll() #12

Closed
opened 2026-02-08 06:44:19 -08:00 by kyle · 1 comment
Owner

Context: events.service.ts findAll() fetches all events, then loops through each to enrich with additional VIP data, creating an N+1 query pattern.

File: backend/src/events/events.service.ts (lines 88-105)

Suggested fix:

  • Use Prisma include with nested selects to fetch all needed VIP data in the initial query
  • Eliminate the per-event enrichment loop

Effort: Small

**Context:** `events.service.ts` `findAll()` fetches all events, then loops through each to enrich with additional VIP data, creating an N+1 query pattern. **File:** `backend/src/events/events.service.ts` (lines 88-105) **Suggested fix:** - Use Prisma `include` with nested selects to fetch all needed VIP data in the initial query - Eliminate the per-event enrichment loop **Effort:** Small
Author
Owner

Refactored events to use Prisma includes instead of N+1 per-event enrichment loop.

Refactored events to use Prisma includes instead of N+1 per-event enrichment loop.
kyle closed this issue 2026-02-08 07:09:57 -08:00
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: kyle/vip-coordinator#12