I have a Pylons application using SQLAlchemy with SQLite as backend. I would like to know if every read operation going to SQLite will always lead to a hard disk read (which is very slow compared to RAM) or some caching mechanisms are already involved.
- does SQLite maintain a subset of the database in RAM for faster access ?
- Can the OS (Linux) do that automatically ?
- How much speedup could I expect by using a production database (MySQL or PostgreSQL) instead of SQLite?
Yes, SQLite has its own memory cache. Check
PRAGMA cache_sizefor instance. Also, if you’re looking for speedups, checkPRAGMA temp_store. There is also API for implementing your own cache.The SQLite database is just a file to the OS. Nothing is ‘automatically’ done for it. To ensure caching does happen, there are
sqlite.hdefines and runtime pragma settings.It depends, there are a lot of cases when you’ll get a slowdown instead.