16.20 - Example: Adding and Changing Algorithmic Compression - Teradata Database - Teradata Vantage NewSQL Engine

Teradata Vantage™ SQL Data Definition Language Syntax and Examples

Product
Teradata Database
Teradata Vantage NewSQL Engine
Release Number
16.20
Published
March 2019
Content Type
Programming Reference
Publication ID
B035-1144-162K
Language
English (United States)
Last Update
2019-05-24

These examples use the following table definition.

     CREATE TABLE Pendants (
       col_1 INTEGER, 
       col_2 CHARACTER (10));

This example adds column c3, which specifies algorithmic compression, to table Pendants.

     ALTER TABLE Pendants 
     ADD col_3 CHARACTER(30) COMPRESS USING compress_udf 
                             DECOMPRESS USING decompress_udf;

This example adds column c3, which specifies algorithmic and multivalue compression, to table Pendants.

     ALTER TABLE Pendants 
     ADD col_3 CHARACTER(30) COMPRESS ('amethyst', 'amber')
                             COMPRESS USING compress_udf 
                             DECOMPRESS USING decompress_udf;

This example changes the definition of Pendants.col_2 to add algorithmic compression. Because Pendants is empty, this ALTER TABLE request completes without error.

     ALTER TABLE Pendants 
     ADD col_2 CHARACTER(10) COMPRESS 
                             COMPRESS USING compress_udf 
                             DECOMPRESS USING decompress_udf;

This example is the same as the previous example except that a row has been added to Pendants. Because Pendants is not empty, the system returns an error to the requestor.

     INSERT INTO Pendants(1, 'amber');
     ALTER TABLE Pendants 
     ADD col_2 CHARACTER(10) COMPRESS 
                             COMPRESS USING compress_udf 
                             DECOMPRESS USING decompress_udf;