Dictionary or DatabasePlease advise
Roy Smith
roy at panix.com
Fri Feb 26 11:39:51 EST 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?
>
> Thanks,
> Jeremy
This is a very vague question, so it'll get a vague answer :-)
If you have so much data that you're running into memory problems, then
yes, storing the data externally in an disk-resident database seems like a
reasonable idea.
Once you get into databases, platform independence will be an issue. There
are many databases out there to pick from. If you want something which
will work on a lot of platforms, a reasonable place to start looking is
MySQL. It's free, runs on lots of platforms, has good Python support, and
there's lots of people on the net who know it and are willing to give help
and advice.
Databases have a bit of a learning curve. If you've never done any
database work, don't expect to download MySql (or any other database) this
afternoon and be up and running by tomorrow.
Whatever database you pick, you're almost certainly going to end up having
to install it wherever you install your application. There's no such thing
as a universally available database that you can expect to be available
everywhere.
Have fun!
More information about the Python-list
mailing list