ibm db2 9.7 for linux, unix, and windows storage optimization

26
1 © 2009 IBM Corporation © 2009 IBM Corporation IBM DB2 9.7 for Linux, UNIX, and Windows Storage Optimization Compression options with SAP Applications regarding > Space Savings > Performance Benefits > Resource Impact © 2009 IBM Corporation IBM SAP DB2 Center of Excellence Thomas Rech, IBM Hans-Juergen Moldowan, IBM Thomas Rech, Hans-Jürgen Moldowan, Andreas Christian, Waldemar Gaida

Upload: others

Post on 12-Sep-2021

11 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: IBM DB2 9.7 for Linux, UNIX, and Windows Storage Optimization

1 © 2009 IBM Corporation© 2009 IBM Corporation

IBM DB2 9.7 for Linux, UNIX, and Windows

Storage Optimization

Compression options with SAP Applications regarding

> Space Savings

> Performance Benefits

> Resource Impact

© 2009 IBM Corporation

IBM SAP DB2 Center of Excellence

Thomas Rech, IBMHans-Juergen Moldowan, IBM

Thomas Rech, Hans-Jürgen Moldowan, Andreas Christian, Waldemar Gaida

Page 2: IBM DB2 9.7 for Linux, UNIX, and Windows Storage Optimization

2 © 2009 IBM Corporation© 2009 IBM Corporation

Important Disclaimer

THE INFORMATION CONTAINED IN THIS PRESENTATION IS P ROVIDED FOR INFORMATIONAL PURPOSES ONLY.

WHILE EFFORTS WERE MADE TO VERIFY THE COMPLETENESS AND ACCURACY OF THE INFORMATION CONTAINED IN THIS PRESENTATION, IT IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI ED.

IN ADDITION, THIS INFORMATION IS BASED ON IBM’S CUR RENT PRODUCT PLANS AND STRATEGY, WHICH ARE SUBJECT TO CHANGE BY IBM WITHOUT NOTICE.

IBM SHALL NOT BE RESPONSIBLE FOR ANY DAMAGES ARISIN G OUT OF THE USE OF, OR OTHERWISE RELATED TO, THIS PRESENTATION OR ANY OTHER DOCUMENTATION.

NOTHING CONTAINED IN THIS PRESENTATION IS INTENDED TO, OR SHALL HAVE THE EFFECT OF:

CREATING ANY WARRANTY OR REPRESENTATION FROM IBM (OR ITS AFFILIATES OR ITS OR THEIR SUPPLIERS AND/OR LICENSORS); OR

ALTERING THE TERMS AND CONDITIONS OF THE APPLICABLE LICENSE AGREEMENT GOVERNING THE USE OF IBM SOFTWARE.

Page 3: IBM DB2 9.7 for Linux, UNIX, and Windows Storage Optimization

3 © 2009 IBM Corporation© 2009 IBM Corporation

Trademarks

IBM, the IBM logo, ibm.com, AIX and DB2 are tradema rks of International Business Machines Corp., regis tered in many jurisdictions worldwide. Other product and ser vice names might be trademarks of IBM or other comp anies. A current list of IBM trademarks is available on th e Web at www.ibm.com/legal/copytrade.shtml.

Linux is a registered trademark of Linus Torvalds i n the United States, other countries, or both.

Windows is a trademark of Microsoft Corporation in the United States, other countries, or both.

UNIX is a registered trademark of The Open Group in the United States and other countries.

SAP, SAP NetWeaver, SAP Business Information Wareho use, SAP BW, SAP NetWeaver BW and other SAP products and services mentioned herein are trademar ks or registered trademarks of SAP AG in Germany an d in several other countries.

Other company, product and service names may be tra demarks or service marks of others.

Page 4: IBM DB2 9.7 for Linux, UNIX, and Windows Storage Optimization

4 © 2009 IBM Corporation© 2009 IBM Corporation

Agenda

• Options for Storage Savings with IBM ®

DB2® for UNIX ®, Linux ®, and Windows ®

• Overview of storage savings with DB2 compression

• Test results with Index compression

• Additional Options for Storage Efficiency

Page 5: IBM DB2 9.7 for Linux, UNIX, and Windows Storage Optimization

5 © 2009 IBM Corporation© 2009 IBM Corporation

What customers want to knowabout DB2 9.7 Storage Optimization

• What is the recommended approach to deploy DB2 compression?

• How much storage can be actually saved with thedifferent types of SAP applications?

• How do the different types of DB2 compression affectsystem performance?

• How does DB2 compression affect utilization of hardware resources like CPU, memory, and IO?

Page 6: IBM DB2 9.7 for Linux, UNIX, and Windows Storage Optimization

6 © 2009 IBM Corporation© 2009 IBM Corporation

DB2 with SAP offers several techniques to compress data

• Value Compression (not discussed here)

• Backup Compression (not discussed here)

• Row Compression

• Deferred Table Creation

• Index Compression

• Temporary Table Compression

• LOB Inlining + Row Compression

New with DB2 9.7

New with DB2 9.7

DB2 9.7 – Storage Optimization Options

New with DB2 9.7

Page 7: IBM DB2 9.7 for Linux, UNIX, and Windows Storage Optimization

7 © 2009 IBM Corporation© 2009 IBM Corporation

DB2 Row Compression

RCLNT GL_SIRID RLDNR RRCTY RVERS RYEAR RTCUR RUNIT DRCRK POPER DOCCT DOCNR DOCLN RBUKRS RPRCTR RHOART800 4751 8A 0 0 1995 DEM S 1 A 21 1 1000 1402 2800 4752 8A 0 0 1995 DEM S 1 A 21 2 1000 1402 2800 4753 8A 0 0 1995 DEM S 1 A 21 3 1000 1402 2800 4754 8A 0 0 1995 DEM S 1 A 22 1 1000 1402 2800 4755 8A 0 0 1995 DEM S 1 A 22 2 1000 1402 2

BWART BLART

……

1000,1402F’67t

8A,0,0,1995,DEM,,S,1,Ax’01C

800 4751 x’01C 21 1 F’67t 0800 4752 x’01C 21 2 F’67t 0800 4753 x’01C 21 3 F’67t 0800 4754 x’01C 22 1 F’67t 0800 4755 x’01C 22 2 F’67t 0

Compression dictionary

Uncompressed table

Compressed table

Common sequences of consecutive bytes in rows are replaced with symbols.

Page 8: IBM DB2 9.7 for Linux, UNIX, and Windows Storage Optimization

8 © 2009 IBM Corporation© 2009 IBM Corporation

Compressing Tables

• Enable Row Compression• Create a new table with the “COMPRESS YES” option• Alter an existing table with the “COMPRESS YES” option

• Compressing Data• Table Reorganization (offline)• Dictionary creation with DB2 INSPECT (online)• DB2 Automatic Dictionary Creation (ADC)

• Tools• R3load with COMPRESS (optionally with sampling): During SAP

Installation / Migration. Refer to http://www.redbooks.ibm.com/Redbooks.nsf/RedbookAbstracts/sg247774.html?Open

• DB6CONV table move (online / offline): SAP note 362325• Report /ISIS/ZCOMP: SAP note 980067• SAP DBA Cockpit

Page 9: IBM DB2 9.7 for Linux, UNIX, and Windows Storage Optimization

9 © 2009 IBM Corporation© 2009 IBM Corporation

Batch support via SAP scheduling

Integrated into SAP GUI

Enabling Compression – Online with DB6CONV

Page 10: IBM DB2 9.7 for Linux, UNIX, and Windows Storage Optimization

10 © 2009 IBM Corporation© 2009 IBM Corporation

Tables for Table Compression

0

5

10

15

20

25

30

35

40

1 4 7 10 13 16 19 22 25 28 31 34 37 40 43 46 49 52 55 58 61 64 67 70 73 76 79 82 85 88 91

Compression

Largest N Tables compressed

Sto

rage

Sav

ings

(%)

Dependency between numberof compressed tables and corresponding storagesavings.

Rule of thumb for selection of tables for compression: Select all tables which are larger than 1‰ of the total DB sizeand exclude SAP Tableclusters from the list.

Tableclusters typically do notcompress very well as theyare already compressed bySAP.

Enabling DB2 Row Compression

Page 11: IBM DB2 9.7 for Linux, UNIX, and Windows Storage Optimization

11 © 2009 IBM Corporation© 2009 IBM Corporation

The table shows compression results – Overall database size DB2 vs. Other:

Percent value indicates the percentage of saved space .

Both, the DB2 and the source database have been fully reorganized .

Comparisons with not fully reorganized databases are marked with *

SAPBISource (GB) DB2 Compressed (GB) Compression Ratio (%) Comment

2305,00 1338,00 41,953210,00 2216,00 30,97

931,00 589,00 36,731795,00 1450,00 19,22

739,00 594,00 19,621283,00 715,00 44,27

SAP ERPSource (GB) DB2 Compressed (GB) Compression Ratio (%)

3686,40 1740,80 52,782745,00 1440,52 47,52

129,00 81,00 37,211382,00 690,00 50,071316,00 474,00 63,98 *

971,00 432,00 55,51 *

1171,00 670,00 42,782027,00 1102,00 45,63

660,00 373,00 43,48652,00 377,00 42,18195,00 78,00 60,00 *

Space Savings with DB2 Row Compression

Page 12: IBM DB2 9.7 for Linux, UNIX, and Windows Storage Optimization

12 © 2009 IBM Corporation© 2009 IBM Corporation

DB2 Index Compression

• Introduced with DB2 9.7

• Comprises 3 different techniques to compress Indexe s

• Variable slot directory

• RID list compression

• Prefix Compression

• DB2 automatically selects a combination of the best compression algorithms for each index

Page 13: IBM DB2 9.7 for Linux, UNIX, and Windows Storage Optimization

13 © 2009 IBM Corporation© 2009 IBM Corporation

DB2 Index Compression – Variable Slot Directory

• In uncompressed indexes, the slot directory is pre-al located with a fixed size

• With index compression, the slot directory has a variab le size

Page Header

Slot DirectorySaved Space

BBB,1,ZZY 014,017

BBB,1,ZY 021, 022, 023

AAA,1,ZY 005,007,008,009,010,012,013

AAA,1,ZX 001, 002, 004

Page 14: IBM DB2 9.7 for Linux, UNIX, and Windows Storage Optimization

14 © 2009 IBM Corporation© 2009 IBM Corporation

DB2 Index Compression – RID List Compression

• In non-unique indexes, key values may have multiple record identifiers (RIDs).

• With RID list compression, instead of storing each RID explicitly, only the first RID of a key value is stored. All subsequent RIDs a re referenced by a delta offset to its predecessor

Compression

Examples:

022 = 021+1

023 = 021+1+1

017 = 014+3

Page 15: IBM DB2 9.7 for Linux, UNIX, and Windows Storage Optimization

15 © 2009 IBM Corporation© 2009 IBM Corporation

DB2 Index Compression – Prefix Compression

• Index key values are stored in sorted order within index pages.

• It is very likely that adjacent key values have a c ommon prefix.

• Instead of repeating these prefixes multiple times, in compressed indexes these repeating patterns are stored only on ce inside theindex page

Compression

Page 16: IBM DB2 9.7 for Linux, UNIX, and Windows Storage Optimization

16 © 2009 IBM Corporation© 2009 IBM Corporation

Compressing Indexes

• Enable Index Compression:

• When a table on DB2 9.7 is created with the “COMPRESS YES”option, all its indexes will also be created with the compression option.

• Create an index on DB2 9.7 with the “COMPRESS YES” option

• For existing Indexes, compression can be enabled with the “ALTER INDEX <SAP-SCHEMA>.<INDEX-NAME> COMPRESS YES ”statement

• Compression-enabled existing Indexes are compressed b y either

• Reorganizing them

• Dropping and re-creating them

Page 17: IBM DB2 9.7 for Linux, UNIX, and Windows Storage Optimization

17 © 2009 IBM Corporation© 2009 IBM Corporation

DB2 Index Compression – Compression Results

45,7%59,9%31,7%Storage savings with data and index compression.

11,7%9,9%13,7%Additional savings with Index Compression

34%50%18%Storage savings with row compression only

33%37%43%Compression rate index

49%69%29%Compression rate data

890 GB41 GB108 GBDB size compressed

1640 GB103 GB159 GBDB size uncompressed

SAP NetWeaver BW 7.0SAP NetWeaver 7.1 for banking services from SAP

SAP ECC 6.0 IDESTest Scenario

Page 18: IBM DB2 9.7 for Linux, UNIX, and Windows Storage Optimization

18 © 2009 IBM Corporation© 2009 IBM Corporation

SAP Banking – Performance Test Results

8,84

8,42

8,92

1,03

1,07

1,00

8,10

8,20

8,30

8,40

8,50

8,60

8,70

8,80

8,90

9,00

Data+Index CompressionData CompressionNo Compression

Thr

ough

put (

DS

/sec

)

0,96

0,98

1,00

1,02

1,04

1,06

1,08

Per

form

ance

Fac

tor

Dialog Processing

Batch Processing

Page 19: IBM DB2 9.7 for Linux, UNIX, and Windows Storage Optimization

19 © 2009 IBM Corporation© 2009 IBM Corporation

SAP BW 7.0 – Query Results

Runtime of Queries

148 14355 38 56 47

350 366

258206

263 247

1455 1445

1283 12721322 1312

744 782

533 508576

525

0

200

400

600

800

1000

1200

1400

1600

DB2 9.7 cold DB2 9.7 warm DB2 9.7 DataCompression

cold

DB2 9.7 DataCompression

warm

DB2 9.7 Data +Index

Compressioncold

DB2 9.7 Data +Index

Compressionwarm

Tim

e (S

econ

ds)

Query A

Query B

Query C

Query D

� DB2 DPF with 4 logical partitions, 320 MB bufferpool and 2 CPU

Page 20: IBM DB2 9.7 for Linux, UNIX, and Windows Storage Optimization

20 © 2009 IBM Corporation© 2009 IBM Corporation

DB2 Index Compression – Performance Results

-8%-4,5%-2%IO WAIT CPU with data + index compression

+5%+3%+3%USR + SYS CPU with data + index compression

+7,8%+6%+ 6%Performance with data + index compression

+9,2%+2,5%+ 4%Performance with data compression

SAP NetWeaver BW 7.0 - Query

SAP NetWeaver 7.1 for banking services from SAP - Batch

SAP NetWeaver 7.1 for banking services from SAP - Dialog

Test Scenario with Performance and Resiurce Usage

Page 21: IBM DB2 9.7 for Linux, UNIX, and Windows Storage Optimization

21 © 2009 IBM Corporation© 2009 IBM Corporation

Temporary Table Compression

• Dictionary based approach, similar to row compression

• Is automatically enabled with the DB2 Storage Optimization Feature license

• No need for user intervention

• DB2 automatically decides whether it makes sense to compress temporary tables

• Monitoring via db2pd db2pd -db hjm -temptable

System Temp Table Stats:

Number of System Temp Tables : 1

Comp Eligible Sys Temps : 1

Compressed Sys Temps : 1

Total Sys Temp Bytes Stored : 1631194339

Total Sys Temp Bytes Saved : 591049041

Total Sys Temp Compressed Rows : 24347817

Total Sys Temp Table Rows: : 25966175

Page 22: IBM DB2 9.7 for Linux, UNIX, and Windows Storage Optimization

22 © 2009 IBM Corporation© 2009 IBM Corporation

DB2 for SAP - Virtual tables

DROP TABLE

INSERT, UPDATE, DELETEMERGELOCK TABLECREATE TRIGGERALTER TABLE VOLATILEALTER TABLE ADD columnALTER TABLE ALTER column

CREATE INDEXALTER TABLE ADD PRIMARY KEYDROP TABLEALTER TABLE DROP PRIMARY KEY

TRUNCATE TABLE

Create Table:

CREATE TABLE + CREATE INDEX + CREATE PRIMARY KEY +Recreate depending objects

Change View Definition:

DROP VIEW +CREATE VIEW with modified view text

Ignore error

DROP VIEW

SQL0150, SQL0156

SQL0150, SQL0156

SQL0159

SQL3193

CREATE VIEW "TDATASET" AS SELECT * FROM ( VALUES ( CAST ( NULL AS VARCHAR(9)), CAST ( NULL AS VARCHAR(39)), CAST ( NULL AS VARCHAR(90) ), CAST ( NULL AS VARCHAR(24)) , CAST ( NULL AS VARCHAR(24)), CAST ( NULL AS VARCHA R(3)), CAST ( NULL AS VARCHAR(396)), CAST ( NULL AS VARCHAR(3)), CAST ( NULL AS VARCHAR(3)), CAST ( NULL AS VARCHAR( 36) ), CAST ( NULL AS VARCHAR(24) ), CAST ( NULL AS VARCHAR(18) ), CAST ( NULL AS VARCHAR(36)), CAST ( NULL AS V ARCHAR(24)), CAST ( NULL AS VARCHAR(18) ) ) ) AS " TDATASET " ( "MAND T", "FIELD", "CATT", "ID_DATAGRP", "SET_NR", "SPRSL ", "VALUE", "NAME_CHANGE", "INACTIVE", "LUSER", "LDATE", "LTIME ", "FUSER ", "FDATE", "FTIME" ) WHERE 1 = 2 --DDL_TABLE CREATE TABLE "TDATASET" ("MANDT" S APDB6VARCHAR(000003) DEFAULT '000' NOT NU LL, "FIELD" SAPDB6VARCHAR(000013) DEFAU LT ' ' NOT NULL, "CATT" SAPDB6VARCHAR(000030) DEFAU LT ' ' NOT NULL, "ID_DATAGRP" ….

Empty tables are created as view and materialized only when needed.

More information: http://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/e02a282a-868c-2b10-0e93-da0bb5abf461

Page 23: IBM DB2 9.7 for Linux, UNIX, and Windows Storage Optimization

23 © 2009 IBM Corporation© 2009 IBM Corporation

DB2 for SAP - Virtual tables

Up to 65% of all tables of a SAP applications can be empty

The deferred table feature is transparent for SAP applications and tools

Page 24: IBM DB2 9.7 for Linux, UNIX, and Windows Storage Optimization

24 © 2009 IBM Corporation© 2009 IBM Corporation

DB2 for SAP - Virtual tables

Enablement also during Migration unsing the ‘DEF_CRT' Option with R3load.

Empty tables consume system resources, for example for Automatic Runstats, Automatic Reorg, and Monitoring jobs.

Page 25: IBM DB2 9.7 for Linux, UNIX, and Windows Storage Optimization

25 © 2009 IBM Corporation© 2009 IBM Corporation

DB2 for SAP – LOB Inlining

• Large Objects (LOBs) are stored in a different loca tion than their base table. Link via a LOB descriptor

• DB2 9.7 introduced the functionality to inline smal ler LOBs as part of a table, with the following advantages• DB2 ROW compression applicable on inlined LOBs• Inlined LOBs are buffered in DB2 bufferpools• Reduced space allocation

• SAP support for DB2 9.7 and Kernel >= 7.00 based sy stems with a recent version of the DBSL. New data types are intr oduced for LCHR and LRAW fields• For existing installations that were upgraded to DB2 9.7, one needs to

copy tables (e.g. via DB6CONV) to translate to new data types and to enable Inlining

• More Information:• Enabling DB2 for LUW 97's LOB Inlining in an SAP Environment• http://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/d093

f443-934e-2c10-49b4-978fa1771ed4

Page 26: IBM DB2 9.7 for Linux, UNIX, and Windows Storage Optimization

26 © 2009 IBM Corporation© 2009 IBM Corporation

Summary

�DB2 with row compression is signifcantly smaller than otherdatabase plattforms. � For SAP ERP it typically saves between 40+%

� For SAP BW it saves between 20% and 40%

�DB2 index compression provides additional overall spacesavings between ~10% and 20%

�DB2 row compression improves performance: �2,5% to 4% with OLTP workload

�up to 30% with SAP BW queries

�DB2 compression increases CPU utilization (+3% to +6%) but reduces I/O wait time (-2% to -8%)

�DB2 compression drastically reduces both read and write I/O