docs/sources/reference-pyroscope-v2-architecture/components/query-backend.md
The query-backend is a stateless component that executes queries with high parallelism. It reads data directly from object storage and processes it according to the query plan received from the query-frontend.
The query frontend builds a physical query plan as a tree structure:
The query frontend sends the plan root to a query backend instance. That instance distributes subtrees to other query backend instances for parallel execution, collects their results, and merges them. The final merged result is returned to the query frontend, which forwards it to the client.
This tree-based execution allows queries to fan out across many query backend instances in parallel, with merging happening at each level of the tree rather than in a single aggregation point.
Unlike v1 where queries may need to access ingesters for recent data, the v2 query-backend reads directly from object storage:
The query-backend is completely stateless:
The query-backend enables horizontal scaling of the read path: