Dictionary or Database—Please advise
aahz at pythoncraft.com
Fri Feb 26 23:46:36 CET 2010
In article <891a98fa-c398-455a-981f-bf72af77256c at s36g2000prh.googlegroups.com>,
Jeremy <jlconlin at gmail.com> wrote:
>I have lots of data that I currently store in dictionaries. However,
>the memory requirements are becoming a problem. I am considering
>using a database of some sorts instead, but I have never used them
>before. Would a database be more memory efficient than a dictionary?
>I also need platform independence without having to install a database
>and Python interface on all the platforms I'll be using. Is there
>something built-in to Python that will allow me to do this?
If you're serious about needing both a disk-based backing store *and*
getting maximum use/performance from your RAM, you probably will need to
combine memcached with one of the other solutions offered.
But given your other requirement of not installing a DB, your best option
will certainly be SQLite. You can use :memory: databases, but that will
require shuttling data to disk manually. I suggest that you start with
plain SQLite and only worry if you prove (repeat, PROVE) that DB is your
Aahz (aahz at pythoncraft.com) <*> http://www.pythoncraft.com/
"Many customs in this life persist because they ease friction and promote
productivity as a result of universal agreement, and whether they are
precisely the optimal choices is much less important." --Henry Spencer
More information about the Python-list