EXPLAIN statement

Hive provides an EXPLAIN statement to return a query execution plan without running the query. We can use it to analyze queries if we have concerns about their performance. The EXPLAIN statement helps us to see the difference between two or more queries for the same purpose. The syntax for it is as follows:

EXPLAIN [FORMATTED|EXTENDED|DEPENDENCY|AUTHORIZATION] hql_query

The following keywords can be used:

  • FORMATTED: This provides a formatted JSON version of the query plan.
  • EXTENDED: This provides additional information for the operators in the plan, such as file pathname.
  • DEPENDENCY: This provides a JSON format output that contains a list of tables and partitions that the query depends on. It has been available since Hive ...

Get Apache Hive Essentials now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.