Limit on the number of columns in cassandra

后端 未结 2 617
我在风中等你
我在风中等你 2021-02-15 17:43

Is there any limit on the number of columns in cassandra? I am thinking of using a unix timestamp (converted to TimeUUID) as the column key. In the worst case, I will end up hav

2条回答
  •  南笙
    南笙 (楼主)
    2021-02-15 17:56

    Having 86.400 columns per row is piece of cake for cassandra as long your columns are not too big and you don't retrieve all of them.

    The maximum of column per row is 2 billion. See http://wiki.apache.org/cassandra/CassandraLimitations

    A suggestion: For column name you should use Integer data serialization, which would take just 4 bytes for 1 second precision instead of using UUID (16 bytes); as long as your timestamps are all unique and 1s precision is enough.

    Column names are sorted and you can use unix time as Integer. With this you can have fast lookups on columns.

    There is also timestamp associated with each column, which can be useful to set in some cases. You cannot query on it, but may provide you additional information if needed.

提交回复
热议问题