Let’s say I have an events table with two columns:
event_id (string, some unique id)
time (unix timestamp)
How can I create a query that can be displayed as a line graph of events over time?
I’ve tried the following, which successfully returns data in one hour slices:
select count(id), from_utc_timestamp(from_unixtime(time - (time % 3600), "yyyy-MM-dd HH:mm:ss"), "UTC") AS time
from events
group by time
order by time ASC
The problem is that the line graph fails to display this properly:
How can I format the time column so that it is both human readable and graphs correctly?