Configuring compression
Steps for configuring compression.
You configure a table property and subproperties to manage compression. The CQL table properties documentation describes the types of compression options that are available. Compression is enabled by default.
Procedure
-
Disable compression, using CQL to set the compression parameters to an empty
string.
CREATE TABLE DogTypes ( block_id uuid, species text, alias text, population varint, PRIMARY KEY (block_id) ) WITH compression = { 'sstable_compression' : '' };
-
Enable compression on an existing table, using ALTER TABLE to set the
compression algorithm sstable_compression to LZ4Compressor (Cassandra 1.2.2 and
later), SnappyCompressor, or DeflateCompressor.
CREATE TABLE DogTypes ( block_id uuid, species text, alias text, population varint, PRIMARY KEY (block_id) ) WITH compression = { 'sstable_compression' : 'LZ4Compressor' };
-
Change compression on an existing table, using ALTER TABLE and setting the
compression algorithm
sstable_compression
toDeflateCompressor
.ALTER TABLE CatTypes WITH compression = { 'sstable_compression' : 'DeflateCompressor', 'chunk_length_kb' : 64 }
You tune data compression on a per-table basis using CQL to alter a table.