Move attachments data to its own table?

David Miller justdave at bugzilla.org
Sat Aug 20 18:14:46 UTC 2005


Myk Melez wrote:
> Joel Peshkin wrote:
>> I wonder if we should leave all the metadata (filename, mime-type, 
>> submitter, ceration timestamp, etc...) in the attachments table but 
>> migrate the actual attachment data (the "thedata" field) to its own 
>> table containing only attach_id and thedata.   I don't see any 
>> disadvantage of doing this and it could save a lot of trouble.
> We've considered doing this in the past.  The disadvantage is additional 
> complexity, but that downside is minimal, especially with a good API to 
> attachments like the Bugzilla::Attachment improvements in bug 302669 
> <http://bugzilla.mozilla.org/show_bug.cgi?id=302669>, attachment 193220 
> <https://bugzilla.mozilla.org/attachment.cgi?id=193220>.
> 
> I'm surprised that it's slow, frankly, since I'd expect MyISAM blob 
> columns to be implemented in a way that doesn't slow down row access 
> except when you actually access the blob fields.  But if that's not the 
> case, a separate table is the next best solution and works for me.

Even if that's true, not every database engine is as smart about it as 
MySQL/MyISAM.  It certainly won't hurt anything on MySQL (compared to 
the cost of transmitting that data over the wire, the extra processing 
for a table join is miniscule), and it will probably greatly help some 
of the other database engines.

-- 
Dave Miller                                   http://www.justdave.net/
System Administrator, Mozilla Foundation       http://www.mozilla.org/
Project Leader, Bugzilla Bug Tracking System  http://www.bugzilla.org/



More information about the developers mailing list