Skip to content

Commit

Permalink
Cache prepared SQL statements
Browse files Browse the repository at this point in the history
We don't synthesize SQL on the fly and have a relatively small set of active
queries, so this hopefully will provide a nice perf improvement.
  • Loading branch information
Mark-Simulacrum committed Mar 8, 2022
1 parent 2459c60 commit 51d7e34
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/db/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ pub trait QueryUtils {
fn execute(&self, sql: &str, params: &[&dyn ToSql]) -> Fallible<usize> {
self.with_conn(|conn| {
self.trace(sql, || {
let mut prepared = conn.prepare(sql)?;
let mut prepared = conn.prepare_cached(sql)?;
let changes = prepared.execute(params)?;
Ok(changes)
})
Expand Down

0 comments on commit 51d7e34

Please sign in to comment.