Improve run insert performance

This commit is contained in:
Joscha 2023-08-17 19:35:53 +02:00
parent 2d255f2e06
commit 874ba5add6

View file

@ -68,6 +68,12 @@ async fn save_work(
.execute(&mut *conn) .execute(&mut *conn)
.await?; .await?;
// Now that we know the commit exists, we can defer all other foreign key
// checks until the end of the transaction to improve insert performance.
sqlx::query!("PRAGMA defer_foreign_keys=1")
.execute(&mut *conn)
.await?;
for (metric, measurement) in run.measurements { for (metric, measurement) in run.measurements {
sqlx::query!( sqlx::query!(
"\ "\