Re: compress data before inserting into mysql record?
| From: | Daniel Daley | Date: | Thu, 04 Mar 2004 23:33:07 +0000 |
| Subject: | Re: compress data before inserting into mysql record? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-179508@lists.php.net to get a copy of this message | ||
Christian Calloway wrote:
I had a small question concerning how MySQL stores text and longtext fields. Long story short, I have to store a large amount of "textual" data, and was wondering if I should compress said data and then store it in the db, or does MySQL already concern itself with compression (which would make it pointless to pre-compress). Thank youAs far as I know MySQL doesn't do any compression on any fields. If this is a static unchanging set of data mysql does allow you to compress entire tables with the myisampack command but the table become read-only. As of MySQL version 4.1.1 you can use the functions COMPRESS() and UNCOMPRESS() in an sql query if the server was compiled with zlib (it will return null if it wasn't). Other than that you would have to compress the data yourself using php functions before inserting it. You would want to store data in a BLOB/LONGBLOB column either way though since it is now binary data. --Dan--