Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Limit on the number of columns in cassandra

Tags:

cassandra

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 having 86400 columns per row. Is this a good idea?

like image 959
Sriranjan Manjunath Avatar asked Sep 22 '11 23:09

Sriranjan Manjunath


2 Answers

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.

like image 55
vladaman Avatar answered Oct 04 '22 12:10

vladaman


Assuming you're doing that for a good reason, it's totally fine.

like image 36
jbellis Avatar answered Oct 04 '22 13:10

jbellis