I use CGI and Perl DBI to store images as blobs in MySQL. I fetch the image using primary key
select mimetype, image from table where rowid=nn
Once I get the row using DBI calls, I display the image using CGI
print header(-type => mimetype,-Content_Length =>length(image)),image;

The primary reason I do this (as opposed to storing in files) is that I do not need to keep track of the files and do not have to worry about separately backing up images. The images are stored in a separate image table. I do not query this table, except for look up based on primary key to display the image. The maximum size of the images would be 200K

My image table is now about 3GB. The response time for image display is acceptable now. But the image table is likely to grow a good bit and the hits would increase gradually.

I am wondering if I would run into performance problems with this approach and should I try to explore other alternatives. I would be thankful for your input.


In reply to Storing/Retrieving images as blobs by Anonymous Monk

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.