Teradata provides the following functions for compressing and uncompressing data. These functions are stored in the TD_SYSFNLIB system database.
Function Type | UDF Name | Description |
---|---|---|
Compress | TransUnicodeToUTF8 | Takes UNICODE character input and stores it in UTF-8 format. This is useful when the characters are in the ASCII script (U+0000 to U+007F) because UTF-8 uses one byte to represent these characters and UNICODE (UTF-16) uses two bytes. |
Decompress | TransUTF8ToUnicode | Takes the data previously compressed using the TransUnicodeToUTF8 function and converts it back to UNICODE. |
Compress | LZCOMP | Compresses UNICODE character data using the Lempel-Ziv algorithm. |
Decompress | LZDECOMP | Uncompresses UNICODE data that was compressed using LZCOMP. |
Compress | LZCOMP_L | Compresses LATIN character data using the Lempel-Ziv algorithm. |
Decompress | LZDECOMP_L | Uncompresses LATIN data that was compressed using LZCOMP_L. |
Compress | CAMSET | Compresses UNICODE character data into partial byte (for example, 4-bit digits or 5-bit alphabetic letters), one byte, or two byte values using a proprietary Teradata algorithm. |
Decompress | DECAMSET | Uncompresses the UNICODE character data that was compressed using CAMSET. |
Compress | CAMSET_L | Compresses LATIN character data into partial byte (for example, 4-bit digits or 5-bit alphabetic letters), or one byte values using a proprietary Teradata algorithm. |
Decompress | DECAMSET_L | Uncompresses the LATIN character data that was compressed using CAMSET_L. |
Compress | TD_LZ_COMPRESS | Compresses any supported ALC data type or predefined type data using Lempel-Ziv coding. |
Decompress | TD_LZ_DECOMPRESS | Uncompresses any supported ALC data type or predefined type data that was compressed using TZ_LZ_COMPRESS. |
Compress | TS_COMPRESS | Compresses TIME and TIMESTAMP data. |
Decompress | TS_DECOMPRESS | Uncompresses TIME and TIMESTAMP data that was compressed using TS_COMPRESS. |
Compress | JSON_COMPRESS | Compresses JSON data. |
Decompress | JSON_DECOMPRESS | Uncompresses the JSON data that was compressed using JSON_COMPRESS. |
For more information about these functions, see Teradata Vantage™ - SQL Functions, Expressions, and Predicates, B035-1145.
If these functions do not provide optimal compression for your data, you may implement your own UDFs for use in compressing and uncompressing table columns. For more information, see “Defining Functions for Algorithmic Compression” in Teradata Vantage™ - SQL External Routine Programming , B035-1147 .