If I want to store persistent data from my program in a database, am I better off storing the data in tables that I construct into objects via a constructor method, or simply dumping the entire object in serialized form, via Data::Dumper or Storable, and storing it in the DB?

I suppose the key question is, is there a big performance boost in grabbing the serialized object, rather than constructing a new instance out of the stored data?

If not, then it seems like you give up the ability to search the stored fields if you just serialize. I'd be very interested in hearing any real world* experiences with storing serialized objects in perl, along with the caveats and gotchas it creates and/or avoids.

* as opposed to ones in alternate universes, I guess...


In reply to storing serialized object in a database by dshahin

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.