Skip to content

Commit

Permalink
fix(prover): Fix statistic query (#193)
Browse files Browse the repository at this point in the history
# What ❔

Fix extremly expensive query

## Why ❔
It could overload our database

## Checklist

<!-- Check your PR fulfills the following items. -->
<!-- For draft PRs check the boxes as you complete them. -->

- [ ] PR title corresponds to the body of PR (we generate changelog
entries from PRs).
- [ ] Tests for the changes have been added / updated.
- [ ] Documentation comments have been added / updated.
- [ ] Code has been formatted via `zk fmt` and `zk lint`.

Signed-off-by: Danil <[email protected]>
  • Loading branch information
Deniallugo authored Oct 11, 2023
1 parent c175033 commit 5499093
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 30 deletions.
60 changes: 30 additions & 30 deletions core/lib/dal/sqlx-data.json
Original file line number Diff line number Diff line change
Expand Up @@ -4031,36 +4031,6 @@
},
"query": "UPDATE l1_batches SET eth_commit_tx_id = $1, updated_at = now() WHERE number BETWEEN $2 AND $3"
},
"57b4e8fb728f1e90dc5ed80c1493471f8e9eff828c99eadc531b28a068ade83e": {
"describe": {
"columns": [
{
"name": "count!",
"ordinal": 0,
"type_info": "Int8"
},
{
"name": "circuit_type!",
"ordinal": 1,
"type_info": "Text"
},
{
"name": "status!",
"ordinal": 2,
"type_info": "Text"
}
],
"nullable": [
null,
false,
false
],
"parameters": {
"Left": []
}
},
"query": "\n SELECT COUNT(*) as \"count!\", circuit_type as \"circuit_type!\", status as \"status!\"\n FROM prover_jobs\n GROUP BY circuit_type, status\n "
},
"580d973b404123108e8e8b27cd754f108a289e1556da10a466e4c795fbd23ddf": {
"describe": {
"columns": [],
Expand Down Expand Up @@ -9007,6 +8977,36 @@
},
"query": "\n UPDATE contract_verification_requests\n SET status = 'failed', updated_at = now(), error = $2, compilation_errors = $3, panic_message = $4\n WHERE id = $1\n "
},
"cfd2ce8eb6997b7609090b4400e1bc42db577fdd3758248be69d3b5d9d132bf1": {
"describe": {
"columns": [
{
"name": "count!",
"ordinal": 0,
"type_info": "Int8"
},
{
"name": "circuit_type!",
"ordinal": 1,
"type_info": "Text"
},
{
"name": "status!",
"ordinal": 2,
"type_info": "Text"
}
],
"nullable": [
null,
false,
false
],
"parameters": {
"Left": []
}
},
"query": "\n SELECT COUNT(*) as \"count!\", circuit_type as \"circuit_type!\", status as \"status!\"\n FROM prover_jobs\n WHERE status <> 'skipped' and status <> 'successful' \n GROUP BY circuit_type, status\n "
},
"d0ff67e7c59684a0e4409726544cf850dbdbb36d038ebbc6a1c5bf0e76b0358c": {
"describe": {
"columns": [
Expand Down
1 change: 1 addition & 0 deletions core/lib/dal/src/prover_dal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,7 @@ impl ProverDal<'_, '_> {
r#"
SELECT COUNT(*) as "count!", circuit_type as "circuit_type!", status as "status!"
FROM prover_jobs
WHERE status <> 'skipped' and status <> 'successful'
GROUP BY circuit_type, status
"#
)
Expand Down

0 comments on commit 5499093

Please sign in to comment.