EXPLAIN

The EXPLAIN statement returns the execution plan for a given statement, without executing it. You can use this statement to debug long-running queries and learn how to optimize them.

Syntax Summary

This code block is a quick reference for the EXPLAIN statement.

See some practical examples.

EXPLAIN statement

Parameters

All statements can be used as parameters to the EXPLAIN statement.

Limitations

  • Plan for nested loops join algorithm with IMap on the right side does not show actual access path to the right side data. It is always reported as full scan, even though in reality key lookup or index may be used.

Examples

This section lists some example SQL queries that show you how to use the EXPLAIN statement.

Full table scans

EXPLAIN SELECT * FROM cities WHERE countries = 'United Kingdom';
+--------------------+
|rel                 |
+--------------------+
|FullScanPhysicalRel…|
+--------------------+