probar cambiando pragmas

This commit is contained in:
Cat /dev/Nulo 2024-07-03 23:36:00 -03:00
parent 80a02da0e4
commit c4e11f05b6
2 changed files with 7 additions and 2 deletions

View file

@ -107,9 +107,11 @@ async fn main() {
)) ))
.unwrap() .unwrap()
.journal_mode(sqlx::sqlite::SqliteJournalMode::Wal) .journal_mode(sqlx::sqlite::SqliteJournalMode::Wal)
.pragma("journal_size_limit", "67108864")
.pragma("mmap_size", "134217728")
.synchronous(sqlx::sqlite::SqliteSynchronous::Normal) .synchronous(sqlx::sqlite::SqliteSynchronous::Normal)
.busy_timeout(Duration::from_secs(15)) .busy_timeout(Duration::from_secs(15))
.pragma("cache_size", "1000000000") .pragma("cache_size", "2000")
.optimize_on_close(true, None), .optimize_on_close(true, None),
) )
.await .await

View file

@ -22,10 +22,13 @@ impl Db {
.max_connections(1) .max_connections(1)
.connect_with( .connect_with(
SqliteConnectOptions::from_str(&format!("sqlite://{}", db_path))? SqliteConnectOptions::from_str(&format!("sqlite://{}", db_path))?
// https://fractaledmind.github.io/2023/09/07/enhancing-rails-sqlite-fine-tuning/
.journal_mode(sqlx::sqlite::SqliteJournalMode::Wal) .journal_mode(sqlx::sqlite::SqliteJournalMode::Wal)
.pragma("journal_size_limit", "67108864")
.pragma("mmap_size", "134217728")
.synchronous(sqlx::sqlite::SqliteSynchronous::Normal) .synchronous(sqlx::sqlite::SqliteSynchronous::Normal)
.busy_timeout(Duration::from_secs(15)) .busy_timeout(Duration::from_secs(15))
.pragma("cache_size", "1000000000") .pragma("cache_size", "2000")
.pragma("temp_store", "memory") .pragma("temp_store", "memory")
.optimize_on_close(true, None), .optimize_on_close(true, None),
) )