Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: Wisdom sought on migrating from text files to Berkeley DB or SQL

by archen (Pilgrim)
on Dec 23, 2004 at 14:24 UTC ( #417094=note: print w/ replies, xml ) Need Help??


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
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"

      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

      Not if you use BerkeleyDB 4.4 and higher

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://417094]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (13)
As of 2014-07-29 14:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (218 votes), past polls