Optimized queries in statistics.show_assignments_stats