perf: Performance optimalisaties (4 iteraties)
Iteratie 1 - Parallel Fetching: - Patient dashboard: Promise.all voor 3 data fetches - Resultaat: ~45% sneller (800ms → 440ms) Iteratie 2 - Loading States: - Skeleton loaders voor EPD, patient, agenda, rapportage - Betere perceived performance tijdens laden Iteratie 3 - Lazy Load FullCalendar: - Dynamic import met next/dynamic (ssr: false) - ~150KB minder in initiële bundle Iteratie 4 - Reports API Optimalisatie: - Selectieve kolommen (10 i.p.v. 20) - Server-side pagination (limit/offset) - Database indexes voor timeline queries - Resultaat: 89% sneller (1671ms → 188ms) Overige fixes: - Type casts voor Json → Behandelstructuur/SmartGoal/etc. - Metadata template fix in layout.tsx Documentatie: - docs/audit-rapport.md - PO-vriendelijk audit rapport - docs/performance/baseline-2025-12-12.md - Metingen + resultaten 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
19
supabase/migrations/20251212_add_reports_timeline_index.sql
Normal file
19
supabase/migrations/20251212_add_reports_timeline_index.sql
Normal file
@@ -0,0 +1,19 @@
|
||||
-- Add optimized index for reports timeline queries
|
||||
-- This covering index speeds up the most common query pattern:
|
||||
-- SELECT id, type, content, shift_date, ... FROM reports
|
||||
-- WHERE patient_id = ? AND deleted_at IS NULL
|
||||
-- ORDER BY created_at DESC
|
||||
|
||||
-- Composite index for timeline queries with included columns
|
||||
CREATE INDEX IF NOT EXISTS idx_reports_timeline
|
||||
ON reports(patient_id, created_at DESC)
|
||||
WHERE deleted_at IS NULL;
|
||||
|
||||
-- Index for type filtering (used when filtering by report types)
|
||||
CREATE INDEX IF NOT EXISTS idx_reports_patient_type
|
||||
ON reports(patient_id, type)
|
||||
WHERE deleted_at IS NULL;
|
||||
|
||||
-- Note: PostgreSQL doesn't support INCLUDE clause in partial indexes,
|
||||
-- so we use a standard composite index. The query planner will use
|
||||
-- these indexes for the filtered queries.
|
||||
Reference in New Issue
Block a user