Search code examples
cassandracqlcql3cqlsh

How to specify column length on table creation in cql?


so in SQL I can do the following to specify needed length:

CREATE TABLE ... name VARCHAR(**255**) ...

Is there some way to do it in CQL? In documentation there is no word about it (or maybe I'm missing something important), so I think it's not possible, but I also didn't find confirmation of it. And what is the maximum length of varchar type in CQL?


Solution

  • In Cassandra VARCHAR is just an alias for TEXT data type which stores UTF-8 encoded string. The max size of a string is limit4ed by the max size for a string in Java which is 2147483647 characters (2^31 - 1). You can't set a max string length in table definition for string datatypes.