Null encoding and MVCC

I was reading the data encoding doc and had a question with the handling of SQL Null.

According to the doc,

CRDB encodes each row as if the columns where that row is null did not exist .If all of the columns in a column family are null, then the corresponding KV pair is suppressed

If I understand the example dump in the linked doc correctly, there won’t be a KV pair for the column with null value.

But how does this work with MVCC? What happens to the 2nd step in the following sequence of operations? Do you do nothing, or set a tombstone at T2?

  1. at time T1, set column C to Value1;
  2. at time T2, set column C to null;
  3. at time T3, set column C to Value2.

@zzkk Setting column C to null results in a tombstone being written at T2. It’s actually slightly more complicated than that because we now bundle multiple column values into the same KV pair, but the idea is the similar.

Thanks @peter . So for initial insert (let’s say the row is inserted at T0 with column C as null), null column is simply omitted when translating from SQL to KV, but subsequent update would result in a tombstone. Is that correct?

Yes, that’s correct.