15.10 - COMPRESS USING - Teradata Database

Teradata Database SQL Data Definition Language Syntax and Examples

prodname
Teradata Database
vrm_release
15.10
created_date
December 2015
category
Programming Reference
featnum
B035-1144-151K
Algorithmic compression (ALC) for a column with one of the following data types:
  • ARRAY/VARRAY
  • BLOB, BLOB-related UDT
  • BYTE
  • CHARACTER
  • CLOB, CLOB-related UDT
  • Geospatial
  • GRAPHIC
  • JSON
  • TIME, TIME WITH TIME ZONE, TIMESTAMP, or TIMESTAMP WITH TIME ZONE
  • XML

You can use algorithmic compression on Distinct UDTs, but not Structured UDTs.

You can also specify COMPRESS USING for a column in a volatile table. To specify COMPRESS USING compress_UDF_name, the table cannot be populated with rows. If you specify COMPRESS USING, you must also specify DECOMPRESS USING. The COMPRESS USING and DECOMPRESS USING options can be specified in either order. When you specify algorithmic compression, the data is compressed, if possible, to a smaller amount of space than it currently requires. You can specify multivalue compression and algorithmic compression for the same column. Algorithmic compression is only applied to values that are not specified for multivalue compression. For a column-partitioned table, the column partition that includes the column can have autocompression. You can combine multivalue compression, algorithmic compression, autocompression (for a column-partitioned table), and block-level compression for the same table to achieve better compression, but as a general rule you should not use algorithmic compression with block-level compression because of the possibility of a negative performance impact for other workloads. Teradata provides external UDFs for algorithmic compression and decompression. See “Compression/Decompression Functions” in SQL Functions, Operators, Expressions, and Predicates, B035-1145.

compress_UDF_name
Name of the UDF to algorithmically compress data in this column. The default containing database for compress_UDF_name is SYSUDTLIB. If compress_UDF_name is an embedded services UDF, then its default containing database is TD_SYSFNLIB. If compress_UDF_name is not contained in SYSUDTLIB or TD_SYSFNLIB, the system returns an error to the requestor.