Skip to content

Reapply "Graph total bootstrap time" with fixes to postgres query #964

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

Merged

Conversation

tgnottingham
Copy link
Contributor

@tgnottingham tgnottingham commented Aug 11, 2021

Reapply #957 with fixes to postgres query. Fixes #961.

@tgnottingham
Copy link
Contributor Author

Diff from #957:

diff --git a/database/src/pool/postgres.rs b/database/src/pool/postgres.rs
index c2a67b65..27a4974a 100644
--- a/database/src/pool/postgres.rs
+++ b/database/src/pool/postgres.rs
@@ -359,11 +359,11 @@ impl PostgresConnection {
                 get_rustc_compilation: conn.prepare("
                         select aid, min(total)
                         from (
-                            select aid, sum(duration) as total
+                            select aid, cast(sum(duration) AS bigint) as total
                             from rustc_compilation
                             where aid = any($1)
-                            group by cid
-                        )
+                            group by aid, cid
+                        ) as duration_per_aid_cid
                         group by aid
                     ").await.unwrap(),
                 get_rustc_compilation_by_crate: conn.prepare("
  • as duration_per_aid_cid was required because subqueries must have an alias.
  • aid was added to the group by because it's just the correct thing.
  • cast was added because summing bigint durations produces a numeric duration, and we want an integer duration.

@tgnottingham tgnottingham force-pushed the reapply-graph-total-bootstrap-time branch from ccaf13b to 2c66989 Compare August 11, 2021 21:40
@tgnottingham tgnottingham mentioned this pull request Aug 11, 2021
Copy link
Member

@rylev rylev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ran this locally with postgres and it bootstrapped without error. 🚢

@rylev rylev merged commit 756a623 into rust-lang:master Aug 13, 2021
@tgnottingham tgnottingham deleted the reapply-graph-total-bootstrap-time branch August 14, 2021 22:09
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

Successfully merging this pull request may close these issues.

Reland #957
2 participants