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

SQL Data Definition Language Syntax and Examples

Product
Advanced SQL Engine
Teradata Database
Release Number
17.00
Published
September 2020
Language
English (United States)
Last Update
2021-01-23
dita:mapPath
wgr1555383704548.ditamap
dita:ditavalPath
lze1555437562152.ditaval
dita:id
B035-1144
lifecycle
previous
Product Category
Teradata Vantage™

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;