piskvorky / sqlitedict

Persistent dict, backed by sqlite3 and pickle, multithread-safe.
Apache License 2.0
1.17k stars 131 forks source link

autocommit = off/on. #81

Closed sionking closed 6 years ago

sionking commented 6 years ago

When I do autocommit on, will it retrieve the data from disk or from memory? If I want to retrieve last 1000 values from memory and the rest from disk, should I commit once in 1000 new values ?

In general what is the memory consumption of the dict in RAM ?

piskvorky commented 6 years ago

Nothing is stored in memory, sqlite is a disk (file) based database.

A transaction is committed to disk with commit(), or after each operation if you have autocommit on.

See the official sqlite docs about the commit semantics (sqlitedict is just a wrapper for sqlite).

sionking commented 6 years ago

But what will happen if I add 10 new keys to the dict, with autocommit off, Will those keys be in-memory? accessing them is like accessing memory not disk ?

piskvorky commented 6 years ago

Sqlitedict will do whatever Sqlite itself does -- there's no additional transactional logic on top. See the link above, or ask at the Sqlite forum if in doubt.