SET PLAN

From InterBase

Go Up to isql Command Reference


Specifies whether to display the optimizer’s query plan.

SET PLAN [ON | OFF];
Argument Description

ON

Turns on display of the optimizer’s query plan

OFF

Turns off display of the optimizer’s query plan [default]

Description: By default, when a SELECT statement retrieves rows from a query, isql does not display the query plan used to retrieve the data.

Use SET PLAN ON to change the default behavior and display the query optimizer plan. To restore the default behavior, use SET PLAN OFF.

To change the query optimizer plan, use the PLAN clause in the SELECT statement.

Tip:
The ON and OFF keywords are optional. If they are omitted, SET PLAN switches from one mode to the other. Although you can save typing by omitting the optional keyword, including the keyword is recommended because it avoids potential confusion.

Example: The following example shows part of a script that sets PLAN ON:

SET PLAN ON;
SELECT JOB_COUNTRY, MIN_SALARY FROM JOB
WHERE MIN_SALARY > 50000
AND JOB_COUNTRY = 'France';

The output then includes the query optimizer plan used to retrieve the data as well as the results of the query:


PLAN (JOB INDEX (RDB$FOREIGN3,MINSALX,MAXSALX))
JOB_COUNTRY      MIN_SALARY
=============== ======================
France          118200.00