SQLite Forum

Tips for getting SQLite under Python to perform better with more RAM?
Login
I'm interested in getting better performance out of SQLite on machines with more RAM, using the Python `sqlite3` module from the standard library.

(Tips for more CPUs would be useful too - I'm interested in understanding what the benefits of paying for larger EC2 instances are, in addition to maximizing performance against currently available memory.)

I've seen [PRAGMA cache_size](https://www.sqlite.org/pragma.html#pragma_cache_size) in the documentation - is this the main lever I should be looking at or are there other options that might help here?

My current plan is to set up a simple load test that exercises my Python + SQLite code across a number of different queries, then modify the cache_size and see what impact that has on requests/second and request durations.

I'd thoroughly appreciate any advice on ways to scale SQLite up like this.

Most of my workloads are read-only (I open the SQLite file with the `?mode=ro` or `?immutable=1` flags) so I'm mainly interested in improving performance of SELECTs against read-only databases.