> For the complete documentation index, see [llms.txt](https://docs.pinot.apache.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.pinot.apache.org/build-with-pinot/querying-and-sql/query-execution-controls/explain-plan-multi-stage.md).

# Explain Plan (Multi-Stage)

{% hint style="info" %}
For the complete, up-to-date explain plan reference (including segment plans, logical plans, and workers plans), see [Explain Plan](/build-with-pinot/querying-and-sql/multi-stage-query/explain-plan-1.md) in the multi-stage query section.
{% endhint %}

Multi-stage explain plans are useful when a query uses features such as joins, subqueries, or distributed reshaping that do not exist in the single-stage path.

## What to look for

* logical plan shape
* exchange and distribution boundaries
* join and aggregation placement
* implementation details when you need to see the physical operator chain

If you only need to understand a simple filter or aggregation query, the single-stage explain plan page is usually enough.

## Useful patterns

When debugging multi-stage execution, start by:

1. running `EXPLAIN PLAN FOR`
2. checking whether the plan is logical or implementation-oriented
3. comparing the result with the query options you set

## What this page covered

This page covered what the multi-stage explain plan is useful for and how to approach it when debugging advanced SQL.

## Next step

If you are still deciding between engines, read [SSE vs MSE](/build-with-pinot/querying-and-sql/sse-vs-mse.md) in the broader query section.

## Related pages

* [Explain plan](/build-with-pinot/querying-and-sql/query-execution-controls/explain-plan.md)
* [Querying Pinot](/build-with-pinot/querying-and-sql/querying-pinot.md)
* [SQL syntax](/build-with-pinot/querying-and-sql/sql-syntax.md)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.pinot.apache.org/build-with-pinot/querying-and-sql/query-execution-controls/explain-plan-multi-stage.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
