First, the MLDBM tie mechanism serializes the data structure at the time you make the assignment. I.e., your

my @seqRelation; $hash{'key'} = \@seqRelation;

just stores an empty array.  Later changes to @seqRelation will not automatically be updated in the tied storage.  In other words, you'd need to assign it after you've pushed all your data onto it.

Secondly, note that what you store under a single key will be stored as one string.  So I'm not really sure what you're hoping to achieve with this approach, memory-wise.  If your data doesn't fit into a single data structure in memory, it won't fit into @seqRelation either, and serializing this huge data structure would additionally require quite a lot of memory...

What might work - if you want to stick with BerkeleyDB - is to store each record separately, e.g. using the line number as the key, which you could then use as a pseudo array index for retrieval.


In reply to Re: Large files tied by BerkeleyDB with MLDBM by Eliya
in thread Large files tied by BerkeleyDB with MLDBM by fortunezhang

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.