cloudwalker
cloudwalker

Reputation: 2466

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.

Upvotes: 7

Views: 2234

Answers (1)

oleksii
oleksii

Reputation: 35905

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

Upvotes: 4

Related Questions