Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Slow stats query #368

Open
t-aleksander opened this issue Jan 7, 2025 · 0 comments
Open

Slow stats query #368

t-aleksander opened this issue Jan 7, 2025 · 0 comments

Comments

@t-aleksander
Copy link
Contributor

slow statement: execution time exceeded alert threshold summary="WITH cte AS (SELECT …" db.statement="\n\nWITH cte AS (SELECT id, location_id, COALESCE(upload - LAG(upload) OVER (PARTITION BY location_id ORDER BY collected_at), 0) upload, COALESCE(download - LAG(download) OVER (PARTITION BY location_id ORDER BY collected_at), 0) download, last_handshake, strftime($1, collected_at) collected_at, listen_port, persistent_keepalive_interval FROM location_stats ORDER BY collected_at LIMIT -1 OFFSET 1) SELECT id, location_id, SUM(MAX(upload, 0)) \"upload!: i64\", SUM(MAX(download, 0)) \"download!: i64\", last_handshake, collected_at \"collected_at!: NaiveDateTime\", listen_port \"listen_port!: u32\", persistent_keepalive_interval \"persistent_keepalive_interval?: u16\" FROM cte WHERE location_id = $2 AND collected_at >= $3 GROUP BY collected_at ORDER BY collected_at LIMIT $4\n" rows_affected=0 rows_returned=0 elapsed=4.492956834s elapsed_secs=4.492956834 slow_threshold=1s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant