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

# into_array()

> Returns an array of the lowest values from a MinN aggregate

<Icon icon="tag" iconType="duotone" /> Since [1.16.0][toolkit-1.16.0]

Returns the N lowest values seen by the aggregate. The values are
formatted as an array in increasing order.

## Samples

Find the bottom 5 values from `i * 13 % 10007` for i = 1 to 10000.

```sql theme={"dark"}
SELECT into_array(
    min_n(sub.val, 5))
FROM (
  SELECT (i * 13) % 10007 AS val
  FROM generate_series(1,10000) as i
) sub;
```

Output:

```sql theme={"dark"}
into_array
---------------------------------
{1,2,3,4,5}
```

## Arguments

The syntax is:

```sql theme={"dark"}
into_array (
    agg MinN
) BIGINT[] | DOUBLE PRECISION[] | TIMESTAMPTZ[]
```

| Name  | Type | Default | Required | Description                                                                                                      |
| ----- | ---- | ------- | -------- | ---------------------------------------------------------------------------------------------------------------- |
| `agg` | MinN | -       | ✔        | The aggregate to return the results from. Note that the exact type here varies based on the type of data stored. |

## Returns

| Column      | Type                                               | Description                                           |
| ----------- | -------------------------------------------------- | ----------------------------------------------------- |
| into\_array | BIGINT\[] \| DOUBLE PRECISION\[] \| TIMESTAMPTZ\[] | The lowest values seen while creating this aggregate. |

[toolkit-1.16.0]: https://github.com/timescale/timescaledb-toolkit/releases/tag/1.16.0
