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.

multinational companies to combine data from different sources. Unicode was developed to<br />

solve the problem. By storing data in a single Unicode CCSID, text data from different<br />

languages in different countries can be easily stored and managed.<br />

<strong>DB2</strong> V5 introduced the ability to create ASCII databases, table spaces and tables via the<br />

CCSID ASCII clause. This gave you the choice to store your data in either EBCDIC or ASCII,<br />

and <strong>DB2</strong> would convert data between these encoding schemes where appropriate. <strong>DB2</strong> V7<br />

built upon that support, introducing support <strong>for</strong> Unicode objects. However, where EBCDIC<br />

and ASCII conversions are done within <strong>DB2</strong>, <strong>DB2</strong> V7 always relied on <strong>OS</strong>/390 Conversion<br />

Services to handle Unicode conversion. The per<strong>for</strong>mance of Unicode conversion in <strong>DB2</strong> V7,<br />

with older levels of the operating system and zSeries hardware, was less than optimal. <strong>DB2</strong><br />

V8 enhances support <strong>for</strong> Unicode, and at the same time takes advantage of the faster<br />

conversion provided by the current versions of z/<strong>OS</strong> services and zSeries processors.<br />

When storing data into and retrieving data, <strong>DB2</strong> converts the data from one CCSID to another<br />

CCSID where necessary. Obviously, it is preferable that no conversion be carried out,<br />

because conversion impacts per<strong>for</strong>mance. However, <strong>IBM</strong> has done considerable work to<br />

improve conversion per<strong>for</strong>mance on zSeries. In this section, we discuss the recent<br />

enhancements <strong>IBM</strong> have made to conversion and how they impact per<strong>for</strong>mance.<br />

When does CCSID conversion occur?<br />

CCSID conversion occurs whenever there is a mismatch between the CCSID of a source and<br />

target string, such as between a host variable and its associated column. This conversion<br />

support in <strong>DB2</strong> has existed since <strong>DB2</strong> began to support client/server connections in V2.3<br />

between different EBCDIC CCSIDs. <strong>DB2</strong> V5 began to support ASCII tables and ASCII host<br />

variables, so CCSID conversion was expanded to include conversion between EBCDIC and<br />

ASCII.<br />

To per<strong>for</strong>m these conversions (not involving Unicode), <strong>DB2</strong> uses a translate table which is<br />

stored in SYS<strong>IBM</strong>.SYSSTRINGS. We refer to this type of CCSID conversion as<br />

SYSSTRINGS conversions.<br />

The specific EBCDIC and ASCII CCSIDs used to store data by a <strong>DB2</strong> system must be<br />

specified in the DSNHDECP data only module, and they should not be changed. Starting in<br />

V8, they cannot be changed. Within a single <strong>DB2</strong> system, all EBCDIC tables have the same<br />

EBCDIC CCSIDs and all ASCII tables have the same ASCII CCSIDs. In addition, numeric<br />

columns and date/time columns are stored as binary fields, but they may involve CCSID<br />

conversion when loading or unloading such fields using the EXTERNAL attribute. However,<br />

the utilities always apply the EXTERNAL attribute to date/time fields.<br />

<strong>DB2</strong> V7 introduced the ability <strong>for</strong> user tables to be defined as Unicode by specifying “CCSID<br />

UNICODE” on the database, table space or table definition. Within a Unicode table, CHAR<br />

and VARCHAR columns are stored in UTF-8 <strong>for</strong>mat. GRAPHIC and VARGRAHIC columns<br />

are stored in a Unicode table as UTF-16. Any CCSID conversion involving Unicode is called<br />

Unicode conversion and is necessary whenever there is a mismatch between the CCSID of a<br />

source and target string. <strong>DB2</strong> V7 uses the z/<strong>OS</strong> Conversion Services exclusively <strong>for</strong> all<br />

Unicode conversions, which can affect the CPU time substantially.<br />

In V7 the <strong>DB2</strong> Catalog remains in EBCDIC and all SQL statement parsing is still done in<br />

EBCDIC. There<strong>for</strong>e, <strong>for</strong> applications such as the Universal Java Driver that provide an SQL<br />

statement in Unicode, <strong>DB2</strong> must convert the statement to EBCDIC. Similarly, any incoming<br />

metadata, such as package names and authorization ids, may also require conversion by<br />

<strong>DB2</strong>.<br />

One of the limitations of V7 is that you cannot join two tables that use different CCSIDs.<br />

Another limitation is per<strong>for</strong>mance. V7 completely relies on the z/<strong>OS</strong> Unicode conversion<br />

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

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

Saved successfully!

Ooh no, something went wrong!