python+sqlite3 in memory database

John Nagle nagle at animats.com
Mon Aug 30 16:50:36 EDT 2010


On 8/30/2010 12:00 PM, Benjamin Peterson wrote:
> Denis Gomes<denisg640<at>  gmail.com>  writes:
>
>>
>> Eventually my goal is to dynamically load and unload sections of a file based
> database (could be tables or rows) in and out of memory for effeciency purposes.
>
> Have you actually found this to be an useful optimization? SQLite already
> internally caches database information in memory.

    In general, if you find yourself concerned about sqlite performance,
it's time to move to MySQL or Postgres.  "sqlite" is for simple,
lightweight databases mostly accessed by one process at a time.
You store your program's configuration options in sqlite.  You
store your web site's business transactions in MySQL.

    "sqlite" has reasonably good SELECT performance on simple indices,
but anything beyond that isn't all that great.  Multiple processes
updating the same sqlite database will have terrible performance,
because the locking mechanism not only locks the entire table,
the wait mechanism is a timed retry.

				John Nagle



More information about the Python-list mailing list