Filip Allberg
Filip Allberg

Reputation: 5171

Cassandra column value size for collections

How does the following two Cassandra limitations interplay with one another?

  1. Cells in a partition: ~2 billion (2^31); single column value size: 2 GB (1 MB is recommended) [1]
  2. Collection values may not be larger than 64KB. [2]

Are collections laid out inside of a single column and hence ought one limit the size of the entire collection to 1MB?

[1] https://docs.datastax.com/en/cql/3.3/cql/cql_reference/refLimits.html
[2] https://wiki.apache.org/cassandra/CassandraLimitations

Upvotes: 1

Views: 579

Answers (1)

Mandraenke
Mandraenke

Reputation: 3266

A collection is a single column value with

  • a single value inside size limited to 64k (max value of unsinged short)
  • items in collections limited to to 64K (max value of unsinged short)

The 1MB is a recommendation and no hard limit, you can go higher if you need to - but as always do testing before production. But as you can have 2^16 items and 2^16 bytes in each - this will break the 2GB limit per cell.

But collections should be kept small for performance reasons anyway as they are always read entirely. And updates to collections are not very fast either.

Upvotes: 2

Related Questions