Overview of IBM SQL Tuning Services

SQL Tuning Services is a set of tools, delivered as RESTful APIs, that you use to analyze and tune SQL applications that work with Db2® for z/OS®. You can call these APIs directly from an application and you can use them from within IBM® Db2 Administration Foundation for z/OS and IBM Db2 for z/OS Developer Extension.

SQL Tuning Services features

SQL Tuning Services features are provided in the following two products:
  • IBM Database Services Expansion Pack, which is available at no additional cost to licensed Db2 Accessories Suite for z/OS users, includes a subset of all the available SQL Tuning Services features.
  • IBM Db2 Query Workload Tuner for z/OS 6.1, which can be purchased separately or is included in the Db2 Performance Solution Pack for z/OS, includes all of the features that are included with IBM Database Services Expansion Pack plus a more robust set SQL analysis and tuning features.

The following table describes all of the SQL Tuning Services features and indicates which features are included with the related products:

Table 1. SQL Tuning Services features
Feature IBM Database Services Expansion Pack (no charge) Db2 Query Workload Tuner 6.1 (priced feature)
Access Path Advisor
Generates access path recommendations that can improve the performance of a single query.
 
Access Path Comparison
Compares two access paths and displays the results of the comparison. A graphical representation 
of the access path flow is provided for each access path along with any meaningful differences in the plan table for each access path.
 
Capture Query Environment
Captures details about the environment in which you are running an SQL statement. These details
 are saved to a file that you can provide to IBM Support when you are trying to resolve a performance
 problem with an SQL statement or that you can use to re-create an environment on another 
subsystem.
Index Advisor
Generates recommendations for creating, altering, or dropping indexes that can improve the 
performance of a single query. This feature provides the DDL scripts that you can run and
 information about the existing indexes from the query that you’re tuning.
 
Start of change
Index Impact Analyzer
Generates a report that shows the impact of applying the index changes that are recommended by Index Advisor and Workload Index Advisor.
End of change
 
Job Management
Enables you to query information about SQL Tuning Services jobs and cancel, delete, and view the 
results of SQL Tuning Services jobs.
Query Rewrite Advisor
Evaluates how efficiently a query is written and generates best-practice recommendations for
rewriting it to improve its performance.
 
SQL Annotator
Gathers statistical information about database objects that are used for
 access path selection and provides a cost estimate for running a particular query. This information can help you understand how a query is processed by the Db2 optimizer so that you can determine which other SQL tuning tools might be able to improve that query's performance.
 
SQL Capture
Retrieves statements from the following sources:
  • A user-defined local repository
  • A local file
  • For dynamic SQL, from the statement cache
  • For stabilized dynamic SQL and static SQL, from Db2 catalog tables
  • A sequential data set or a member of a partitioned data set (PDS or PDSE)
SQL Formatter
Formats an SQL statement for a single query so that you can more easily read and understand the structure of the statement.
Statistics Advisor
Generates a recommended set of RUNSTATS commands to improve query performance.
Visual Explain
Generates a graphical representation and a grid plan table view of the access paths for an SQL statement. This information is useful for tuning queries for better performance.
Start of change
Virtual Index Analyzer
Virtually tests indexes to determine if the performance of a single query can be improved by creating or dropping the indexes.
End of change
 
Workload Access Path Advisor
Generates recommendations for improving the access paths that are used by an SQL workload.
 
Workload Access Path Comparison
Compares, annotates, and generates reports on the access plans and estimated cost changes for SQL statements in different packages or workloads.
 
Start of change
Workload Analytics Acceleration Advisor
Generates a report that shows the eligible and ineligible statements for offloading to IBM Db2 Analytics Accelerator and quantifies the CPU savings that can be made by offloading.
End of change
 
Start of change
Workload Candidate Acceleration Analyzer
Generates a report that shows the eligible and ineligible statements for offloading to IBM Db2 Analytics Accelerator and quantifies the CPU savings that can be made by offloading with user input candidate tables.
End of change
 
Workload Explain
Gathers explain information for all statements in a workload and stores this information in the repository database. This information is used by other workload advisors to analyze these statements.
 
Workload Index Advisor
Generates recommendations for creating, altering, or dropping indexes that can improve the
performance an SQL workload. This feature provides the DDL scripts that you can run and information
about the existing indexes from the workload that you’re tuning.
 
Workload Management
Provides a set of APIs for common workload-related tasks such as creating, updating,
And deleting workloads, listing the statements in a workload, refining workload results by applying filter criteria, and so on.
 
Start of change
Workload Query Environment Collector
Captures details about the environment in which you are running an SQL workload. These details
 are saved to a file that you can provide to IBM Support when you are trying to resolve a performance
 problem with an SQL workload or that you can use to re-create an environment on another 
subsystem.
End of change
 
Workload Query Rewrite Advisor
Generates recommendations for rewriting statements in an SQL workload to improve its overall performance.
 
Workload Statistics Advisor
Generates recommendations and RUNSTATS DDL for creating or modifying statistical views.
 
Start of change
Workload Virtual Index Analyzer
Virtually tests indexes to determine if the performance of a workload can be improved by creating or dropping the indexes.
End of change
 

How to use SQL Tuning Services

Because SQL Tuning Services functionality is delivered as RESTful APIs, you can call them directly from an application or development environment (for example, from within a CI/CD DevOps pipeline).

Additionally, SQL Tuning Services functionality is integrated into the user interfaces of the following products:
  • IBM Db2 Administration Foundation for z/OS leverages the SQL Tuning Services APIs to improve the performance of SQL applications that are running on your system. A database administrator can identify, evaluate, and improve SQL queries that affect system performance.
  • IBM Db2 for z/OS Developer Extension integrates the SQL Tuning Services APIs into a Microsoft Visual Studio Code development environment so that application developers can analyze and tune their SQL applications as they are writing them.
Restriction: Workload analysis and tuning features are available only as stand-alone APIs and with Db2 Administration Foundation. Currently, they are not integrated into Db2 Developer Extension.