TokuDB Compression

TokuDB storage engine provides new compression options for TokuDB tables.

These options are defined on per-table basis by setting ROW_FORMAT during a CREATE TABLE or ALTER TABLE. If no value is specified for ROW_FORMAT zlib compression is used by default. Currently available formats are:

  • TOKUDB_ZLIB - This compression is using zlib library and provides mid-range compression with medium CPU utilization.
  • TOKUDB_QUICKLZ - This compression is using quicklz library and provides light compression with low CPU utilization.
  • TOKUDB_LZMA - This compression is using lzma library and provides the highest compression with high CPU utilization.
  • TOKUDB_UNCOMPRESSED - This option disables the compression.

Example

In order to create a new table with the highest compression you need to specify the TOKUDB_LZMA as the ROW_FORMAT:

mysql> CREATE TABLE `City` (
  > `ID` int(11) NOT NULL AUTO_INCREMENT,
    `Name` char(35) NOT NULL DEFAULT '',
    `CountryCode` char(3) NOT NULL DEFAULT '',
    `District` char(20) NOT NULL DEFAULT '',
    `Population` int(11) NOT NULL DEFAULT '0',
    PRIMARY KEY (`ID`),
    KEY `CountryCode` (`CountryCode`)
  ) ENGINE=TokuDB, ROW_FORMAT=TOKUDB_LZMA;

In order to change the compression for this table you need to change the ROW_FORMAT with ALTER TABLE command:

mysql> ALTER TABLE City ROW_FORMAT=TOKUDB_ZLIB;

Note

When the compression format is changed it will affect only newly written data. In order to change the old data you’ll need to run OPTIMIZE TABLE on that table.

mysql> OPTIMIZE TABLE City;
Percona Server
Call Us
+1-888-316-9775 (USA - Sales)
+1-208-473-2904 (USA - Sales)
+44-208-133-0309 (UK - Sales)
0-800-051-8984 (UK - Sales)
0-800-181-0665 (GER - Sales)
+1-877-862-4316 (Emergency)
+1-855-55TRAIN (Training)
+1-925-271-5054 (Training)

Table Of Contents

Previous topic

Using TokuDB

Next topic

Multiple Clustering Keys

This Page



© Copyright Percona LLC and/or its affiliates 2009-2014.
Except where otherwise noted, this documentation is licensed under the following license:
CC Attribution-ShareAlike 2.0 Generic
Created using Sphinx 1.2.2.
This documentation is developed in Launchpad as part of the Percona Server source code.
If you spotted innacuracies, errors, don't understood it or you think something is missing or should be improved, please file a bug.
]]>