Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Store GZIP:ed text in mysql?

Tags:

php

mysql

gzip

Is it a common thing for bigger applications and databases to GZIP text data before inserting it to the database?

I'll guess that any full-text search on the actual text field will not be working before unzipping it again?

like image 992
Industrial Avatar asked Apr 29 '10 21:04

Industrial


1 Answers

I've not seen this done much, as it basically prevents one from doing any manipulation on the data on the MySQL-side :

  • no fulltext, yes
  • but also no like, no =, no other manipulation...

Still, if you're using your database only to store that data, and not manipulate it, it might be interesting.

Note : you might want to do a few benchmarks, to measure the performance-impact this could have, as compression/decompression requires CPU !


After that, question is : will you deal with the compression on the client (PHP) side, or on the server (MySQL) side ?

In the second case, there is a COMPRESS() function, provided by MySQL, that might interest you.

like image 136
Pascal MARTIN Avatar answered Oct 10 '22 02:10

Pascal MARTIN