Experts Round Table Network

Databases => MySQL => Topic started by: Esopo on December 30, 2006, 04:53:12 AM



Title: Possible DB compression to reduce size
Post by: Esopo on December 30, 2006, 04:53:12 AM
Hi,

I’m running a DB that is sure to get out of hands at some point in the future. In it I’m storing some fields that would normally not be used much except for the occasional report that can take as long as it wants to generate.

I was thinking, is there a way to tell MySQL to zip those fields (text)? Even if it would take longer to handle them afterwards.

As an alternative I’m thinking zipping the content myself and storing it as binary, but I thought I should ask in case what I imagined is already a feature.

Thanks,

Esopo.


Title: Re: Possible DB compression to reduce size
Post by: VGR on December 30, 2006, 12:01:01 PM
yes, this is called a "packed MyISAM table"


Title: Re: Possible DB compression to reduce size
Post by: VGR on December 30, 2006, 12:05:39 PM
to be more precise, you've to use the myisampack utility

alternatively, you've the new storage engine called "archive" which renders roughly the same service and moreover prtects your data from manipulations.

some sample data :
Quote
The Archive table is almost 75% smaller in size then the MyISAM table and almost 83% smaller in size then the transactional InnoDB engine
Even with compression applied, the Archive table is still 7% smaller than the packed MyISAM table

see http://dev.mysql.com/tech-resources/articles/storage-engine.html (http://dev.mysql.com/tech-resources/articles/storage-engine.html)


Title: Re: Possible DB compression to reduce size
Post by: Esopo on December 30, 2006, 08:14:45 PM
Thanks for the reply.
I read the page and now I'm aware of the Archive, although it doesn't fit my requirements. I also found this:
http://dev.mysql.com/doc/refman/5.0/en/encryption-functions.html#function_compress

Although I also found some recent bug complaints about it. It did get me inspired, and I think I'm just going with PHP's gzcompress(), I ran some tests and it seems to be very fast, I would even consider it for normal daily use.

More on the other thread:
http://www.expertsrt.net/main/forum/topic,1067.msg9658#msg9658