# 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](https://docs.pinot.apache.org/build-with-pinot/querying-and-sql/query-execution-controls/query-cancellation).

## Related pages

* [Query options](https://docs.pinot.apache.org/build-with-pinot/querying-and-sql/query-execution-controls/query-options)
* [Query cancellation](https://docs.pinot.apache.org/build-with-pinot/querying-and-sql/query-execution-controls/query-cancellation)
* [Querying Pinot](https://docs.pinot.apache.org/build-with-pinot/querying-and-sql/querying-pinot)
