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.