question

nirjharray avatar image
nirjharray asked bettina.swynnerton edited

What is a frozen collection and why use it?

What is a FROZEN collection and what can be a business use case to use it?

user-defined typecollections
10 |1000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

1 Answer

bettina.swynnerton avatar image
bettina.swynnerton answered bettina.swynnerton edited

Freezing a collection essentially make the collection values immutable. Frozen collections are treated like blobs, any upsert overwrites the entire value. You cannot update individual fields of frozen collections.

An important note about non-frozen collections from the DataStax docs:

In a non-frozen collection, a tombstone is created for an insert and a non-incremental update in the collection. An incremental update adds a value to an existing value in the collection. The inserts and non-incremental updates for a non-frozen collection can cause large numbers of tombstones.

This creation of tombstones might not be an obvious side-effect of updating collections, especially if you are not explicitly deleting any data, and large numbers of tombstones will affect read performance.

Another aspect of frozen collections is that they can be used as part of primary keys, where non-frozen collections cannot be used.

These aspects should help to decide whether you want to freeze a collection or not.

I hope this helps!

Share
10 |1000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.