ck 每分钟查询数, 平均耗时, 最大耗时

kyaa111 3月前 ⋅ 507 阅读
with toStartOfInterval(event_time,toIntervalSecond(60))  As time_  
SELECT time_ , count(), avg(query_duration_ms), max(query_duration_ms) FROM system.query_log
WHERE event_time between '2024-01-01 00:00:00' and '2024-01-22 00:00:00' AND type='QueryFinish'
GROUP BY time_ ORDER BY count() DESC

结果示例

时间时间范围内的查询数平均耗时最大耗时
2024-01-19 04:03:00938374.363742939358421119
2024-01-19 04:02:00938174.363742939358421119