Explaining the implementation of the InnoDB compression
The InnoDB compression supports different compression levels. The innodb_compression_level
server variable is an integer value in the range between 0
and 9
. A higher value represents a more efficient, but slower, compression level. The default value is 6
. This variable is dynamic and can be changed at any time.
As mentioned previously, when an index entry is read from the disk, it is written into the buffer pool in both its compressed and uncompressed forms. InnoDB tries to avoid performing a huge number of compression and uncompression operations in several ways. For example, it can modify a compressed page without compressing the new data until the page needs to be flushed onto the disk. To do this, it keeps a track of such changes in a page area called the modification log, which is uncompressed. Updates and small row insertions can often be applied without recreating the page.
Of course, each page's modification log has a limited...