http://www.perlmonks.org?node_id=417094


in reply to Wisdom sought on migrating from text files to Berkeley DB or SQL

I use BerkelyDB for a LOT of stuff, especially configuration info. It's fast and easy and certainly less of a pain in the ass to set up, but just keep in mind that there are some drawbacks as well. For a time I found myself creating pseudo-logic structions by accessing data by $db{"$key.$val"}. Using such a structure is cute but becomes hard to manage rather quick. The other issue is fixing incorrect data. Because there is no direct access to the database file itself, you might need to keep this in mind. I made a program myself that allows me to fix/add/delete stuff from the database, but as far as I know there isn't any defacto program that anyone has made.

The other big drawback is that BerkelyDB databases aren't very portable. I'd generally assume that once you make a db file on one server, that it's only going to work on that server. Making a raw export into text might be something to consider for a backup plan.

Now for what you want to do, storing simple things that you want to access via a key (like configuration info and simple mail dump) BerkelyDB works REALLY well. Where it sucks is when you need to get meaningful information out of stuff that is locked up in your database - which means you end up doing stuff like rather messy loops and such. So for what you do now it would be great, for what you want to do in the future, maybe not. I guess that depends on how many db files you plan on breaking this up into, and how you structure your keys.

As an aside an alternative thing to think about is using XML , although slower, it's a lot more fault tollerant.
  • Comment on Re: Wisdom sought on migrating from text files to Berkeley DB or SQL

Replies are listed 'Best First'.
Re^2: Wisdom sought on migrating from text files to Berkeley DB or SQL
by Anonymous Monk on Nov 06, 2012 at 08:45 UTC
    BerkelyDB is very susceptible to frequent corruption and difficult recovery, in fact we could say it "Use Berkely DB if you don't have crashed in your apps and that too you don't care of application data after crashes"
      Not if you use BerkeleyDB 4.4 and higher

      BerkelyDB is very susceptible to frequent corruption and difficult recovery, in fact we could say it "Use Berkely DB if you don't have crashed in your apps and that too you don't care of application data after crashes"

      malarky