1# maddy & SQLite23SQLite is a perfect choice for small deployments because no additional4configuration is required to get started. It is recommended for cases when you5have less than 10 mail accounts.67**Note: SQLite requires DB-wide locking for writing, it means that multiple8messages can't be accepted in parallel. This is not the case for server-based9RDBMS where maddy can accept multiple messages in parallel even for a single10mailbox.**1112## WAL mode1314maddy forces WAL journal mode for SQLite. This makes things reasonably fast and15reduces locking contention which may be important for a typical mail server.1617maddy uses increased WAL autocheckpoint interval. This means that while18maintaining a high write throughput, maddy will have to stop for a bit (0.5-119second) every time 78 MiB is written to the DB (with default configuration it20is 15 MiB).2122Note that when moving the database around you need to move WAL journal (`-wal`)23and shared memory (`-shm`) files as well, otherwise some changes to the DB will24be lost.2526## Query planner statistics2728maddy updates query planner statistics on shutdown and every 5 hours. It29provides query planner with information to access the database in more30efficient way because go-imap-sql schema does use a few so called "low-quality31indexes".3233## Auto-vacuum3435maddy turns on SQLite auto-vacuum feature. This means that database file size36will shrink when data is removed (compared to default when it remains unused).3738## Manual vacuuming3940Auto-vacuuming can lead to database fragmentation and thus reduce the read41performance. To do manual vacuum operation to repack and defragment database42file, install the SQLite3 console utility and run the following commands:43```44sqlite3 -cmd 'vacuum' database_file_path_here.db45sqlite3 -cmd 'pragma wal_checkpoint(truncate)' database_file_path_here.db46```4748It will take some time to complete, you can close the utility when the49`sqlite>` prompt appears.