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?

posta 2 anni fa95 visualizzazioni
Nessuna risposta

Accesso non effettuato. Accedi per postare una risposta.

Una buona risposta soddisfa chiaramente la domanda, fornisce un feedback costruttivo e incoraggia la crescita professionale del richiedente.

Linee guida per rispondere alle domande