0

I have a rather large time series (500 M samples) with irregular timestamps.

In particular, I have times where samples are very tightly spaced (ms) and then very large gaps (no samples for days).

I often pull the entire series from Influx to process it with a C++ utility.

If I try to pull the entire series in one go, it is too large and the query freezes or fails.

I therefore retrieve it in "chunks", where a chunk is a time span of about 30mn.

I have a query that gets the start and end timestamp of the series.

I then cut up the total time span in chunks of 30mn and send sample retrieval queries for each chunk.

Problem: for some spans, there is no data, and I waste of lot of time querying Influx to get empty responses.

Hence my question: given a valid sample returned by a query and given its timestamp, is there a way to query Influx for the timestamp of the "next" sample right after the one I have?

blondiepassesby
  • 181
  • 1
  • 7

1 Answers1

0

OK, so I think I figured out the answer, InfluxDB SQL has a limit operator, so this:

select * from seriesName where lastSampleTime<time limit 1

will return the first sample right after lastSampleTime.

And it looks like influx is capable of execution this query rather efficiently.

blondiepassesby
  • 181
  • 1
  • 7