You've given a good example

You've given a good example of a case where storing images in the database makes sense. Images and video can also benefit from the database advantages like replication for spreading the load. Yes, people do store video, in chunks, in MySQL databases.

What you might do is store in a metadata table an object location. You can then specify that location in many ways, one of them being in a particular set of database servers, another being in the filesystem. Then you have the flexibility to do things like have a size or other threshold above which you use the filesystem, as well as a migration strategy, since you can start with them all pointing to the filesystem and migrate them over time.

If you use thumbnails I suggest putting them in a different table from the full size images and both different form the metadata. That is likely to help cache efficiency, since the thumbnails are likely to be far more frequently accessed.

Wikipedia doesn't (yet) store images in the database but it does use this object approach to store text records first uncompressed alone, then compressed combining many together for higher compression, and finally into sets of databases running on regular web servers. Effectively, hierarchical storage.

You should also investigate the MogileFS system developed for use by LiveJournal.

Reply

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

More information about formatting options