Professional Documents
Culture Documents
DB2 9.7 For LUW New Feature - Index Compression
DB2 9.7 For LUW New Feature - Index Compression
DB2 9.7 For LUW New Feature - Index Compression
Examples:
% db2 reorg table MARA index MARA~T
In the following example, only index MARA~T is compressed:
% db2 reorg indexes all for table MARA
In the following example, all the indexes belonging to the table MARA are compressed:
% db2 reorg indexes all for table MARA inplace
In this example, all indexes in table MARA are compressed while allowing user access.
If you want to compress both data and indexes at the same time, you can run the REORG TABLE command
(after setting the compression attribute to Y on both indexes and data). Note that in this case, the REORG
operation must be performed offline.
If you want to drop and re-create the indexes as compressed, you do not have to perform the REORG
operation.
Example:
% db2 reorg table MARA
To run the REORG command on multiple tables, you can use a script similar to the example used in the
previous section.
Example:
To compress all the indexes in your database, issue the following command:
% db2 -x "select 'reorg indexes all for table ' || CHR(34) || RTRIM(tabschema) || CHR(34) || '.' || CHR(34) ||
TABNAME || CHR(34) || ';' from syscat.tables" > reorg_indexes.clp
SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com
2009 SAP AG 15
DB2 9.7 for LUW New Feature: Index compression
A CLP script is generated that you can be execute as follows:
% db2 tvf reorg_indexes.clp
To verify that the indexes have been compressed, use the same admin function,
ADMIN_GET_INDEX_COMPRESS_INFO. To receive an accurate value for PCT_PAGES_SAVED, you
have to perform an RUNSTATS.
Example:
db2 => select INDNAME, COMPRESS_ATTR, INDEX_COMPRESSED, PCT_PAGES_SAVED from table (
admin_get_index_compress_info ('T', 'SAPLR1', 'MARA', 0, 0)) as t
INDNAME COMPRESS_ATTR INDEX_COMPRESSED PCT_PAGES_SAVED
---------------------------------------------------------------------------------------------------------------
MARA~0 Y Y 31
MARA~A Y Y 71
MARA~L Y Y 57
MARA~O Y Y 71
MARA~PMA Y Y 71
MARA~T Y Y 57
6 record(s) selected.
Note: To deactivate index compression, you can either re-create the indexes without compression or alter the indexes
using the following SQL statement:
ALTER INDEX --- index-name COMPRESS NO
Afterwards, you should perform an index REORG to disable index compression.
SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com
2009 SAP AG 16
DB2 9.7 for LUW New Feature: Index compression
Index Compression Tool
The ABAP-based row compression tool has been extended by SAP to enable index compression. Using
these additions, you can identify the indexes that are suitable for compression and have these indexes
compressed online. The row compression tool is available as a transport and you can install it using
transaction STMS or using the tp command for Unicode systems.
For the purpose of this article, we shall only discuss the new additions to the tool. For more information about
the row compression tool, see SAP Note 980067.
This addition is available with DB2 LUW 9.7 only and will not be visible if you run the tool on a previous DB2
version. Full index compression support is also planned for the next update of the DBA Cockpit.
Enabling Tables for Data and Index Compression
1. In your SAP system, call transaction SE38 and enter /ISIS/ZCOMP for the program name.
The Enabling Tables for Row Compression screen appears:
The following tab pages are available::
SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com
2009 SAP AG 17
DB2 9.7 for LUW New Feature: Index compression
Tab Page Description.
Candidates Lists all the tables that are suitable for data and index compression
Indexes Lists all the tables that have their data compressed (or enabled for
compression) but not the indexes
Compressed Lists all the tables that have both data and indexes compressed
Exception Lists all the tables that you do not want to be compressed. To
remove a table from that list, select the respective row and choose
Delete from Exception.
Export Includes a list of tables that have been compressed and a sample
has been generated to be used for migration and system copy. For
more information, please review the SAP system copy guide for the
required release.
By default, the candidates that are suitable for data and index compression are displayed on the
Candidates tab page.
2. To identify tables that are candidate for compression, choose Identify Candidates for Compression.
The dialog box Schedule Job to Identify Table Candidates appears.
3. Enter the number of tables that you would like to retrieve and start the job by choosing OK.
A new list of candidates is displayed on the Candidates tab page after that job is completed.
SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com
2009 SAP AG 18
DB2 9.7 for LUW New Feature: Index compression
4. To estimate the storage saving for one or more tables, select the table(s) from the list and choose
the Estimate pushbutton.
The dialog box Schedule Job to Estimate Storage Savings appears:
5. Specify the time when you want the job to run and choose OK.
6. On the Enabling Tables for Row Compression screen, choose Refresh View. The latest estimated
savings as well as the timestamp of the latest compression estimate are displayed.
SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com
2009 SAP AG 19
DB2 9.7 for LUW New Feature: Index compression
7. To enable tables for compression, select the respective table(s) and choose Compress.
The dialog box Schedule Row Compression J ob appears:
You can specify one of the following options:
Enable Table and Index Compression
Enables compression and an offline REORG is performed at a later point in time. In this
case, the table is enabled for compression and the catalog information is updated but the
actual data and indexes are not compressed. The table longer appears on the Candidates
tab page but will appear the Compressed tab page.
Enable Table and Index Compression, and Offline REORG
Enables compression and an offline REORG is performed at the same time. In this case, the
table is enabled for compression and is taken offline to compress data and indexes. This
action is followed by a RUNSTATS to update the statistical information of that table. If you
want to use a temporary tablespace, select Use Temporary Tablespace.
SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com
2009 SAP AG 20
DB2 9.7 for LUW New Feature: Index compression
Enabling Index Compression:
1. On the screen Enabling Tables for Row Compression, choose the Indexes tab page.
A list of all the tables is displayed that have their data compressed but not the indexes.
SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com
2009 SAP AG 21
DB2 9.7 for LUW New Feature: Index compression
2. To estimate the savings after index compression, select one or more tables and choose the
Estimate pushbutton.
3. Specify the time when you want the job to run and choose OK.
4. On the Enabling Tables for Row Compression screen, choose Refresh View. the latest
estimated savings as well as the timestamp of the latest compression estimate are displayed.
5. To enable index compression, select the respective table(s) and choose the Compress
pushbutton.
SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com
2009 SAP AG 22
DB2 9.7 for LUW New Feature: Index compression
The dialog box Schedule Index Compression Job appears:
You can specify one of the following options:
Enable Index Compression and Online Index REORG
Enables index compression and a REORG of all the indexes of that table is performed
online. This option enables index compression on all the indexes of the selected table(s)
and updates the system catalog data accordingly. The indexes are compressed while
the table is still online. This job is also followed by a RUNSTATS to update the table
statistics.
Offline Table and Index REORG
Enables data and index REORG. This option is used for tables that had the compression
attribute set but that have yet not been compressed. Choose this option to start an
offline REORG of the table (data and indexes). If you want to use a temporary
tablespace, select Use Temporary Tablespace
Enable Index Compression and Offline Index REORG
Enable index compression and perform an offline index REORG. This option is identical
to the first option except that the table is taken offline to perform this action.
SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com
2009 SAP AG 23
DB2 9.7 for LUW New Feature: Index compression
Restrictions
Index compression is not supported for the following:
Catalog indexes
MDC block indexes
XML path indexes and meta indexes
Index specifications
Case Study
A case study was performed in the lab on an SAP ERP customer database used for testing. The following
table outlines the results:
Original Size After Data and Index
Compression
Savings
DATA_P_SIZE 567187840 158071552
-72%
INDEX_P_SIZE 130968320 66381600
-49%
Total Size 698156160 224453152
-68%
From the table above, we notice that the total data size has decreased by 72% after data compression and
the total index size has decreased by 49% after index compression. The total database size has decreased
by 68% after compressing the data and indexes
SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com
2009 SAP AG 24
DB2 9.7 for LUW New Feature: Index compression
Related Content
Enabling DB2 for LUW 97's LOB Inlining in an SAP Environment
SSL Support in DB2 9.7 Running SAP ECC6 SR3 ABAP+J AVA system with SSL connections on DB2 Database
Temporary Table Compression
Enable Automatic Storage for Your SAP Database and Table Spaces
Reclaiming Space from Multidimensional Clustering (MDC) Tables
Reducing the High Water Mark
Rotating Diagnostic and Administration Notification Logs
SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com
2009 SAP AG 25
DB2 9.7 for LUW New Feature: Index compression
SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com
2009 SAP AG 26
Disclaimer and Liability Notice
This document may discuss sample coding or other information that does not include SAP official interfaces and therefore is not
supported by SAP. Changes made based on this information are not supported and can be overwritten during an upgrade.
SAP will not be held liable for any damages caused by using or misusing the information, code or methods suggested in this document,
and anyone using these methods does so at his/her own risk.
SAP offers no guarantees and assumes no responsibility or liability of any type with respect to the content of this technical article or
code sample, including any liability resulting from incompatibility between the content within this document and the materials and
services offered by SAP. You agree that you will not hold, or seek to hold, SAP responsible or liable with respect to the content of this
document.