Db2 EXPLAIN

You can use Db2 Admin Tool to issue SQL EXPLAIN statements, which gather information about the access path that Db2 chooses to process a query.

Specifically, you can use the Explain option in Db2 Admin Tool to do the following tasks:

  • Explain an SQL statement and display the resulting rows in a plan table. You can use this information to see how Db2 will run SQL statements in application plans or packages that were bound with EXPLAIN(YES).
  • Create any needed Db2 EXPLAIN tables.
  • Create an alias for the EXPLAIN tables.
  • Create indexes on any EXPLAIN tables. An index on the plan table is recommended if optimizer hints are being used.
  • Upgrade any EXPLAIN tables to the current version of Db2.
  • List queries in the SYSQUERY table.
  • Issue the Db2 BIND QUERY command on queries in SYSQUERY. The BIND QUERY panel supports the EXPLAININPUTSCHEMA() clause, which allows you to copy specified rows from an overpopulated plan table to one that should be used solely for BIND QUERY.