Multivalue compression and null indication serve distinct purposes yet share a common objective of storing information about the values of each row’s columns. To conserve space, Teradata utilizes presence bytes to retain information on multivalue compression and nullability.
Part of the Teradata Compression and Space Management guide.
Readers familiar with earlier releases will recognize that the name “presence byte” originally referred only to NULL values. This naming convention was introduced when only nullability information was stored, before multivalue compression existed.
The diagrams describe a historical row-store presence-byte model. They are not a universal representation for all modern row/column storage formats; current physical-byte layout was not inspected in this audit.
How is Teradata storing Information about NULL Values?
One bit per row finds NULL values for each nullable column. The bits used to show nullability are always stored in the bits used by the multivalue compression feature (which means the bits are used from right to left). Of course, columns defined as NOT NULL don’t need the nullability indicator bit.
Get the complete Teradata tuning book, free
Teradata Query Performance Tuning: The DWHPro Guide
By Roland Wenzlofsky & Artemios Vogiatzis
206 pages on statistics and demographics, access paths and indexes, query execution plans, and joins. Get the full PDF and practical Teradata updates from DWHPro.
Confirm your email to receive your download link. Privacy policy. Unsubscribe in any newsletter.
About the free bookThe logic of indicating NULL values is simple:
- If the presence bit is set to 1, a NULL value is present in the column.
- If the presence bit is set to 0, any other value is present in the column.
See below an example table containing eight rows. As TheCol is nullable, an indicator bit is used to show rows containing NULL values in TheCol (as mentioned earlier, the first bit is always set to 1 as the system utilizes it):

We already said that only 7 bits of the first presence byte could be used. We can cover seven nullable columns with the always-existing presence byte. Each additional presence byte can store the null value information of 8 more nullable columns.
An extra presence byte is added if we increase the number of nullable columns from 7 to 8. As a result, each row consumes one more byte of permanent disk space.
Keep the following limits in mind when designing your tables:
Up to 7 nullable columns -> The already existing presence byte is used.
Up to 15 nullable columns -> 1 presence byte is added (2 in total)
Up to 23 nullable columns -> 2 presence bytes are added (3 in total)
…
Declare NOT NULL when the business domain prohibits missing values. Do not change nullability merely to save a presence bit; validate data semantics and required constraints first.
Teradata Multivalue Compression and the Presence Bytes
Presence bytes are also used in multivalue compression. For each column, up to 255 different values can be compressed.
The original column values are kept in the table header, and each row will only hold the binary number representing its corresponding column value. If we store 255 different values, 8 bits are needed (a total presence byte).
The algorithm will only occupy as many bits as needed to encode the original column value:
| Different Values | Bits needed |
|---|---|
| 1 | 1 |
| 3 | 2 |
| 7 | 3 |
| 15 | 4 |
| 31 | 5 |
| 63 | 6 |
| 127 | 7 |
| 255 | 8 |
Let’s do another example. The below table has eight rows. If we compress 3 column values ‘A’,’B’,’C’, we need two presence bits: ‘A’ could be represented by the binary number 01, ‘B’ by binary 10, ‘C’ by binary 11 (the presence bits are occupied from right to left):

We extend our example by making TheCol additionally nullable. In this case, one presence bit is needed to show rows containing NULL values in column TheCol. The compression is unchanged, just shifted by one bit to the left, as nullability bits are always stored first:

When we compress at least one value of TheCol, NULL values are automatically compressed without any more cost. The column’s nullability bit can be used for NULL values. No encoding and storing in the table header is required.
To decrease space usage, employing identical presence bytes for multivalue compression and nullability is possible. However, it’s crucial to consider the combined expenses of compressed columns and nullable indicators when constructing tables and how adding another compressed value or nullable column may impact table size.
Need help with query performance or platform costs?
Diagnose plans, skew, spool pressure and expensive workloads. Agree a baseline and acceptance criteria before making changes.
Get the complete Teradata tuning book, free
Teradata Query Performance Tuning: The DWHPro Guide
By Roland Wenzlofsky & Artemios Vogiatzis
206 pages on statistics and demographics, access paths and indexes, query execution plans, and joins. Get the full PDF and practical Teradata updates from DWHPro.
Confirm your email to receive your download link. Privacy policy. Unsubscribe in any newsletter.
About the free book
Jayant, that right most bit is used by the system and will always be populated as 1 as you can see in all other examples
Good morning Sir,
Very nice explanation of multivalue compression here. kudos to you. I am a beginner at Teradata, but I like to learn new things.
One question, I had in the example of multivalue compression (with the not nullable condition). When we represent the value ‘A’ by 01 in the first row of the table ‘The table’. My question is why the presence byte is looking like 00001011. What is the fourth ‘1’ (right to left) signifying there?
your response is greatly appreciated.