in Search
     
Latest post 12-26-2006 4:35 PM by cruizer. 0 replies.
Page 1 of 1 (1 items)
Sort Posts: Previous Next
  • 12-26-2006 4:35 PM

    • cruizer
    • Top 10 Contributor
    • Joined on 12-14-2005
    • Singapore
    • Posts 944
    • Points 22,590

    data compression when storing data in TEXT fields

    hi everyone!

    i just want to share a technique i'm using to compress data stored on TEXT fields in a database. basically it uses the zlib extension of PHP.

    you have a function called gzcompress() to return a compressed version of an input string and a function called gzuncompress() to decompress it.

    for instance, i needed to serialize a massive array and store it in a database field. since there is much redundancy in the serialized form (string), it's useful to compress it. for instance, i had 17KB worth of data compress to just 7.8KB.

    of course the disadvantage to compressing data is that you can't search it within an SQL query because you'll have to decompress it first. but if you need to store large amounts of information somewhere and that info can be shrinked via compression, it's a good tool to use Smile
    http://devpinoy.org/blogs/cruizer
    Naglalayong buksan at palayain ang kamalayan ng Pinoy .NET developer
    • Post Points: 5
Page 1 of 1 (1 items)