--- name: "Performance Profiling" description: "Identify database index gaps, slow queries, or CPU-bound visual rendering bottlenecks" --- # Skill: Performance Profiling ## 1. Purpose Ensure latency metrics remain low, identifying slow database queries, page rendering blocks, or unoptimized static bundles. ## 2. When to Use When API endpoints or page transition latencies exceed 300ms. ## 3. Preconditions * Access to execution profiling wrappers or database diagnostic logs. ## 4. Step-by-Step Checklist 1. Enable database query logs to identify slow queries (unindexed lookups). 2. Review network tabs for large asset transfers. 3. Analyze query plans using `EXPLAIN`. 4. Implement performance patches (adding indexing, query eager-loading, or pagination). ## 5. Validation Checklist * API response latencies drop below 200ms. * Query plan confirms index is used correctly. ## 6. Examples ```sql -- Optimizing booking queries: CREATE INDEX idx_bookings_technician ON service_bookings(technician_id, booking_date); ``` ## 7. Failure Cases * Adding indices indiscriminately to database tables, increasing write overhead latencies.