SELECT domain, ROUND(AVG(totalTimeMs), 3) as averageTotalTime, COUNT(*) as requests, strftime('%s', started)/(5*60) as "timeWindow" FROM log GROUP BY domain, strftime('%s', started) / (5 * 60) ORDER BY started desc;