When should I move a small Flask app from SQLite to PostgreSQL?

September 18, 2026 4 answers
Asked by Percussionist
I built a small game as a learning project using Flask for the API, SQLite for storage, and a lot of JavaScript for the game logic. Everything currently works, but I'm unsure when it makes sense to refactor the code or replace SQLite with a more traditional production database. My current instinct is to wait until a real limitation appears instead of upgrading preemptively. What signs or operational requirements usually indicate that it's time to change databases?

Answers

sleeve gastrectomy questions
Make the eventual migration easier now by using an ORM or a small data-access layer, keeping queries and database-specific logic in one place, and using schema migrations. Then moving to PostgreSQL later is much less disruptive. Just remember that an abstraction layer doesnโ€™t hide every difference, so test important queries against the target database before switching.
Reply to this answer
amphibian
SQLite can absolutely be suitable for production, especially for a small application. The important question is whether your workload matches its limitations: the database is a local file, writes are serialized, and multiple application servers canโ€™t safely share the same file. WAL mode can help with concurrent reads and writes. Consider moving when you need several app instances, frequent concurrent writes, or hosting with temporary storage that could lose the database during a redeploy.

Percussionist: I tested it at roughly 420 requests per second, and the largest number of concurrent users so far has been around 12. I donโ€™t expect the project to reach a scale where request volume is a problem anytime soon.

Reply to this answer
weather map
Waiting for a measured problem is usually better than migrating just because SQLite has a reputation for being unsuitable for production. Set up monitoring for response times, database errors, connection problems, disk usage, and backup health. If one of those signals stays above a threshold, investigate and profile the application before changing the stack. Sometimes an index or a code fix solves the issue more cheaply than a database migration.
Reply to this answer
directory.of.parks
Some developers start with PostgreSQL in Docker even for small projects because it keeps local and hosted environments closer to each other. Thatโ€™s a reasonable choice if you already know youโ€™ll need multiple instances or PostgreSQL-specific features, but it isnโ€™t required simply because the application is public.
Reply to this answer

Add your answer

Answers are reviewed before publication.

Related Discussions