SQL and query performance is a challenge in many shops. Most newer applications use SQL as their standard way to reach the database, and while I/O performance can be an issue in any program, SQL
based applications seem to impact servers more easily. Many SQL developers don't even have authority to build new indexes or views on production systems to improve the performance of their applications.
Making sure the database finds and uses efficient access paths is critical to giving your users fast applications. Hardware costs rise directly with how much work your server does to answer each request. If your database server reads 1,000,000 records to find and select only 1,000, response time won't meet expectations and hardware costs will be much higher than they need to be.
The Query Optimizer is the tool in the Workload Performance Series that shows which tables and SQL requests would benefit most from database tuning. Whether you change SQL requests to use existing indexes or build new permanent ones, the savings can be enormous.
In one example, 439 table scans occurred over the same table during the data collection sample. Over 200,000 records were read by these SQL requests to select 4 records. It takes a lot of hardware to make 200,000 I/Os perform as well as 4. Simple database tuning or SQL changes could dramatically reduce what each request needs. Let's not just give it more CPU, memory and faster disks: let's get it to 4 I/Os, then size the hardware around a well-performing application.
Table Scan Analysis is an important process with the Query Optimizer. Many SQL requests benefit from simple changes, but you will reach a point where you could be building too many new indexes. Know when to stop! Only build a new index when it solves a real business issue, not just because of skipped records. If an SQL request isn't hurting your system or your business, leave it alone.
Elapsed Time Tracking helps where there are very few table scans yet web or client/server users still wait. The user doesn't care how much I/O happens; they care how long requests take. In one sample, one database was responsible for 46% of the elapsed time of all SQL requests: over 13 billion records were selected through SQL fetches, and 37,698 SQL requests were not performing well. SQL changes that subset the data with better selection criteria were the fix.
A browser or client/server application pre-loading 10,000 records into a drop-down list can cause this kind of issue. Giving users a way to narrow their selection first can dramatically improve performance and cut hardware needs and costs.
The Workload Performance Series is available now. Support for IBM z, Linux, AIX and Windows Server, and the databases that run on them, is being built.
| Platform | What the Query Optimizer reads | Available |
|---|---|---|
| Current release | Db2 for i database monitor data: table scans, index advice and elapsed time by statement | Now |
| IBM z (z/OS) | Db2 for z/OS statement cache and accounting records: CPU, getpages and elapsed time by statement | Coming |
| Linux (x86, IBM Power, IBM z) | PostgreSQL pg_stat_statements, MySQL performance schema and Db2 LUW monitoring | Coming |
| AIX | Db2 LUW monitoring functions, and Oracle statistics where licensed | Coming |
| Windows Server | SQL Server Query Store and dynamic management views: top statements and missing indexes | Coming |
Want it on another platform sooner? Tell us what you run.


