Pysqlite tables in RAM

Fredrik Lundh fredrik at pythonware.com
Fri Sep 29 10:34:58 EDT 2006


Ranjitha wrote:

> I want to store my data in a database on the disk. I also want to be
> able to reload the tables into the RAM whenever I have a lot of disk
> accesses and commit the changes back to the database.

using the cache_size and synchronous pragmas sounds like a better way to 
trade reliability against speed/memory use.  e.g.

table_memory = 100000000 # bytes
cur.execute("pragma cache_size = %d;" % (table_memory / 1500))

...

cur.execute("pragma synchronous = off;")
# do lots of stuff
cur.execute("pragma synchronous = full;")

for more on this, see: http://www.sqlite.org/pragma.html

</F>




More information about the Python-list mailing list