Skip to content

Commit

Permalink
fix: disable slow query
Browse files Browse the repository at this point in the history
  • Loading branch information
PoiScript committed Jul 8, 2024
1 parent a33f083 commit b22e7bb
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 17 deletions.

This file was deleted.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion vtstats-database/stream_stats/add_stream_viewer_stats.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ ON CONFLICT (stream_id, time) DO UPDATE

crate::otel::execute_query!("INSERT", "stream_viewer_stats", query)?;

// viewer_avg = (SELECT AVG(count) FROM stream_viewer_stats WHERE stream_id = $2),
let query = sqlx::query!(
r#"
UPDATE streams
SET viewer_max = GREATEST(viewer_max, $1),
viewer_avg = (SELECT AVG(count) FROM stream_viewer_stats WHERE stream_id = $2),
updated_at = $3
WHERE stream_id = $2
"#,
Expand Down

0 comments on commit b22e7bb

Please sign in to comment.