api: run compute duration by resource on SQL backend

Change-Id: Id5aa0bc2b24bb7d3e521d51b2b7777b99ea418e5
Signed-off-by: Julien Danjou <julien@danjou.info>
Merge "api: run compute duration by resource on SQL backend"