0

I have a table with metrics per box in QuestDb with columns

  • Timestamp (designated timestamp)
  • Machine (Symbol)
  • CPU (double)

and I want to downsample the results to 2 min interval taking average per machine so that output is same columns but with 1 data point per every 2 mins per every machine. I have a feeling that there should be a special SQL extension syntax for that but cannot make it work so far.

allnau
  • 323
  • 1
  • 5

1 Answers1

2

You can use sample by for that

SELECT Timestamp, Machine, AVG(CPU)
FROM tablename
SAMPLE BY 2m

This will automatically group by Machine and 2 mins timestamp intervals

Alex des Pelagos
  • 1,170
  • 7
  • 8