Skip to content

Commit 43409ed

Browse files
committed
Add documentation about performing manual queries on the DB
1 parent 8af0277 commit 43409ed

File tree

1 file changed

+58
-0
lines changed

1 file changed

+58
-0
lines changed

database/queries.md

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# Useful queries
2+
This document contains useful queries that should be performed manually in exceptional situations.
3+
4+
## Remove data for an artifact from the DB
5+
This is important for situations where there is some compilation error for a stable benchmark,
6+
with a stable release of the compiler. While this should be rare, it happens sometimes e.g. because
7+
of future incompatibility lints turning into errors.
8+
9+
The set of queries below show an example of removing the measured data and errors for the `html5ever`
10+
benchmark for Rust `1.69` and `1.70`.
11+
```sql
12+
-- Remove 1.69 and 1.70 html5ever data and errors
13+
-- Delete errors
14+
DELETE FROM error
15+
WHERE aid IN (
16+
SELECT id
17+
FROM artifact
18+
WHERE name IN ('1.69.0', '1.70.0') AND
19+
type = 'release'
20+
);
21+
22+
-- Delete collection records. This will enable `bench_published` to re-run the benchmarks.
23+
DELETE FROM collector_progress
24+
WHERE aid IN (
25+
SELECT id
26+
FROM artifact
27+
WHERE name IN ('1.69.0', '1.70.0') AND
28+
type = 'release'
29+
) AND step IN ('html5ever');
30+
31+
-- Note that there probably won't be any results in pstat, since the benchmark did not compile.
32+
-- But it's possible that some configurations of it have compiled before. To avoid skewing
33+
-- the average, we should thus still delete.
34+
35+
-- Delete compile benchmark data
36+
DELETE FROM pstat
37+
WHERE aid IN (
38+
SELECT id
39+
FROM artifact
40+
WHERE name IN ('1.69.0', '1.70.0') AND
41+
type = 'release'
42+
);
43+
44+
-- Delete runtime benchmark data
45+
DELETE FROM runtime_pstat
46+
WHERE aid IN (
47+
SELECT id
48+
FROM artifact
49+
WHERE name IN ('1.69.0', '1.70.0') AND
50+
type = 'release'
51+
);
52+
```
53+
54+
After running these queries, the benchmark should be fixed so that it is compilable again, and then
55+
the version should be re-benchmarked:
56+
```bash
57+
$ cargo run --bin collector bench_published <version>
58+
```

0 commit comments

Comments
 (0)