Example: Compression Using MVC and ALC - Teradata Vantage

Teradata® VantageCloud Lake

Deployment
VantageCloud
Edition
Lake
Product
Teradata Vantage
Published
January 2023
ft:locale
en-US
ft:lastEdition
2024-12-11
dita:mapPath
phg1621910019905.ditamap
dita:ditavalPath
pny1626732985837.ditaval
dita:id
phg1621910019905

In this example, assume that the default server character set is UNICODE. The NULLs in the Gem column are compressed. MVC is used to compress the values 'amethyst' and 'amber' in the Gem column. Because UPPERCASE is specified, all values of 'amethyst' and 'amber' are compressed regardless of case. The Teradata-supplied function, TransUnicodeToUTF8, compresses all non-null values in the Gem column that are not 'amethyst' or 'amber'. The TransUTF8ToUnicode function uncompresses the values compressed by TransUnicodeToUTF8.

CREATE TABLE Pendants
   (ItemNo INTEGER,
    Gem CHAR(10) UPPERCASE COMPRESS ('amethyst', 'amber')
        COMPRESS USING TD_SYSFNLIB.TransUnicodeToUTF8
        DECOMPRESS USING TD_SYSFNLIB.TransUTF8ToUnicode);