Timestream queries without scanning all the records

0

We are monitoring a water meter that constantly increments the total gallons of water that have passed through the meter, thus we don't need to look at all the data in order to figure out what the total gallons are at points in between (though if data is missing we'd want to interpolate). We're trying to write a query that will provide us with the total gallons used at the end of each day. Here's an example:

  SELECT BIN(time, 1d) as binned_timestamp, devEui, ROUND(MAX(totalGallons), 2) as max_totalGallons 
  FROM "SensorData"."ApplicationData"
  WHERE time between ago(30d) and now() and devEui = 'A840419E8182DCBF' 
  GROUP BY devEui, BIN(time,1d) 
  ORDER BY binned_timestamp ASC

However, this queries all the data, where all we really need to look at is the last data point for each day. Thoughts?

asked 2 years ago93 views
No Answers

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions