1
SELECT COUNT(handle_code) AS triggerdaycount, SUM(CASE WHEN trigger_code IN (0, 200) AND handle_code = 0 THEN 1 ELSE 0 END) AS triggerdaycountrunning , SUM(CASE WHEN handle_code = 200 THEN 1 ELSE 0 END) AS triggerdaycountsuc FROM xxl_job_log WHERE trigger_time BETWEEN ? AND ?
xxl_job_log中超过一百万就引起CPU100% 单独弄个计数而非这样去统计,对于每秒触发的任务 日志将非常多,即使只保留三天也会存在问题 使用CASE WHEN 必将扫描所有