Explain Plan

The 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 Explain Plan option is currently available for the following databases:

DB2 Explain Plan
HSQLDB Explain Plan
MySQL Explain Plan
Oracle Explain Plan
PostgreSQL Explain Plan
SQLite Explain Plan
MS SQL Server Explain Plan
Sybase Explain Plan

Database Specific Notes

DB2: For DB2, 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.

Oracle: For Oracle, to perform an explain plan, the PLAN_TABLE must exist. For example,

CREATE PUBLIC SYNONYM plan_table FOR sys.plan_table;
GRANT ALL ON sys.plan_table TO public;

For the rest of the databases supported by the explain plan tool - HSQLDB, MySQL, PostgreSQL, SQLite, SQL Server, and Sybase - no extra configuration is needed.

SQL Explain Plan