Thursday, September 18, 2008

Compressed tables and indexes

# create a compressed table
create table orderaudit_compress_pf0_32k compress pctfree 0 tablespace orderaudit_32k nologging as select * from bobj_login.orderaudit
where rownum < 1000000;

# create a compressed index
CREATE INDEX IDX_AUDIT_IDVER_CMP_32K ON orderaudit_nocompress_32k
(UNIQUEID, OBJECTVERSION)
COMPRESS 2
LOGGING
TABLESPACE orderaudit_32k
PARALLEL ( DEGREE 7 INSTANCES 1 );