H2 Database - Explain


Advertisements


EXPLAIN command displays the execution plan for a statement. When we execute a statement using EXPLAIN ANALYZE command, the query plan will include the actual row scan count for each table.

Syntax

Following is the generic syntax of the EXPLAIN command.

EXPLAIN { [ PLAN FOR ] | ANALYZE } { select | insert | update | delete | merge} 

Along with this syntax we can use select, insert, delete, and merge.

Example

This example explains the query plan details of the customer with ID 1.

EXPLAIN SELECT * FROM CUSTOMER WHERE ID = 1;

The above command produces the following output −

Explain Output

Advertisements