> ## Documentation Index
> Fetch the complete documentation index at: https://private-7c7dfe99-trino-dialect.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

> Selects a frequently occurring value using the heavy hitters algorithm. If there is a value that occurs more than in half the cases in each of the query execution threads, this value is returned. Normally, the result is nondeterministic.

# anyHeavy

<h2 id="anyHeavy">
  anyHeavy
</h2>

Introduced in: v1.1.0

Selects a frequently occurring value using the [heavy hitters](https://doi.org/10.1145/762471.762473) algorithm.
If there is a value that occurs more than in half the cases in each of the query's execution threads, this value is returned.
Normally, the result is nondeterministic.

**Syntax**

```sql theme={null}
anyHeavy(column)
```

**Arguments**

* `column` — The column name. [`String`](/reference/data-types/string)

**Returned value**

Returns a frequently occurring value. The result is nondeterministic. [`Any`](/reference/data-types/index)

**Examples**

**Usage example**

```sql title=Query theme={null}
CREATE TABLE ontime (AirlineID UInt32) ENGINE = Memory;

-- Three quarters of the flights belong to one airline, so it occurs in more than half of the
-- rows seen by every thread and the result is the same on every run.
INSERT INTO ontime SELECT if(number % 4 = 0, 19393, 19690) FROM numbers(1000);

SELECT anyHeavy(AirlineID) AS res
FROM ontime;
```

```response title=Response theme={null}
┌───res─┐
│ 19690 │
└───────┘
```
