Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are the maximum number of columns allowed in Cassandra

Cassandra published its technical limitations but did not mention the max number of columns allowed. Is there a maximum number of columns? I have a need to store 400+ fields. Is this possible in Cassandra?

like image 299
Luke101 Avatar asked May 19 '15 03:05

Luke101


3 Answers

The maximum number of columns per row is 2 Billion. This is per the link that you have embedded.

http://wiki.apache.org/cassandra/CassandraLimitations

400+ fields is not a problem.

like image 158
rja Avatar answered Oct 14 '22 21:10

rja


As per Cassandra technical limitation page, total no. of cells together cannot exceed 2 billion cells (rows X columns).

You can have a table with (1 row X 2 billion columns) and no more rows will be allowed in that table, so the limit is not 2 billion columns per row but limit is on total no. of cells in a partition.

https://wiki.apache.org/cassandra/CassandraLimitations

like image 34
JRG Avatar answered Oct 14 '22 20:10

JRG


Rajmohan's answer is technically correct. On the other hand, if you have 400 CQL columns, you most likely aren't optimizing your data model. You want to generate cassandra wide rows using partition keys and clustering columns in CQL.

Moreover, you don't want to have rows that are too wide from a practical (performance) perspective. A conservative rule of thumb is keep your partitions under the 100's of megs or 100,000's of cells.

Take a look at these two links to help wrap your head around this.

http://www.datastax.com/dev/blog/does-cql-support-dynamic-columns-wide-rows

http://www.sestevez.com/sestevez/CASTableSizer/

like image 37
phact Avatar answered Oct 14 '22 19:10

phact