# Learning a few things about running SQLite

DevFeed: [Learning a few things about running SQLite](<https://devfeed.tech/articles/learning-a-few-things-about-running-sqlite-21130.md>)

Original publisher: [Read original article](<https://jvns.ca/blog/2026/07/17/learning-about-running-sqlite/>)

Author: Julia Evans

Published: 2026-07-17T00:00:00Z

Content type: article

Language: en

Sources: [Julia Evans](<https://devfeed.tech/sources/julia-evans.md>)

Topics: [SQLite](<https://devfeed.tech/topics/sqlite.md>), [Django](<https://devfeed.tech/topics/django.md>), [Object-relational mapping](<https://devfeed.tech/topics/orm.md>), [Query (disambiguation)](<https://devfeed.tech/topics/query.md>), [Statistics](<https://devfeed.tech/topics/statistics.md>)

Tags: [blog](<https://devfeed.tech/tags/blog.md>), [django](<https://devfeed.tech/tags/django.md>), [orm](<https://devfeed.tech/tags/orm.md>), [search](<https://devfeed.tech/tags/search.md>), [sqlite](<https://devfeed.tech/tags/sqlite.md>), [statistics](<https://devfeed.tech/tags/statistics.md>)

## AI overview

A personal account of operating SQLite in production for a small Django website. The article describes how running ANALYZE dramatically improved an SQLite FTS5 query and discusses the difficulty of cleaning up large numbers of rows without blocking other database writers.

## Source excerpt

Hello! I've been working on a Django site recently, and I decided to use SQLite as the database. When I was getting started with using SQLite as database for a website I read a bunch of blog posts about how it is totally fine to use SQLite in production for a small site and I think it is totally fine, but what I did not fully appreciate is that SQLite is still a database, databases are complicated, and I do not know a lot about operating databases. So here are a couple of small things I've been learning about running SQLite. This is the 4th website I've used SQLite for, and I think this one is harder because with the power of the Django ORM I've been making the database do more work than I was previously without Django. I started by turning on WAL mode like all the blog posts said to do and hoping for the best. ANALYZE is apparently important Today I was running a query (using SQLite's FTS5 for full-text search) on a table with 4000 rows and it took 5 seconds. That seemed wrong to me: computers are fast! It turned out that what I needed to do was to run ANALYZE! Immediately the problem query went from taking 5 seconds to like 0.05 seconds (or some other number small enough that I didn't care to investigate further). I still don't know exactly what went wrong in the query plan, but my best guess is that it was some sort of accidentally quadratic thing. ANALYZE generates "statistics" (I guess about the number of rows in each table? and presumably other things?) so that the query planner can make better choices. Maybe one day I'll learn to read a query plan. cleaning up the database is tricky Occasionally I've run into situations where I accidentally put a bunch of rows in my database that I don't want to be there (for example completed tasks from django-tasks-db), and I want to clean them up. What's happened to me a few times in this case is: I run some kind of command to clean up the rows The command takes more than 5 seconds, since there are a lot of rows (though I