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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

achieved by simply moving to <strong>DB2</strong> V8. <strong>DB2</strong> V8 is able to exploit the 64-bit interface into the<br />

z/<strong>OS</strong> Conversion Services, which is much more efficient than the 31-bit interface used by<br />

<strong>DB2</strong> V7. Next, we see a greater improvement by moving to the z990 hardware, which brings a<br />

number of specific hardware instructions to support Unicode conversion. Next, we introduce<br />

optimization in <strong>DB2</strong> V8 called “minor conversion”. FInally, we introduce further optimization in<br />

<strong>DB2</strong> V8 which in certain cases allows the system to avoid conversion.<br />

Now, we explore each of these enhancements in more detail.<br />

<strong>DB2</strong> V8 major and minor conversion<br />

Conversion of SQL statements and <strong>DB2</strong> object names generally involves English<br />

alphanumeric characters. For many years the <strong>DB2</strong> Catalog has been EBCIDC. To improve<br />

the per<strong>for</strong>mance of <strong>DB2</strong>, V8 developed a faster way to convert such characters without calling<br />

the z/<strong>OS</strong> Conversion Services. This faster way is called minor conversion. There<strong>for</strong>e, the term<br />

major conversion refers to those conversions per<strong>for</strong>med by the z/<strong>OS</strong> Conversion Services.<br />

<strong>DB2</strong> maintains a translate table associated with the EBCDIC SBCS/mixed CCSIDs that are<br />

specified during <strong>DB2</strong> installation. The same translate table is also used <strong>for</strong> access to the <strong>DB2</strong><br />

catalog and user data. Minor conversion is supported <strong>for</strong> all European EBCDIC character<br />

sets, and some Asian EBCDIC character sets. Minor conversion does not apply to UTF-16<br />

(GRAPHIC) or ASCII; it may only apply to conversions between EBCDIC and UTF-8.<br />

How does minor conversion work?<br />

The zSeries instruction set has always included a TR instruction that translates one byte <strong>for</strong><br />

one byte, based on a 256-byte translation table. A TRT instruction has also existed which<br />

could be used to test a string <strong>for</strong> certain one byte characters. As long as a single byte English<br />

alphanumeric character can be represented in UTF-8 by a single byte, a TR instruction can<br />

be used to convert the byte to UTF-8. <strong>DB2</strong> V8 has built-in translate tables <strong>for</strong> most common<br />

single byte CCSIDs and if the TRT instruction is "successful", <strong>DB2</strong> can translate the string<br />

using a TR instruction. The presence of shift-in/shift-out characters in a mixed string always<br />

causes the TRT instruction to fail. If the TRT fails, then <strong>DB2</strong> must invoke the z/<strong>OS</strong> Conversion<br />

Services.<br />

The per<strong>for</strong>mance of minor conversion is much better than the per<strong>for</strong>mance of major<br />

conversion because minor conversion avoids calling the z/<strong>OS</strong> Conversion Services. Hence,<br />

minor conversion is one of the significant advantages of <strong>DB2</strong> V8 compared to <strong>DB2</strong> V7, and<br />

represents an advantage of UTF-8 over UTF-16. Even when <strong>DB2</strong> V8 needs to use major<br />

conversion, V8 is still much faster than V7, which we will see later.<br />

Note that <strong>DB2</strong> V8 still uses the catalog table SYS<strong>IBM</strong>.SYSSTRINGS <strong>for</strong> conversions that do<br />

not involve Unicode.<br />

<strong>DB2</strong> V8 introduces a further optimization <strong>for</strong> ASCII conversion to UTF-8. <strong>DB2</strong> uses the TRT<br />

instruction to ensure all characters are less than 128, and because the first 128 code points<br />

are the same between ASCII and UTF-8, no conversion is necessary. <strong>DB2</strong> can skip<br />

conversion altogether.<br />

Studies using strings containing only English characters show that minor conversion in V8<br />

can be more than four times faster than major conversion in V8. Compared to conversion in<br />

V7, minor conversion can be more than six times faster. Keep in mind that minor conversion is<br />

only successful <strong>for</strong> single byte characters.<br />

z/<strong>OS</strong> Conversion Services<br />

The z/<strong>OS</strong> Conversion Services contain both a 31-bit and a 64-bit service. <strong>DB2</strong> V7 uses the<br />

31-bit service, while <strong>DB2</strong> V8 most often uses the 64-bit service.<br />

Chapter 4. <strong>DB2</strong> subsystem per<strong>for</strong>mance 185

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

Saved successfully!

Ooh no, something went wrong!