Freezing collection types

A collection column is declared using the collection type, followed by another type, such as int or text, in angle brackets. For example, you can create a table having a set of text, integers, or other data type elements.


To nest a collection type, freeze the nested collection. For example, nest a set within a map:

map<frozen <set<int>>>

Indexes may be created on a collection column of any type.

Using frozen in a collection

Use frozen on a set, map, or list to serialize multiple components into a single value, frozen<<collection_definition>>. Non-frozen types allow updates to individual fields, but values in a frozen collection are treated like blobs, any upsert overwrites the entire value.

column_name <collection_type><<data_type>, frozen<<column_name>>>


CREATE TABLE IF NOT EXISTS cycling.race_starts (
  cyclist_name text PRIMARY KEY,
  rnumbers FROZEN<LIST<int>>
CREATE TABLE IF NOT EXISTS cycling.race_winners (
  cyclist_name FROZEN<fullname>, 
  race_name text,
  race_position int,
  PRIMARY KEY (race_name, race_position)
CREATE TABLE IF NOT EXISTS cycling.cyclist_races (
  lastname text,
  firstname text,
  races list<FROZEN <race>>

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.

Was this helpful?

Give Feedback

How can we improve the documentation?

© 2024 DataStax | Privacy policy | Terms of use

Apache, Apache Cassandra, Cassandra, Apache Tomcat, Tomcat, Apache Lucene, Apache Solr, Apache Hadoop, Hadoop, Apache Pulsar, Pulsar, Apache Spark, Spark, Apache TinkerPop, TinkerPop, Apache Kafka and Kafka are either registered trademarks or trademarks of the Apache Software Foundation or its subsidiaries in Canada, the United States and/or other countries. Kubernetes is the registered trademark of the Linux Foundation.

General Inquiries: +1 (650) 389-6000,