I'm considering a project where I would store large binary files (1-15meg) in a database. (MySQL) There will be many inserts (not usually concurently), few select's and rarely deletes.

My question is this: Can this be done efficently(read: conserving memory) in perl? (Under mod_perl & DBI?) The only solution that comes readily to mind is to slurp the file into one honkin' scalar, and use binding values to stuff it into the database. This poetentially has some nasty memory usage problems.

I'd like to use the database to store files because it allows me to keep all data related to the application in one place. However, If this approach has more drabacks than benefits, I'll just revert to using a sql table to manage on-disk files. Thanks in advance for any ideas or suggestions.


In reply to Storing files in a database by mystik

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.