19.06.2013 Views

DB2 UDB for z/OS Version 8 Performance Topics - IBM Redbooks

DB2 UDB for z/OS Version 8 Performance Topics - IBM Redbooks

DB2 UDB for z/OS Version 8 Performance Topics - IBM Redbooks

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

For dynamically prepared queries, <strong>DB2</strong> does not choose an index in RBDP <strong>for</strong> an access<br />

path.<br />

► Alter an index VARCHAR columns to be non padded<br />

Prior to <strong>DB2</strong> V8, varying length columns in indexes are padded to the maximum length<br />

specified by VARCHAR(length). <strong>DB2</strong> V8 provides a new default index option NOT<br />

PADDED. Varying length columns are no longer padded to the maximum length in index<br />

keys and index-only access becomes available <strong>for</strong> VARCHAR data.<br />

This enhancement could also reduce storage requirements since only the actual data is<br />

stored and the index tree level could be reduced.<br />

The index can be altered between PADDED and NOT PADDED but will be placed in<br />

RBDP.<br />

Note that <strong>DB2</strong> V6 introduced the DSNZPARM RETVLCFK. This parameter controls the<br />

ability of the Optimizer to use index-only access when processing VARCHAR columns that<br />

are part of an index. However, when one of the columns in the SELECT list of the query is<br />

retrieved from the index when using index-only access, the column is padded to the<br />

maximum length, and the actual length of the variable length column is not provided.<br />

There<strong>for</strong>e, an application must be able to handle these “full-length” variable length<br />

columns. <strong>DB2</strong> V7 enhances this feature by allowing index-only access against variable<br />

length columns in an index, even with RETVLCFK=NO, if no variable length column is<br />

present in the SELECT list of the query. <strong>DB2</strong> V8 supports true varying-length key columns<br />

in an index. Varying-length columns are not padded to their maximum lengths.<br />

<strong>Version</strong>ing<br />

To support online schema evolution, <strong>DB2</strong> has implemented a new architecture, called<br />

versioning, to track object definitions at different times during its life by using versions.<br />

Altering existing objects may result in a new <strong>for</strong>mat <strong>for</strong> tables, table spaces, or indexes which<br />

indicates how the data should be stored and used. Since all the data <strong>for</strong> an object and its<br />

image copies cannot be changed immediately to match the <strong>for</strong>mat of the latest version,<br />

support <strong>for</strong> migrating the data over time in some cases is implemented by using versions of<br />

tables and indexes. This allows data access, index access, recovery to current, and recovery<br />

to a point-in-time while maximizing data availability.<br />

Availability considerations<br />

Today, when an index is in Rebuild Pending (RBDP), the optimizer is unaware of that and can<br />

still pick that index during access path selection when you are executing a query.<br />

In <strong>Version</strong> 8, <strong>DB2</strong> will try to avoid using indexes in RBDP <strong>for</strong> dynamically prepared queries.<br />

<strong>DB2</strong> will bypass indexes in Rebuild Pending (index is ignored):<br />

► For all DELETE processing<br />

► For all non-unique indexes <strong>for</strong> UPDATEs and INSERTs<br />

► A unique index in RBDP cannot be avoided <strong>for</strong> UPDATE or INSERT because <strong>DB2</strong> needs<br />

the index to be available to be able to en<strong>for</strong>ce uniqueness.<br />

The <strong>DB2</strong> optimizer treats RBDP indexes as follows:<br />

► Dynamic PREPARE:<br />

– Indexes in RBDP are avoided.<br />

► Cached statements:<br />

– If the statement is cached, the PREPARE is bypassed. But if the index is used by the<br />

statement that is cached, it is invalidated by the ALTER.<br />

232 <strong>DB2</strong> <strong>UDB</strong> <strong>for</strong> z/<strong>OS</strong> <strong>Version</strong> 8 Per<strong>for</strong>mance <strong>Topics</strong>

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!