Why does MySQL store blobs in the direct table rather than off to the side so that if it needs to read the corresponding stuff it will read the stuff off to the side? Essentially it would create its own file that was protected from everything except itself in a file-folder type of architecture so that it would be easier/quicker to write out a blob link.
Your question reminds me of PostgreSQL. It has a feature called TOAST (The Outside Attribute Storage Technique). PostgreSQL features TOAST tables in the event the length of the row data is too small.
I have discussed TOAST before in the DBA StackExchange
May 01, 2012: what is bigger than a longblob?
Mar 21, 2012: Are many NULL columns harmful in mysql InnoDB?
Jul 19, 2011: Different MySQL Datafile Sizes After Restoration
You will have to tune for BLOBs in one or more ways:
- Create a table with a BLOB field and a foreign key to the parent table for the remainder of the data.
- In the event of multiple BLOBs in a single row, find a way to combine all the BLOB data into a single BLOB field and compress it and/or change the
ROW_FORMAT(See MySQLPerformanceBlog in this one).
- Look for the biggest BLOB in your dataset and scale up the innodb_log_buffer_size and innodb_log_file_size to accommodate 10 such BLOBs (InnoDB only)
Aug 01, 2011: How does max_allowed_packet affect the backup and restore of a database?
Apr 27, 2011: Changed max_allowed_packet and still receiving 'Packet Too Large' error
Apr 20, 2011: MySQL gives "Out of Memory" error when inserting a large file. From where is this filesize limitation arising?
Switch to PostgreSQL :-(