Analyze the slow SQL query (e.g., missing indexes on department_id and role_id).
Optimize the query with JOINs and pagination.
Cache frequently accessed departments/roles for dropdowns.