mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
fix: filter session count sums by created_at (#6529)
Fixes the session totals being waaaaay too high!
This commit is contained in:
@@ -70,7 +70,7 @@ WITH agent_stats AS (
|
||||
coalesce(SUM(session_count_reconnecting_pty), 0)::bigint AS session_count_reconnecting_pty
|
||||
FROM (
|
||||
SELECT *, ROW_NUMBER() OVER(PARTITION BY agent_id ORDER BY created_at DESC) AS rn
|
||||
FROM workspace_agent_stats
|
||||
FROM workspace_agent_stats WHERE created_at > $1
|
||||
) AS a WHERE a.rn = 1
|
||||
)
|
||||
SELECT * FROM agent_stats, latest_agent_stats;
|
||||
|
||||
Reference in New Issue
Block a user