Description: I have a huge MySQL database table. The total size is about 10 terabytes. It only contains texts.
A sample text from this database table:
In other cases, some countries have gradually learned to produce the same products and services that previously only the U.S. and a few other countries could produce. Real income growth in the U.S. has slowed.
There are about 50 billion different texts.
What have I tried?
I’ve tried to zip them all. Actually it has worked, reduced the total size. However, I need to make searching and I can’t search any data while they are located in a zip file.
I’ve tried PHP’s base64 encoding. It has made my sample text data as:
SW4gb3RoZXIgY2FzZXMsIHNvbWUgY291bnRyaWVzIGhhdmUgZ3JhZHVhbGx5IGxlYXJuZW
QgdG8gcHJvZHVjZSB0aGUgc2FtZSBwcm9kdWN0cyBhbmQgc2VydmljZXMgdGhhdCBwcmV2
aW91c2x5IG9ubHkgdGhlIFUuUy4gYW5kIGEgZmV3IG90aGVyIGNvdW50cmllcyBjb3VsZC
Bwcm9kdWNlLiBSZWFsIGluY29tZSBncm93dGggaW4gdGhlIFUuUy4gaGFzIHNsb3dlZC4=
What I’d like to accomplish?
I want to reduce text’s size before sending them to MySQL. First of all, I don’t know how I can do this job. I’m thinking of encrypting and decrypting the data.
So, here is an example what I want to do:
I want to encrypt text data before storing. Then, I want to call encrypted data from MySQL in order to decrypt.
Any way to reduce the size of texts? Base64 does not work for me, is there any other way?
Please Note neither
base64norencryptionwas designed for reduction of string length. What you should be looking at is compression and i think you should look atgzcompressandgzdeflateExample using decoded version of your text
Output