PostgreSQL|Beats 94%|Simple solution
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nSELECT a1.machine_id, round(AVG(a2.timestamp - a1.timestamp)::numeric, 3) processing_time\nFROM activity a1,\n     activity a2\nWHERE a1.activity_type = \'start\'\n  AND a2.activity_type = \'end\'\n  AND a1.machine_id = a2.machine_id\n  AND a1.process_id = a2.process_id\nGROUP BY a1.machine_id\n```
['PostgreSQL']