# Explain Plan (Single-Stage)

Use `EXPLAIN PLAN FOR` when you want to understand how Pinot will execute a query before or while tuning it.

## What it tells you

Explain plan output helps you see:

* which operators Pinot will run
* whether an index is being used
* where filters, projections, and aggregations happen
* how a query is shaped in single-stage or multi-stage execution

```sql
EXPLAIN PLAN FOR
SELECT city, COUNT(*)
FROM stores
GROUP BY city;
```

## Single-stage and multi-stage

Single-stage explain plans are best for understanding the operator flow behind straightforward queries.

Multi-stage explain plans are better when you need to inspect joins, subqueries, or the distributed execution shape.

## How to use it

Start with explain plan when a query is:

* slower than expected
* not using the index you expected
* returning a shape that is hard to reason about

Then pair the plan with query options or index guidance if you need a fix.

## What this page covered

This page covered what explain plan shows, when to use it, and how the single-stage and multi-stage engines differ.

## Next step

If you need a deeper execution-shape discussion, read [SQL syntax](/build-with-pinot/querying-and-sql/sql-syntax.md) and then revisit query options or quotas if the issue is runtime control rather than syntax.

## Related pages

* [Query options](/build-with-pinot/querying-and-sql/query-execution-controls/query-options.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: 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:

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

The question should be specific, self-contained, and written in natural language.
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.
