max_n_by()
Track the largest values and associated data in a set of values
Since 1.16.0
Construct an aggregate that keeps track of the largest values passed through it, as well as some associated data which
is passed alongside the value.
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Track the largest values and associated data in a set of values
max_n_by(
value BIGINT | DOUBLE PRECISION | TIMESTAMPTZ,
data ANYELEMENT,
capacity BIGINT
) MaxNBy
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
value | BIGINT | DOUBLE PRECISION | TIMESTAMPTZ | - | ✔ | The values passed into the aggregate |
data | ANYELEMENT | - | ✔ | The data associated with a particular value |
capacity | BIGINT | - | ✔ | The number of values to retain. |
| Column | Type | Description |
|---|---|---|
| max_n_by | MaxNBy | The compiled aggregate. Note that the exact type will be MaxByInts, MaxByFloats, or MaxByTimes depending on the input type |