Run the four statements in the Ad Hoc command window to the right.

This step shows you how to compress existing tables.

Create and load the compression table

The first statement creates a new table CUSTOMER_ADDRESS_WITH_COMPRESSION. All the rows from the original CUSTOMER_ADDRESS_WITHOUT_COMPRESSION table are selected and inserted in the new table. The two tables are identical in size.

Turn on compression

The ALTER TABLE command switches on row compression for the CUSTOMER_ADDRESS_WITH_COMPRESSION table, but nothing is compressed until the final step.

Reorganize with compression

The reorganization (REORG) command samples the table data, builds a compression dictionary and compress the data. After the REORG, any additional data inserted into the table is also compressed.