Versions:
intercept()
ToolkitTimescaleDB Toolkit functions are available under Timescale Community Edition. They are automatically included with Timescale Cloud. Click to learn more.The intercept of the least squares fit line computed from the adjusted counter values and times input in the CounterSummary. This corresponds to the projected value at the PostgreSQL epoch (2000-01-01 00:00:00+00). This is useful for drawing the best fit line on a graph, using the slope and the intercept.
intercept(summary CounterSummary) RETURNS DOUBLE PRECISION
For more information about counter aggregation functions, see the hyperfunctions documentation.
Name | Type | Description |
---|---|---|
summary | CounterSummary | The input CounterSummary from a counter_agg call |
Name | Type | Description |
---|---|---|
intercept | DOUBLE PRECISION | The intercept of the least squares fit line computed from the points input to the CounterSummary |
SELECTid,bucket,intercept(summary)FROM (SELECTid,time_bucket('15 min'::interval, ts) AS bucket,counter_agg(ts, val) AS summaryFROM fooGROUP BY id, time_bucket('15 min'::interval, ts)) t
Found an issue on this page?
Report an issue!Keywords