There are two possible solutions:

*DBM
Use dbm file with embeded data structures serialized. You may use MLDB for this purpose, but as it uses Data::Dumper it could be somewhat slow for your purposes (see Serialization uncovered). But the real pain in this are indexes. *DBM allow you only one key. You must maintain several other *DBM files with mappings of secondary keys to primary keys. And you must maintain them consistent. And if you want to do a substring search, there is no easy method except for linear search. And that could be terribly slow even for small database. One more problem with *DBM files is parallel access. You cannot open *DBM file for writing in two precesses. And if you do open/close scenario, data cannot be cached and the access is very inefficient.

database/directory
Use RDBMS (Oracle,MySQL,...). Choose some lighweighted one and it will have little impact on performance compared with programming comfor you gain. Or even better use a directory service, like LDAP. There is excelent open-source LDAP server: OpenLDAP. This will do all the dirty index/schema/caching things. There are at leas two modules on CPAN for LDAP access (Net::LDAP and perldap) and both works fine for me.


In reply to Re: Basic Database? by gildir
in thread Basic Database? by tomazos

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.