Add last() aggregate function and influx_time() functions
These functions can be used for using InfluxDB last() function and GROUP BY time(duration).
But these functions do not have implementation in PostgreSQL and can be used if these are pushed down.
Usage example:
EXPLAIN (VERBOSE)
SELECT influx_time(time,interval '5s',interval '0s'),tag1,last(time, value1) FROM "t4" WHERE time >= '1970-01-01 00:00:00+00' and time <= '1970-01-01 0:00:05+00'
GROUP BY influx_time(time,interval '5s', interval '0s'), tag1;
QUERY PLAN
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Foreign Scan (cost=1.00..1.00 rows=1 width=48)
Output: (influx_time("time", '@ 5 secs'::interval, '@ 0'::interval)), tag1, (last("time", value1))
InfluxDB query: SELECT last("value1") FROM "t4" WHERE ((time >= '1970-01-01 00:00:00')) AND ((time <= '1970-01-01 00:00:05')) GROUP BY (time(0d0h0m5s0u, 0d0h0m0s0u)), "tag1"
This pull request includes:
last()
aggregate function andinflux_time()
functionsThese functions can be used for using InfluxDB
last()
function andGROUP BY time(duration)
. But these functions do not have implementation in PostgreSQL and can be used if these are pushed down.Usage example: