Skip to content

EXPLAIN statement and RDB$SQL package #7675

@sim1984

Description

@sim1984

Many DBMSs use a separate EXPLAIN statement to display plans. There are a number of advantages over using isc_info_sql_get_plan to get the plan:

  1. We can easily set the query plan output format.
  2. You can set other plan output options (for example, the depth of output of recursive plans)
  3. Plan output size is unlimited 64K

The EXPLAIN statement can return the plan as a BLOB cursor column or as isc_exec_proc (single row).

Syntax:

EXPLAIN [ ( option [, ...] ) ] statement

option :=
   ANALYZE
   FORMAT={PLAIN | TREE}
   DEPTH=n
   CARDINALITY
   COST

ANALYZE - executes a query without returning data and substitutes the actual measured values into the plan

FORMAT - output format. By default TREE . PLAIN - legacy plan. TREE - tree-like (explain). In the future, it can be extended to other formats JSON, XML...

DEPTH - depth of recursive output (output of plans of internal procedures). The default is 1.

CARDINALITY - output cardinality score for plan nodes.

COST - output cost estimates for plan nodes.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions