SQL Practice Logo

SQLPractice Online

Level 5 - SeniorOptimization Questions

Optimization: Avoid SELECT Star on Hot Path

Interviewer prompt: API only needs id, status, updated_at. Which query is better? Query A: SELECT * FROM tickets WHERE assignee_id = 42 AND status = 'OPEN' ORDER BY updated_at DESC LIMIT 50; Query B: SELECT ticket_id, status, updated_at FROM tickets WHERE assignee_id = 42 AND status = 'OPEN' ORDER BY updated_at DESC LIMIT 50;