Documentation

EXPLAIN command

InfluxDB 3 Core is in Public Alpha

InfluxDB 3 Core is in public alpha and available for testing and feedback, but is not meant for production use. Both the product and this documentation are works in progress. We welcome and encourage your input about your experience with the alpha and invite you to join our public channels for updates and to share feedback.

Alpha expectations and recommendations

The EXPLAIN command returns the logical plan and the physical plan for the specified SQL statement.

EXPLAIN [ANALYZE] [VERBOSE] statement

EXPLAIN

Returns the logical plan and physical (execution) plan of a statement. To output more details, use EXPLAIN VERBOSE.

EXPLAIN doesn’t execute the statement. To execute the statement and view runtime metrics, use EXPLAIN ANALYZE.

Example EXPLAIN

EXPLAIN
SELECT
  room,
  avg(temp) AS temp
FROM home
GROUP BY room

View EXPLAIN example output

EXPLAIN ANALYZE

Executes a statement and returns the execution plan and runtime metrics of the statement. The report includes the logical plan and the physical plan annotated with execution counters, number of rows produced, and runtime metrics sampled during the query execution.

If the plan requires reading lots of data files, EXPLAIN and EXPLAIN ANALYZE may truncate the list of files in the report. To output more information, including intermediate plans and paths for all scanned Parquet files, use EXPLAIN ANALYZE VERBOSE.

Example EXPLAIN ANALYZE

EXPLAIN ANALYZE
SELECT
  room,
  avg(temp) AS temp
FROM home
WHERE time >= '2023-01-01' AND time <= '2023-12-31'
GROUP BY room

View EXPLAIN ANALYZE example output

EXPLAIN ANALYZE VERBOSE

Executes a statement and returns the execution plan, runtime metrics, and additional details helpful for debugging the statement.

The report includes the following:

  • the logical plan
  • the physical plan annotated with execution counters, number of rows produced, and runtime metrics sampled during the query execution
  • Information truncated in the EXPLAIN report–for example, the paths for all Parquet files retrieved for the query.
  • All intermediate physical plans that DataFusion and the Querier generate before generating the final physical plan–helpful in debugging to see when an ExecutionPlan node is added or removed, and how InfluxDB optimizes the query.

Example EXPLAIN ANALYZE VERBOSE

EXPLAIN ANALYZE VERBOSE SELECT temp FROM home
WHERE time >= now() - INTERVAL '7 days' AND room = 'Kitchen'
ORDER BY time

Was this page helpful?

Thank you for your feedback!


The future of Flux

Flux is going into maintenance mode. You can continue using it as you currently are without any changes to your code.

Read more

InfluxDB 3 Open Source Now in Public Alpha

InfluxDB 3 Open Source is now available for alpha testing, licensed under MIT or Apache 2 licensing.

We are releasing two products as part of the alpha.

InfluxDB 3 Core, is our new open source product. It is a recent-data engine for time series and event data. InfluxDB 3 Enterprise is a commercial version that builds on Core’s foundation, adding historical query capability, read replicas, high availability, scalability, and fine-grained security.

For more information on how to get started, check out: