---
title: live_ranges() | Tiger Data Docs
description: Get the live intervals from a heartbeat_agg
---

Since [1.15.0](https://github.com/timescale/timescaledb-toolkit/releases/tag/1.15.0)

Return a set of (start\_time, end\_time) pairs representing when the underlying system was live during the interval of the aggregate.

## Samples

Given a table called `liveness` containing weekly heartbeat aggregates in column `health` with timestamp column `date`, use the following to get the intervals where the system was live during the week of Jan 9, 2022.

```
SELECT live_ranges(health)
FROM liveness
WHERE date = '01-9-2022 UTC'
```

Returns:

```
                    live_ranges
-----------------------------------------------------
("2022-01-09 00:00:30+00","2022-01-12 15:27:22+00")
("2022-01-12 15:31:17+00","2022-01-16 00:00:00+00")
```

## Arguments

The syntax is:

```
live_ranges(
    agg HEARTBEATAGG
) RETURNS TABLE (
    start TIMESTAMPTZ,
    end TIMESTAMPTZ
)
```

| Name | Type         | Default | Required | Description                                         |
| ---- | ------------ | ------- | -------- | --------------------------------------------------- |
| agg  | HeartbeatAgg | -       | ✔        | A heartbeat aggregate to get the liveness data from |

## Returns

| Column       | Type                                       | Description                                         |
| ------------ | ------------------------------------------ | --------------------------------------------------- |
| live\_ranges | TABLE (start TIMESTAMPTZ, end TIMESTAMPTZ) | The (start, end) pairs of when the system was live. |
