Database Reference
In-Depth Information
be larger than this value in exceptional cases where a partition key holds very
large data. The default value is 160 MB.
Compression : There are three compression algorithms available in Cassandra
out of the box, LZ4Compressor , SnappyCompressor , and DeflateCom-
pressor , in the decreasing order of read performance and increasing order disk
space saving. So, why would one want a degraded performance for disk space?
Consider a case where you have a table just for archival purposes. Here's an ex-
ample of setting compression:
CREATE TABLE compression_demo (id uuid PRIMARY KEY,
name varchar)
WITH
COMPRESSION = {
'sstable_compression': 'SnappyCompressor',
'chunk_length_kb': 128
};
To disable compression, use the empty string ( '' ) as the value for the
sstable_compression attribute. Compression has a couple of other properties that
can be tuned:
chunk_length_kb : A chunk is the minimum quantum of data that is read by
Cassandra. Depending on how much data is read on an average and the mean size
of the rows of the table, this property may be tweaked. The higher value for this
may improve compression performance, but it will also increase the minimum
size of data read. In general, you wouldn't touch the default value of 64, unless
you are familiar with data and its access pattern in the future.
crc_check_chance : Cyclic Redundancy Check or CRC is a way to validate
if the uncompressed data is exactly the same as the original. In cases when you
have compression enabled for a table, each compressed block holds a checksum
for CRC to avoid any data corruption. This property tells the probability by which
reads are verified for any errors. By default, it is set to 1, so all reads are first val-
idated for data integrity. If it is set to 0.25, every fourth read is validated.
time_to_live : You have seen previously in this chapter that you can set TTL
for individual row or cell, but there may be cases where you want all the rows to
be deleted after some time. For example, if you have a table that is used to ag-
gregate data for the last 24 hours, you may just want to keep the data for the last
24 hours or may be a little bit longer. You can do this by specifying de-
Search WWH ::




Custom Search