perf(console): faster dashboard for organizations with thousands of monitors
ci / lint (push) Skipped
ci / test (push) Skipped
ci / build (push) Skipped
ci / image (push) Skipped
ci / lint (pull_request) Successful in 11m12s
ci / test (pull_request) Successful in 12m47s
ci / build (pull_request) Canceled after 1m41s
ci / image (pull_request) Canceled after 0s
ci / lint (push) Skipped
ci / test (push) Skipped
ci / build (push) Skipped
ci / image (push) Skipped
ci / lint (pull_request) Successful in 11m12s
ci / test (pull_request) Successful in 12m47s
ci / build (pull_request) Canceled after 1m41s
ci / image (pull_request) Canceled after 0s
- The range picker no longer looks for the first result: on the real-time daily aggregate that aggregated the organization's recent raw results on every request. The oldest monitor's creation bounds the ranges now. - Sorting worked out each row's key per comparison; it does so once now and moves each row once (40-60 ms to 5 ms for 3,500 monitors). - The queries behind the monitor list run in parallel. - The monitor API reads the latest results of the page's monitors only. - The dashboard reports its steps in a Server-Timing header and logs them when it takes a second or more. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017GpWAskjmYtZpuQ5JwYTX3
This commit is contained in:
1 parent
af992409ef
commit
ec33ef5c56
7 files changed
+145
-118
No files matched your search
@@ -125,23 +125,6 @@ FROM check_results_1d
|
||||
WHERE org_id = $1 AND monitor_id = $2
|
||||
GROUP BY 1, 2;
|
||||
|
||||
-- name: EarliestDataDaily :one
|
||||
-- The day the organization's monitors first reported, if any did.
|
||||
SELECT bucket::timestamptz AS first FROM check_results_1d WHERE org_id = $1 ORDER BY bucket LIMIT 1;
|
||||
|
||||
-- name: EarliestDataRecent :one
|
||||
-- When the organization's monitors first reported since $2, exactly: the
|
||||
-- first result of each monitor is found through its index, so the cost
|
||||
-- does not grow with the days of results.
|
||||
SELECT f.time FROM monitors m
|
||||
CROSS JOIN LATERAL (
|
||||
SELECT c.time FROM check_results c
|
||||
WHERE c.org_id = $1 AND c.monitor_id = m.id AND c.time >= $2
|
||||
ORDER BY c.time LIMIT 1
|
||||
) f
|
||||
WHERE m.org_id = $1
|
||||
ORDER BY f.time LIMIT 1;
|
||||
|
||||
-- name: FirstDataRecent :many
|
||||
-- When each region of a monitor first reported since $3, exactly. Used for
|
||||
-- data younger than the daily aggregate's resolution.
|
||||
|
||||
Reference in new issue
Block a user