Oracle Database 11g Release 2 for SAP Advanced Compression Christoph Kersten Oracle Database for SAP Global Technology Center (Walldorf, Germany)
Oracle Database 11g Release 2 for SAPAdvanced Compression
Christoph KerstenOracle Database for SAP Global Technology Center (Walldorf, Germany)
<Insert Picture Here>
“Implicit Compression”
Efficient Use of Disk SpaceDisk Space Allocation (SAP ERP)
• Database too large?• Oracle saves disk space even
without explicit compression
Indexes
Structured Data
Unstructured Data
Efficient Use of Disk Space“Implicit” Compression (Oracle Database 10g)
• Database too large?• Oracle saves disk space even
without explicit compression• Internal Data Representation
• Variable length representation of number values
• Variable length representation of character strings
• Highly efficient bitmap index technology
Indexes
Structured Data
Secure Files
Efficient Use of Disk Space“Implicit” Compression (Oracle Database 11g)
• Database too large?• Oracle saves disk space even
without explicit compression• Internal Data Representation
• Variable length representation of number values
• Variable length representation of character strings
• Highly efficient bitmap index technology
• Object Space Allocation• Deferred Segment Creation• Dictionary Only Add Column
Indexes
Structured Data
Secure Files
<Insert Picture Here>
Explicit CompressionOverview
Data/Index CompressionSetting Realistic Expectations
Data/Index CompressionSetting Realistic Expectations
Type of Data % Disk Space Opt. Savings Min. SavingsIndex data 33% 23% 15%Structured data 55% 39% 25%Unstructured data 12% 8% 6%Overall 100% 70% 46%
• Optimal Savings:- all objects (100%) compressed- compression ratio of 70% on object level- result: disk space savings on database level
• Average Savings:- largest objects only compressed (80% of disk space used for this type)- compression ratio of 60% on object level- result: disk space savings on database level
Assumptions
<Insert Picture Here>
Index Key Compression
Persistent Bitmap Index
Bitmap Index
<Blue: 1000100100010010100><Green: 0001010000100100000>
<Red: 0100000011000001001><Yellow: 0010001000001000010>
Key Bitmap
Table
Oracle Index Key “Compression”Example 1
A ROWID01A ROWID02A ROWID03A ROWID04A ROWID05A ROWID06A ROWID07B ROWID08B ROWID09B ROWID10B ROWID11B ROWID12B ROWID13
Oracle Index Key “Compression”Example 1
A ROWID01A ROWID02A ROWID03A ROWID04A ROWID05A ROWID06A ROWID07B ROWID08B ROWID09B ROWID10B ROWID11B ROWID12B ROWID13
Oracle Index Key “Compression”Example 2
1 A X 1 A 1 ROWID011 A X 1 B 2 ROWID021 A X 2 A 3 ROWID031 A Y 1 B 4 ROWID041 A Y 3 C 5 ROWID051 A Y 3 C 6 ROWID061 A Y 3 D 7 ROWID071 B X 1 A 1 ROWID081 B X 1 A 2 ROWID091 B X 1 C 3 ROWID101 B X 3 A 4 ROWID111 B X 3 C 5 ROWID121 B X 3 C 6 ROWID13
Oracle Index Key “Compression”Example 2: Prefix = 1
1 A X 1 A 1 ROWID01A X 1 B 2 ROWID02A X 2 A 3 ROWID03A Y 1 B 4 ROWID04A Y 3 C 5 ROWID05A Y 3 C 6 ROWID06A Y 3 D 7 ROWID07B X 1 A 1 ROWID08B X 1 A 2 ROWID09B X 1 C 3 ROWID10B X 3 A 4 ROWID11B X 3 C 5 ROWID12B X 3 C 6 ROWID13
Prefix Suffix
12 valueseliminated
Oracle Index Key “Compression”Example 2: Prefix = 2
1 A X 1 A 1 ROWID01X 1 B 2 ROWID02X 2 A 3 ROWID03Y 1 B 4 ROWID04Y 3 C 5 ROWID05Y 3 C 6 ROWID06Y 3 D 7 ROWID07
1 B X 1 A 1 ROWID08X 1 A 2 ROWID09X 1 C 3 ROWID10X 3 A 4 ROWID11X 3 C 5 ROWID12X 3 C 6 ROWID13
Prefix Suffix
22 valueseliminated
Oracle Index Key “Compression”Example 2: Prefix = 3
1 A X 1 A 1 ROWID011 B 2 ROWID022 A 3 ROWID03
1 A Y 1 B 4 ROWID043 C 5 ROWID053 C 6 ROWID063 D 7 ROWID07
1 B X 1 A 1 ROWID081 A 2 ROWID091 C 3 ROWID103 A 4 ROWID113 C 5 ROWID123 C 6 ROWID13
Prefix Suffix
30 valueseliminated
Oracle Index Key “Compression”Example 2: Prefix = 4
1 A X 1 A 1 ROWID01B 2 ROWID02
1 A X 2 A 3 ROWID031 A Y 1 B 4 ROWID041 A Y 3 C 5 ROWID05
C 6 ROWID06D 7 ROWID07
1 B X 1 A 1 ROWID08A 2 ROWID09C 3 ROWID10
1 B X 3 A 4 ROWID11C 5 ROWID12C 6 ROWID13
Prefix Suffix
28 valueseliminated
Oracle Index Key “Compression”Example 2: Prefix = 5
1 A X 1 A 1 ROWID011 A X 1 B 2 ROWID021 A X 2 A 3 ROWID031 A Y 1 B 4 ROWID041 A Y 3 C 5 ROWID05
6 ROWID061 A Y 3 D 7 ROWID071 B X 1 A 1 ROWID08
2 ROWID091 B X 1 C 3 ROWID101 B X 3 A 4 ROWID111 B X 3 C 5 ROWID12
6 ROWID13
Prefix Suffix
15 valueseliminated
Oracle Index Key “Compression”Example 2: Prefix = 6
1 A X 1 A 1 ROWID011 A X 1 B 2 ROWID021 A X 2 A 3 ROWID031 A Y 1 B 4 ROWID041 A Y 3 C 5 ROWID051 A Y 3 C 6 ROWID061 A Y 3 D 7 ROWID071 B X 1 A 1 ROWID081 B X 1 A 2 ROWID091 B X 1 C 3 ROWID101 B X 3 A 4 ROWID111 B X 3 C 5 ROWID121 B X 3 C 6 ROWID13
Prefix Suffix
0 valueseliminated
Computing the Optimal Prefix Length
Efficient Use of Disk SpaceIndex Key Compression
Indexes
Structured Data
Secure Files
• Available in Oracle Database 10g and 11g
• Recommended as first step of compression implementation
• Best practices:• Compress indexes
on <n> largest tables• Use utility IND_COMP
(see SAP Note 1109743)
Efficient Use of Disk SpaceIndex Key Compression
Indexes
Structured Data
Secure Files
Free Space
• Available in Oracle Database 10g and 11g
• Recommended as first step of compression implementation
• Best practices:• Compress indexes
on <n> largest tables• Use utility IND_COMP
(see SAP Note 1109743)
• Disk Space Savings:• up to 75% on object level• 15-20% on DB level
<Insert Picture Here>
Table Compression
Data “Compression” AlgorithmStep 1: Find Repeating Values
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
January
January
January
January
January
January
January
February
February
February
February
February
Customer 1
Customer 2
Customer 3
Customer 1
Customer 2
Customer 3
Customer 1
Customer 1
Customer 3
Customer 3
Customer 2
Customer 1
500.00
480.00
360.00
475.00
600.00
555.00
200.00
365.00
510.00
120.00
800.00
380.00
Data “Compression” AlgorithmStep 2: Create Symbol Table
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
January
January
January
January
January
January
January
February
February
February
February
February
Customer 1
Customer 2
Customer 3
Customer 1
Customer 2
Customer 3
Customer 1
Customer 1
Customer 3
Customer 3
Customer 2
Customer 1
500.00
480.00
360.00
475.00
600.00
555.00
200.00
365.00
510.00
120.00
800.00
380.00
January
February
Customer 1
Customer 2
Customer 3
1
2
3
4
5
Data “Compression” AlgorithmStep 3: Replace Values by References
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
500.00
480.00
360.00
475.00
600.00
555.00
200.00
365.00
510.00
120.00
800.00
380.00
January
February
Customer 1
Customer 2
Customer 3
1
2
3
4
5
1
1
1
1
1
1
1
2
2
2
2
2
3
4
5
3
4
5
3
3
5
5
4
3
Table Data “Compression”The Main Issue
• You cannot allow every single INSERT or UPDATE to modify the symbol table• too much overhead for this process (performance problem)• too much locking (concurrency problem)
• The Oracle and DB2 implementations address this issue in different ways• different advantages• different disadvantages
Table Data “Compression”Implementation Option 1
xxxx xxxxxxxxx xxxxxxxxx xxxxxxxxx xxxxx
xxxx xxxxxxxxx xxxxxxxxx xxxxxxxxx xxxxx
xxxx xxxxxxxxx xxxxxxxxx xxxxxxxxx xxxxx
Symbol Table Data Block Data Block Data Block
One global symbol table per data segment (table), stored in dedicated blocks
xxxx xxxxx xxxx xxxxx xxxx xxxxx
Ý Ý
Ý Ý
Ý Ý
Ý Ý
Ý Ý
Ý Ý
Ý Ý
Ý Ý
Ý Ý
Ý Ý
Ý Ý
Ý Ý
Ý Ý
Ý Ý
Ý Ý
Table Data “Compression”Implementation Option 2
xxxx xxxxxÝ Ý
xxxx xxxxxÝ Ý
xxxx xxxxxÝ Ý
xxxx xxxxxÝ Ý
xxxx xxxxxxxxx xxxxxxxxx xxxxxxxxx xxxxx
xxxx xxxxxxxxx xxxxxxxxx xxxxxxxxx xxxxx
SymbolTables
Data Block Data Block Data Block
Many local symbol tables, each of them built from data in a single block,and stored in that particular block
xxxx xxxxxÝ Ý xxxx xxxxx xxxx xxxxx
Ý Ý
Ý Ý
Ý Ý
Ý Ý
Ý Ý
Ý Ý
Ý Ý
Ý Ý
Ý Ý
Ý Ý
Oracle 10g Data “Compression”Benefits & Limits
• Benefits• Unlimited number of compressed values• All data required for decompression in one single block• Compression ratio does not degrade due to new values• No manual rebuild of symbol table required
• Limits• Bulk load operations only
(no single-record INSERT, UPDATE)• Certified for SAP BI only
Efficient Use of Disk SpaceOLTP Compression (Adv. Compression Option)
• Users insert new records• These records are stored
uncompressed• This happens until a
predefined threshold is reached
xxx xxxxxxx xxxxxxxx xxxxxx xxxxxxx xxxxxxxx xxxxxx xxxxxxx xxxxxxxx xxxxxx xxxxxxx xxxxxxxx xxxxxx xxxxxxx xxxxxxxx xxxxxx xxxxxxx xxxxxxxx xxx
Efficient Use of Disk SpaceOLTP Compression (Adv. Compression Option)
• If the threshold is reached,data are compressed in batch mode
• The process• scans the data and builds
the symbol table in the block header
• compresses the records in this block
• After that, the block is again in phase 1 (available for new inserts)
xxx xxxxxxx xxxxxxxx xxxxxx xxxxxxx xxxxxxxx xxxxxx xxxxxxx xxxxxxxx xxx
xxx xxxxxxx xxxxxxxx xxxxxx xxxxxxx xxxxxxxx xxxxxx xxxxxxx xxxxxxxx xxx
xxx x xxxx xxx x xxxxxxx x xxxx xxx x xxxxxxx x xxxx xxx x xxxxxxx xxxxxxx xxxxxxxx xxxxxx xxxxxxx xxxxxxxx xxxxxx xxxxxxx xxxxxxxx xxx
Efficient Use of Disk SpaceStructured Table Data Compression
Indexes
Structured Data
Secure Files
Free Space
• Oracle Database 10g:• Batch compression• Works with batch loads only• Supported for SAP BW
• Oracle Database 11g:• Dynamic online compression
(OLTP compression)• Works for conventional DML
(Insert, Update)• Supported for all SAP
applications
• Completely transparent to applications
Efficient Use of Disk SpaceStructured Table Data Compression
Indexes
Structured Data
Secure Files
Free Space
• Oracle Database 10g:• Batch compression• Works with batch loads only• Supported for SAP BW
• Oracle Database 11g:• Dynamic online compression
(OLTP compression)• Works for conventional DML
(Insert, Update)• Supported for all SAP
applications
• Completely transparent to applications
<Insert Picture Here>
SecureFiles Compression
SecureFiles
• Significantly faster access times compared to LOBs in SAP environments
• Increased transaction throughput on SAP cluster tables especially with RAC
• Prerequisite for compression of SAP tables containing LOBs (e.g. cluster tables)
SAP VBDATA Throughput (Insert/Read/Delete)
0
0,5
1
1,5
2
2,5
1 2 4 8 16 32 64
row size in KB
Perf
orm
an
ce
Imp
rovem
en
t F
acto
r
LONGs (9.2,10.2) LOBs (10.2,11.2) Securefiles 11.2
SecureFiles Compression for SAPPart of Oracle Advanced Compression
• secureFiles Compression for inline and out-of-line LOB data• unique to Oracle for out-of-line LOBs
(IBM can only do inline compression) • out-of-line LOBs are more used than inline LOB data in SAP
products such as• SAP CRM• SAP XI• SAP Portal• SAP R/3 (almost all non-cluster tables use out-of-line LOBs
Efficient Use of Disk SpaceUnstructured Table Data Compression
Indexes
Structured Data
Secure Files
Free Space
• Secure Files• replaces previous data types
(LONG, LOB)• dramatically faster• prerequisite for compression
• Secure Files Compression• the only “real” compression
feature• no inlining of data required
Efficient Use of Disk SpaceUnstructured Table Data Compression
Indexes
Structured Data
Secure Files
Free Space
• Secure Files• replaces previous data types
(LONG, LOB)• dramatically faster• prerequisite for compression
• Secure Files Compression• the only “real” compression
feature• no inlining of data required
<Insert Picture Here>
Additional Compression Features
RMAN Backup Compression
• Compression levels are BASIC, LOW, MEDIUM and HIGH• Each affords a trade off related to backup throughput and the
degree of compression
• Run the following RMAN commands:RMAN> CONFIGURE DEVICE TYPE DISK BACKUP TYPE TO COMPRESSED BACKUPSET;
RMAN> CONFIGURE COMPRESSION ALGORITHM <'HIGH', 'MEDIUM', 'LOW', 'BASIC'>;
RMAN>BACKUP AS COMPRESSED BACKUPSET DATABASE;
RMAN>BACKUP AS COMPRESSED BACKUPSET ARCHIVELOG ALL;
RMAN>CONFIGURE COMPRESSION ALGORITHM 'ZLIB'; (ZLIB new 11.2 / BZIP2 <=11.2)
Data Guard Redo Transport Services
• Compress network traffic between primary and standby databases
• Lower bandwidth networks (<100Mbps) • 15-35% less time required to transmit 1 GB of data• Bandwidth consumption reduced up to 35%
• High bandwidth networks (>100 Mbps)• Compression will not reduce transmission time • But will reduce bandwidth consumption up to 35%
• Syntax:LOG_ARCHIVE_DEST_3='SERVICE=denver SYNC COMPRESSION=ENABLE|[DISABLE]’
Data Pump Compression
• Metadata compression available since Oracle Database 10g• Oracle Database 11g extends compression to table data during
exports• No need to decompress before import• COMPRESSION={ALL|DATA_ONLY|[METADATA_ONLY]|NONE}
• Single step compression of both data and metadata• Compressed data directly hits disk resulting in reduced disk space
requirements• Internal tests reduced dump file size up to 75%
• Application transparent• Complete Data Pump functionality available on compressed files
<Insert Picture Here>
Compression Benefits
Space Savings(Customer Production Databases)
Without Compression
With Compression and Other Space
Optimizations
FactorSpace Savings
Database(fully reorged)• ECC 6.0• BI 7.0• CRM 7.0
4,782 GB1,413 GB
950 GB
1,976 GB543 GB334 GB
2.42.62.8
RMAN Backup(for compressed database)
2,817 GB 667 GB 4.2
Export Data Pump 973 GB 156 GB 6.2
CompressionStorage vs. Performance?
• Disk Space Savings:• Up to 75% disk space can be saved on object level• DB size can be reduced by ca. 60% (avg.)
• Higher CPU consumption• More than compensated by reduced I/O• Overall throughput increased by 10-20%