This is an easy 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 \n    a1.machine_id,\n    ROUND(AVG(CAST(a2.timestamp - a1.timestamp AS DECIMAL)), 3) AS processing_time\nFROM \n    activity a1\nJOIN \n    activity a2 ON a1.machine_id = a2.machine_id \n                AND a1.process_id = a2.process_id\n                AND a1.activity_type = \'start\'\n                AND a2.activity_type = \'end\'\nGROUP BY \n    a1.machine_id;\n\n\n```
['PostgreSQL']