Unexpected Optimization
Problem is quite simple and can be express as 2  ways \nA) difference of total time in/out sum(out_time)-sum(in_time) as total_time\n\n\nselect event_day as day
Problem is quite simple and can be express as 2  ways \nA) difference of total time in/out `sum(out_time)-sum(in_time) as total_time`\n\n```\nselect event_day as day, emp_id, sum(out_time)-sum(in_time) as total_time\nfrom Employees\ngroup by event_day, emp_id\n```\nB) a total sum of difference for each row of out_time and in_time : `sum(out_time-in_time) as total_time`\n```\nselect event_day as day, emp_id, sum(out_time-in_time) as total_time\nfrom Employees\ngroup by event_day, emp_id\n```\n\nWhat is funny even the 2 approach are so similar the second approach is almos 2x faster in MySQL\n
[]