08.06.2014 Views

Download PDF (1.3 MB) - IBM Redbooks

Download PDF (1.3 MB) - IBM Redbooks

Download PDF (1.3 MB) - 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.

4.14 DB2-specific database tuning<br />

Providing a comprehensive DB2 tuning guide is beyond the scope of this paper. However, a<br />

few general guidelines can assist in improving the performance of DB2 environments. This<br />

section describes these rules and provides pointers to more detailed information.<br />

The complete set of current DB2 manuals (including database tuning guidelines) is in the<br />

DB2 solution Information Center:<br />

http://publib.boulder.ibm.com/infocenter/db2luw/v9r7/index.jsp<br />

Another reference is the “Best practices for DB2 for Linux, UNIX, and Windows” page:<br />

http://www.ibm.com/developerworks/data/bestpractices/db2luw/<br />

4.14.1 Updating database statistics<br />

DB2 provides an Automatic Table Maintenance feature that runs the RUNSTATS command in<br />

the background as required. Using RUNSTATS ensures that the correct statistics are<br />

collected and maintained. This feature is controlled with the auto_runstats database<br />

configuration parameter and is enabled by default for databases created by DB2 9.1 and later.<br />

See the Configure Automatic Maintenance wizard at the database level in the DB2 Control<br />

Center.<br />

One approach to updating statistics manually on all tables in the database is to use the<br />

REORGCHK command. Dynamic SQL, such as that produced by Java Database<br />

Connectivity (JDBC), immediately takes the new statistics into account. Static SQL, such as<br />

that in stored procedures, must be explicitly rebound in the context of the new statistics.<br />

Example 4-2 shows DB2 commands that perform the steps to gather basic statistics on<br />

database DBNAME.<br />

Example 4-2 Gathering basic statistics on database DBNAME<br />

db2 connect to DBNAME<br />

db2 reorgchk update statistics on table all<br />

db2 connect reset<br />

db2rbind DBNAME all<br />

Run REORGCHK and rebind, when the system is relatively idle, to ensure that a stable<br />

sample might be acquired and to avoid possible deadlocks in the catalog tables.<br />

Gathering additional statistics is a better approach; therefore, consider also using the<br />

following command for every table that requires attention:<br />

runstats on table . with distribution and detailed indexes<br />

4.14.2 Setting buffer pool sizes correctly<br />

A buffer pool is an area of memory into which database pages are read, modified, and held<br />

during processing. Buffer pools improve database performance. If a required page of data is<br />

already in the buffer pool, that page is accessed faster than if the page must be read directly<br />

from disk. As a result, the size of the DB2 buffer pools is critical to performance.<br />

The amount of memory used by a buffer pool depends on two factors:<br />

► Size of buffer pool pages<br />

► Number of pages allocated<br />

82 <strong>IBM</strong> Business Process Manager V8.0 Performance Tuning and Best Practices

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

Saved successfully!

Ooh no, something went wrong!