> 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/release-1.0.0/for-users/user-guide-query/query-options.md).

# Query Options

This document contains all the available query options

## Supported Query Options

| Key                         | Description                                                                                                                                                                                               | Default Behavior                                                                   |
| --------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- |
| **timeoutMs**               | Timeout of the query in milliseconds                                                                                                                                                                      | Use table/broker level timeout                                                     |
| **enableNullHandling**      | Enable the null handling of the query (introduced in 0.11.0)                                                                                                                                              | `false` (disabled)                                                                 |
| **explainPlanVerbose**      | Return verbose result for `EXPLAIN` query (introduced in 0.11.0)                                                                                                                                          | `false` (not verbose)                                                              |
| **useMultistageEngine**     | Use multi-stage engine to execute the query (introduced in 0.11.0)                                                                                                                                        | `false` (use single-stage engine)                                                  |
| **maxExecutionThreads**     | Maximum threads to use to execute the query. Useful to limit the resource usage for expensive queries                                                                                                     | Half of the CPU cores for non-group-by queries; all CPU cores for group-by queries |
| **numReplicaGroupsToQuery** | When replica-group based routing is enabled, use it to query multiple replica-groups (introduced in 0.11.0)                                                                                               | `1` (only query servers within the same replica-group)                             |
| **minSegmentGroupTrimSize** | Minimum groups to keep when trimming groups at the segment level for group-by queries. See [Grouping Algorithm](/release-1.0.0/for-users/user-guide-query/grouping-algorithm.md#configuration-parameters) | Server level config                                                                |
| **minServerGroupTrimSize**  | Minimum groups to keep when trimming groups at the server level for group-by queries. See [Grouping Algorithm](/release-1.0.0/for-users/user-guide-query/grouping-algorithm.md#configuration-parameters)  | Server level config                                                                |
| **skipUpsert**              | For upsert-enabled table, skip the effect of upsert and query all the records. See [Stream Ingestion with Upsert](/release-1.0.0/basics/data-import/upsert.md)                                            | `false` (exclude the replaced records)                                             |
| **useStarTree**             | Useful to debug the star-tree index (introduced in 0.11.0)                                                                                                                                                | `true` (use star-tree if available)                                                |
| **AndScanReordering**       | [See detailed description](https://docs.pinot.apache.org/operators/tutorials/performance-optimization-configurations?q=andoperator)                                                                       | disabled                                                                           |

## Set Query Options

### SET statement

After release 0.11.0, query options can be set using the `SET` statement:

```sql
SET key1 = 'value1';
SET key2 = 123;
SELECT * FROM myTable
```

### OPTION keyword (deprecated)

Before release 0.11.0, query options can be appended to the query with the `OPTION` keyword:

```sql
SELECT * FROM myTable OPTION(key1=value1, key2=123)
SELECT * FROM myTable OPTION(key1=value1) OPTION(key2=123)
SELECT * FROM myTable OPTION(timeoutMs=30000)
```


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.pinot.apache.org/release-1.0.0/for-users/user-guide-query/query-options.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
