> 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.1.0/configuration-reference/functions/percentiletdigest.md).

# percentiletdigest

Returns the Nth percentile of the group using [T-digest algorithm](https://raw.githubusercontent.com/tdunning/t-digest/master/docs/t-digest-paper/histo.pdf). An optional compression\_factor can be specified to control the accuracy with a tradeoff in memory usage (i.e. higher compression\_factor gives better accuracy but takes more memory). The default compression\_factor is 100.

## Signature

> PERCENTILETDIGEST(colName, percentile)
>
> PERCENTILETDIGEST(colName, percentile, compression\_factor)

## Usage Examples

These examples are based on the [Batch Quick Start](/release-1.1.0/basics/getting-started/quick-start.md#batch).

```sql
select PERCENTILETDIGEST(homeRuns, 50, 1000) AS value
from baseballStats 
```

| value |
| ----- |
| 0     |

```sql
select PERCENTILETDIGEST(homeRuns, 80) AS value
from baseballStats 
```

| value              |
| ------------------ |
| 3.6571905392487856 |

```sql
select PERCENTILETDIGEST(homeRuns, 99.9) AS value
from baseballStats 
```

| value             |
| ----------------- |
| 46.26787306220119 |


---

# 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 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/release-1.1.0/configuration-reference/functions/percentiletdigest.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.
