15.00 - Meaning of the COMPRESS Attribute in Table DDL - Teradata Database

Teradata Database Design

prodname
Teradata Database
vrm_release
15.00
category
User Guide
featnum
B035-1094-015K

Meaning of the COMPRESS Attribute in Table DDL

The effect of a COMPRESS specification depends on the format of the definition.

 

IF COMPRESS is defined with …

THEN …

no argument

all nulls for the column are compressed to zero space.

one or more constant arguments

  • Each occurrence of a specified constant is compressed to zero space.
  • All nulls for the column are compressed to zero space.
  • The following CREATE TABLE fragment specifies that all occurrences of cashier, manager, and programmer for the jobtitle column as well as all nulls are to be compressed to zero space.

    This definition saves 30 bytes for each row whenever an employee has one of the following job titles:

  • Null
  • Cashier
  • Manager
  • Programmer
  •  
     CREATE TABLE employee (
       employee_number INTEGER
       ...
       jobtitle        CHARACTER(30) COMPRESS (’cashier’,
                       ’manager’, ’programmer’)
       ...
       );