Here's a puzzler for you:
I'm keeping stats of cluster computing stuff in a MySQL table named 'jobs'. Each job row has a host the job executed on (not unique), a job execution time in seconds, and a unique integer as the PK so I can order the completed jobs simply by ordering the PK.
As of right now, using average and group by, I can find the average execution time in seconds for each host over all of the jobs completed. Instead of averaging all the execution times per host, I want the average time of the last five jobs per host.
There's all sorts of examples for operations and group by, and lots of examples for operations with limit, but is there any way of combining the two in a fairly straightforward MySQL query?
EDIT: In the event that I'm not clear about it, I want the average five execution times for host 1, and the average five execution times for host 2, etc.