This message was deleted.
# general
s
This message was deleted.
g
do you mean, for each hour, you want to find the timestamp of the row that had the highest value of
VALUE
in that hour?
most natural way to write that in SQL would be something like—
Copy code
SELECT
  FLOOR(__time TO HOUR),
  MILLIS_TO_TIMESTAMP(ANY_VALUE(TIMESTAMP_TO_MILLIS(__time)))
FROM "DATASOURCE"
WHERE (FLOOR(__time TO HOUR), "VALUE") IN (
  SELECT
    FLOOR(__time TO HOUR) AS t,
    MAX("VALUE") as maxValue
  FROM "DATASOURCE"
  GROUP BY 1
)
GROUP BY 1
you can do
EXPLAIN PLAN FOR
on that to see how it runs