Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How does Cassandra store null values?

How does Cassandra store null values internally? Does it take up any storage space at all? I'm writing an application that uses a table with many many columns (100s) to represent varying types of data, so the columns have names like "text1", "text2", "number1", "number2", etc. and then there is an external JSON schema that maps what column represents what value for a specific data type. So, it could be for a certain data type that many columns have null values, and I have not been able to find anything concrete regarding the storage space (if any) that would be taken up by the null values.

like image 272
cloudwalker Avatar asked Jul 08 '16 16:07

cloudwalker


People also ask

Can primary key be null in Cassandra?

Cassandra does not allow null clustering key values.

How do I change the null value in Cassandra?

update keyspace. table set ric=null where code='code'; You can also use null in insert statements, but if you omit the value it's the same as saying null so there's no point.

What are tombstones in Cassandra?

In Cassandra, deleted data is not immediately purged from the disk. Instead, Cassandra writes a special value, known as a tombstone, to indicate that data has been deleted. Tombstones prevent deleted data from being returned during reads, and will eventually allow the data to be dropped via compaction.

How many columns does Cassandra support?

Cassandra allows 2 billion columns per row.


1 Answers

As long as you don't actually specify the name of the column and value null, it won't consume any space. E.g.

row1 col1 col4
     val1 val4

row2 col1 col2 col4
     val1 val2 val4

row3 col3 col4
     val3 val4
like image 117
oleksii Avatar answered Oct 23 '22 19:10

oleksii