在mysql中存储GZIP:ed文本? [英] Store GZIP:ed text in 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?
推荐答案
我没有看到太多的事情,因为它基本上可以防止人们对MySQL端的数据进行任何操作:
I've not seen this done much, as it basically prevents one from doing any manipulation on the data on the MySQL-side :
- 没有全文,是
- 但也没有
like
,没有=
,没有其他操作...
- 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.
注意:您可能想做一些基准测试,以衡量其可能对性能造成的影响,因为压缩/解压缩需要CPU!
Note : you might want to do a few benchmarks, to measure the performance-impact this could have, as compression/decompression requires CPU !
之后,问题是:您将在客户端(PHP)端还是在服务器(MySQL)端处理压缩问题?
After that, question is : will you deal with the compression on the client (PHP) side, or on the server (MySQL) side ?
在第二种情况下,有一个 COMPRESS()
In the second case, there is a COMPRESS()
function, provided by MySQL, that might interest you.
这篇关于在mysql中存储GZIP:ed文本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!