- Use the COMPRESS phrase in a CREATE TABLE or ALTER TABLE statement to specify a list of frequently occurring values for the column that contains the values, for example:
CREATE TABLE Employee (EmpNo INT NOT NULL, EmpLoc CHAR(30) COMPRESS ('Seattle','Dallas','Chicago') ... DOB DATE COMPRESS (DATE '1972-02-29', DATE '1976-02-29') ...);
- The system compresses the specified values when data moves into the table, and uncompresses the values when the containing rows are accessed.
- The system automatically compresses NULLs when you specify COMPRESS.
- Compressing values in a table can cause the dictionary cache to overflow. If this happens increase your dictionary cache to the default value of 1 MB.
- You cannot apply MVC to row-level security columns.
You can use MVC to compress columns with these data types:
- Any numeric data type
- BYTE
- VARBYTE
- CHARACTER
- VARCHAR
- DATE
To compress a DATE value, you must specify the value as a Date literal using the ANSI DATE format (DATE 'YYYY-MM-DD'). For example:
COMPRESS (DATE '2000-06-15')
- TIME and TIME WITH TIME ZONE
- TIMESTAMP and TIMESTAMP WITH TIME ZONE
To compress a TIME or TIMESTAMP value, you must specify the value as a TIME or TIMESTAMP literal. For example:
COMPRESS (TIME '15:30:00')
COMPRESS (TIMESTAMP '2006-11-23 15:30:23')
You can also use COMPRESS (NULL) for columns with these data types:
- ARRAY
- Period