Introduction
CQL (Cassandra Query Language) is a powerful query language used to interact with Apache Cassandra databases. One of the most common questions asked about CQL is whether list values are limited to 65535 bytes. This article will provide an answer to this question and explain why this limit exists. It will also discuss the implications of this limit and how it can be worked around.
Solution
No, CQL list values are not limited to 65535 bytes. The maximum size of a CQL list value is determined by the maximum size of a single partition key, which is 2GB.
The documentation here is wrong as far as I understand it. That limitation was changed in protocol version 3 (introduced in C* 2.1). From the native protocol specification under the changes section for protocol 3:
- The serialization format for collection has changed (both the collection size and
the length of each argument is now 4 bytes long). See Section 6.
So as long as you use protocol version 3 or higher, you can create lists with as many as 2^31-1 bytes (2147483647) or elements.
Edit: I just noticed your comment about set identity, that may be a limitation of the storage engine itself, so perhaps the documentation was left this way for that reason, but the protocol itself supports larger collections now. Will pursue seeing if we can document that nuance.
solved Are CQL list values really limited to 65535 bytes?
The short answer to the question “Are CQL list values really limited to 65535 bytes?” is yes. CQL list values are limited to 65535 bytes. This limit is due to the fact that CQL stores list values as a single value in the database, and the maximum size of a single value is 65535 bytes.
CQL is a query language used to interact with Cassandra, a distributed database system. Cassandra is a NoSQL database, meaning it does not use the traditional relational model of data storage. Instead, it stores data in a distributed, column-oriented format. CQL is used to query and manipulate data stored in Cassandra.
CQL list values are limited to 65535 bytes because Cassandra stores list values as a single value in the database. This means that the maximum size of a single value is 65535 bytes. This limit applies to all types of list values, including strings, integers, and other data types.
It is important to note that this limit does not apply to the total size of a list. A list can contain more than 65535 bytes of data, as long as the individual values are smaller than 65535 bytes. For example, a list of strings can contain more than 65535 bytes of data, as long as each string is smaller than 65535 bytes.
In summary, CQL list values are limited to 65535 bytes due to the fact that Cassandra stores list values as a single value in the database. This limit applies to all types of list values, including strings, integers, and other data types. However, it is important to note that this limit does not apply to the total size of a list, as long as the individual values are smaller than 65535 bytes.