# Query Correlation ID

Every Pinot query gets a correlation ID so you can track it through broker and server logs.

## Default behavior

Pinot assigns a correlation ID automatically when the broker receives a query. That ID is included in the logging context and can be used to follow the query through the cluster.

## Custom IDs

If your client already has a request identifier, set `clientQueryId` so Pinot uses it as the correlation ID.

```sql
SET clientQueryId = 'query-2026-03-24-001';
SELECT * FROM stores LIMIT 10;
```

Use a high-entropy value such as a UUID when you provide your own ID.

## Why it matters

Correlation IDs are most useful when you need to:

* search logs for a single request
* cancel a query later
* connect application tracing with Pinot query execution

## What this page covered

This page covered how Pinot assigns query correlation IDs, how to provide a custom one, and why the ID matters operationally.

## Next step

If you need to stop a running query, read [Query cancellation](/build-with-pinot/querying-and-sql/query-execution-controls/query-cancellation.md).

## Related pages

* [Query options](/build-with-pinot/querying-and-sql/query-execution-controls/query-options.md)
* [Query cancellation](/build-with-pinot/querying-and-sql/query-execution-controls/query-cancellation.md)
* [Querying Pinot](/build-with-pinot/querying-and-sql/querying-pinot.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/query-correlation-id.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.
