DB2 Explain Plan

The DB2 SQL Explain Plan option generates an explain plan for a query. To generate an explain plan, either highlight a query, or if nothing is highlighted and the language type is SQL mode, separate the queries in the editor by semi-colons and position the cursor within the query to explain, or if there are no semi-colons or highlighted queries, RazorSQL will send the entire contents of the editor to be explained.

The tables used by DB2 for storing the explain plan information should be created before using the explain plan tool. The tables should be created in the schema used to log in to the database.

The DB2 installation should come with a script that can be used to create the explain plan tables. The script is called EXPLAIN.DDL and should be located in the MISC directory under the DB2 installation directory.

DB2 Explain Plan