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.

3.7.3 Recommendations<br />

Parallel sort in V8 enables parallelism <strong>for</strong> multiple-table composite, is cost-based and is<br />

disabled <strong>for</strong> short running queries. When used, it affects the use of work files.<br />

► Parallel sort uses more work files concurrently<br />

► May need bigger work file buffer pool size<br />

► Monitor critical buffer pool shortage and adjust buffer pool size<br />

► Have sufficient number of work files to reduce contention<br />

► Use ESS DASD to benefit from PAV<br />

3.8 Table UDF improvement<br />

3.8.1 Description<br />

<strong>DB2</strong> allows you to specify the cardinality option passing the expected value when you<br />

reference a user-defined table function in an SQL statement. With this option, users give <strong>DB2</strong><br />

the in<strong>for</strong>mation needed <strong>for</strong> better tuning the per<strong>for</strong>mance of queries that contain user-defined<br />

table functions.<br />

The cardinality option <strong>for</strong> user-defined table functions is primarily intended <strong>for</strong> the integration<br />

of <strong>DB2</strong> <strong>for</strong> z/<strong>OS</strong> with Content Manager to allow improved per<strong>for</strong>mance through better<br />

optimization.<br />

The table UDF improvement can be achieved by the conjunction of:<br />

► The cardinality option <strong>for</strong> a user-defined table function allows users to tune the<br />

per<strong>for</strong>mance of queries that contains user-defined table functions.<br />

► A join predicate between a user-defined function and a base table is stage 1, and possibly<br />

indexable, if the base table is the inner table of the join and the other stage 1 conditions<br />

are met.<br />

► Rows returned from a user-defined function are prefetched into a work file in its first<br />

invocation. This feature is enabled by <strong>DB2</strong> based on the access cost estimation.<br />

Queries involving user-defined table functions, in general, could benefit from this feature,<br />

when users can estimate the number of rows returned by the function be<strong>for</strong>e the queries are<br />

run. You should note that this option is a nonstandard SQL extension and specific to <strong>DB2</strong> <strong>for</strong><br />

z/<strong>OS</strong> implementation.<br />

User-defined table function<br />

The user-defined table function cardinality option indicates the total number of rows returned<br />

by a user-defined table function reference. The option is used by <strong>DB2</strong> at bind time to evaluate<br />

the table function access cost.<br />

A user-defined table function cardinality option can be specified <strong>for</strong> each table function<br />

reference in the following <strong>for</strong>ms:<br />

► A keyword CARDINALITY followed by an integer that represents the expected number of<br />

rows returned by the table function.<br />

► A keyword CARDINALITY MULTIPLIER followed by a numeric constant. The expected<br />

number of rows returned by the table function is computed by multiplying the given<br />

number of the reference cardinality value that is retrieved from the CARDINALITY field of<br />

SYS<strong>IBM</strong>.SYSROUTINES by the corresponding table function name that was specified<br />

when the corresponding table function was defined.<br />

Chapter 3. SQL per<strong>for</strong>mance 83

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

Saved successfully!

Ooh no, something went wrong!