17.10 - Example: Adding and Changing Algorithmic Compression - Advanced SQL Engine - Teradata Database

Teradata Vantage™ - SQL Data Definition Language Syntax and Examples

Product
Advanced SQL Engine
Teradata Database
Release Number
17.10
Release Date
July 2021
Content Type
Programming Reference
Publication ID
B035-1144-171K
Language
English (United States)

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;