A collection stores multiple related values in one ScyllaDB column. Use it for a small, bounded group of values that belongs with one row—not as a substitute for a table. When data may become large or grow unpredictably, model it in its own table with partition or clustering keys so ScyllaDB can optimize access. section 4.5
Figure 4.3 Scylla supports storing multiple values in its collection data types: lists, sets, and maps.
ScyllaDB provides three collection types: LIST, SET, and MAP. Choose by whether order, duplicates, or named key-value entries matter. section 4.5
Choose a collection by the shape of the values:
- LIST<T> stores ordered values of one type and may contain duplicates. section 4.5
- SET<T> stores unique values of one type. Prefer it over a list when duplicate entries are unnecessary. section 4.5 section 4.5.2
- MAP<K, V> stores unique keys and values; all keys share one type, and all values share one type. section 4.5 section 4.5.3
Declare the contained type in angle brackets. A list or set needs one type, such as SET<TEXT>; a map needs key and value types, such as MAP<TEXT, TEXT>. Because set is reserved in CQL, use another column name such as set_text. section 4.5
Updating a set or map
A set can add values with + and remove values with -. Re-adding an existing value leaves the set unique. A map supports the same add and remove style, and it can update or delete one entry by key, such as map['k2']. section 4.5.2 section 4.5.3
For an article image gallery, a set fits when duplicate images are not needed. An image itself has named fields with differing types, so represent its metadata with a user-defined type (UDT), then store a frozen UDT in the collection: SET<FROZEN<image>>. Store image files separately and keep metadata such as name, location, and caption in the database. section 4.5.6 section 4.5.4















