Samples
Produce a linear TimeWeightSummary over the columnval and get the last timestamp:
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Get the last timestamp from a TimeWeightSummary aggregate
val and get the last timestamp:
WITH t as (
SELECT
time_bucket('1 day'::interval, ts) as dt,
time_weight('Linear', ts, val) AS tw
FROM table
GROUP BY time_bucket('1 day'::interval, ts)
)
SELECT
dt,
last_time(tw)
FROM t;
last_time(
tw TimeWeightSummary
) RETURNS TIMESTAMPTZ
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
| tws | TimeWeightSummary | - | ✔ | The input TimeWeightSummary from a time_weight() call |
| Column | Type | Description |
|---|---|---|
| last_time | TIMESTAMPTZ | The time of the last point in the TimeWeightSummary |