How it works...

Compression is applied on the column level and not on rows. As the name states, it compresses repeated values in a table with NULL, 0, and space. So, what really happens when we issue a compression statement?

In our recipe, the date column takes 4 bytes of space in the table. That means it will occupy 4 bytes of space. Our date column has 6 different values; of them, two are repeating, which are '2017-09-01'and'2017-09-05'So by applying the MVC technique, Teradata will replace these values with presence bits 01 for ‘2017-09-01’ and 11 for ‘2017-09-05’; that means only 2 bits instead of 1 byte. These bits are stored in the table header, and when these values are referred to the optimizer replaces these bits with actual values ...

Get Teradata Cookbook 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.