Learning a few things about ru... Note
Julia Evans

Learning a few things about running SQLite

The author is sharing their experiences using SQLite with Django for websites. They initially believed SQLite was suitable for production on small sites but underestimated its complexity. A significant learning was the importance of the ANALYZE command for query performance, which drastically reduced query times. Without ANALYZE, a query took five seconds; with it, it dropped to milliseconds. The ANALYZE command provides statistics to the query planner for better decision-making.Database cleanup operations also presented challenges. Large DELETE operations could take over five seconds, causing other workers to time out and crash. The author's workaround is to perform cleanups in small batches, appreciating the multi-writer capabilities of databases like Postgres. They haven't yet focused on optimizing Django ORM queries, given their application's small database size.Backing up SQLite has been done using restic and more recently litestream for incremental backups. Both methods involve uploading to AWS, which the author finds tedious. They also note that SQLite allows for splitting tables across multiple database files, a technique they previously found helpful. Overall, the author finds it amusing how long it takes them to learn basic features of technologies they use, having only discovered ANALYZE recently.