Time-formatting data format problem between timescaledb and grafana panel

In timescaledb i create a hypertable and insert data as such,

CREATE TABLE IF NOT EXISTS weather (
time TIMESTAMP NOT NULL,
temp double precision NOT NULL
);
SELECT create_hypertable(‘weather’,‘time’);
INSERT INTO weather VALUES(NOW(),3.5);

Surprisingly Grafana’s query builder does not produce anything useful for this VERY SIMPLE setup.
So my question is rather simple.
If grafana’s builder cannot produce a nice query could someone be so nice to provide me one ?
Something like,

SELECT
… unknown time manipulation for grafana not to complain
GROUP BY time
ORDER BY time

Thanks you for any answer on this very simple question.

Something like ?,
SELECT time_bucket(‘5 minutes’, time) AS time, avg(temp)
FROM weather
GROUP BY time
ORDER BY time DESC LIMIT 10;

Problem was solved by configuring correctly timezones on the sender side.

The first step can be a steep learning curve. But after this you want to know more.

This topic was automatically closed after 365 days. New replies are no longer allowed.