说的是列存储的
有个字段是48个字符,每个字符要么是‘0’要么是‘1’,基本都是‘0’。我想给转成十进制省点空间,后来一想数据库会不会自动给我压缩?
新潮的数据库存string的时候应该会压缩吧?
版主: verdelite, TheMatrix
#3 Re: 新潮的数据库存string的时候应该会压缩吧?
这种情况还是转成整数存放省空间点吧?64位整数就够了。wokao 写了: 2024年 5月 31日 23:45 说的是列存储的
有个字段是48个字符,每个字符要么是‘0’要么是‘1’,基本都是‘0’。我想给转成十进制省点空间,后来一想数据库会不会自动给我压缩?
数据库也能自动压缩
MySQL implements compression with the help of the well-known zlib library, which implements the LZ77 compression algorithm. This compression algorithm is mature, robust, and efficient in both CPU utilization and in reduction of data size. The algorithm is “lossless”, so that the original uncompressed data can always be reconstructed from the compressed form. LZ77 compression works by finding sequences of data that are repeated within the data to be compressed. The patterns of values in your data determine how well it compresses, but typical user data often compresses by 50% or more.