Partial inserts

You are not, of course, required to provide values for all columns—other than primary key columns—when inserting a row. If, for instance, we decide to allow users to register without providing an email, we may issue this perfectly valid query:

    INSERT INTO "users"    ("username", "encrypted_password")    VALUES (      'bob',      0x10920941a69549d33aaee6116ed1f47e19b8e713    );

In the preceding query, we only insert values for the username and encrypted_password fields; the row will have no value in the email field.

Do empty columns take up space? Only columns with values take up storage space in Cassandra. This is in contrast to relational databases, in which every row has space allocated for every column, whether or not that column has a ...

Get Learning Apache Cassandra - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.