I’m a bit new to mysql and unsure how the compression works. Basically I have a raw 20GB file that I am loading into mysql. I know when I compress it using gzip usually between 2-4GB. So my question is, what compression is mysql using(and can I change it)? and does it only apply to data stored in the table itself or does it apply to text?
Here’s my table:
CREATE TABLE my_data (
`ID` int(11) unsigned NOT NULL AUTO_INCREMENT,
`DATA` text NOT NULL,
PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4;
My understanding is DATA is not stored in the table itself but just a reference pointer to it is. I’m wondering if the compression would apply to the data itself or just to the reference pointer?
From mysql documentation –
“When a table is in COMPRESSED format, all data written to overflow pages is compressed “as is”; that is, InnoDB applies the zlib compression algorithm to the entire data item. Other than the data, compressed overflow pages contain an uncompressed header and trailer comprising a page checksum and a link to the next overflow page, among other things. Therefore, very significant storage savings can be obtained for longer BLOB, TEXT or VARCHAR columns if the data is highly compressible, as is often the case with text data (but not previously compressed images).”
I am sure that compression algorithm is applied to the data.