Using:
sqlx = { version = "0.6.2", features = ["runtime-tokio-native-tls", "mysql"] }
When I run the following code (in release mode) against a MySQL 8.0.31 server running on the same machine (no AUTO_COMMIT
):
let mut tx = pool.begin().await?;
for i in 0..1_000 {
let q = &format!("INSERT INTO tbl_abc(some_col) VALUES ({i})");
sqlx::query(q).execute(&mut tx).await?;
}
tx.commit().await?;
, it takes more than 40 seconds to complete (~40ms per record). Inserting fewer records, like 50-100 for example, is fine (~0.12 ms per record).
The size of the connection pool doesn't seem to matter (not that it should, but just something I tried out, just in case).